more cleanups to glossary tool
FossilOrigin-Name: 1f65a54d83501a26145999651964cc7c043d47559bf2756056a51e7117ac9bbd
This commit is contained in:
parent
0acd64d508
commit
6b9847b531
1 changed files with 112 additions and 95 deletions
|
@ -66,6 +66,10 @@ current line contents.
|
|||
'SourceLine var
|
||||
~~~
|
||||
|
||||
~~~
|
||||
{{
|
||||
~~~
|
||||
|
||||
And a helper word to skip a specified number of fields.
|
||||
|
||||
~~~
|
||||
|
@ -91,6 +95,8 @@ The other way would be to define them manually:
|
|||
...
|
||||
|
||||
~~~
|
||||
---reveal---
|
||||
|
||||
#0 { 'name 'dstack 'astack 'fstack
|
||||
'descr 'itime 'ctime 'class
|
||||
'ex1 'ex2 'namespace 'interface }
|
||||
|
@ -98,6 +104,7 @@ The other way would be to define them manually:
|
|||
[ 'field: s:prepend d:create
|
||||
dup compile:lit &select compile:call compile:ret
|
||||
&class:word reclass n:inc ] set:for-each drop
|
||||
}}
|
||||
~~~
|
||||
|
||||
# Display an Entry
|
||||
|
@ -174,10 +181,12 @@ There are five primary roles:
|
|||
## Describe a Word
|
||||
|
||||
~~~
|
||||
{{
|
||||
:matched? (-f) field:name TARGET s:eq? ;
|
||||
|
||||
---reveal---
|
||||
:find-and-display-entry
|
||||
'words.tsv [ s:keep !SourceLine matched? [ display-result ] if ] file:for-each-line ;
|
||||
}}
|
||||
~~~
|
||||
|
||||
|
||||
|
@ -249,6 +258,7 @@ Editing is a bit tricky. To keep things as simple as possible, I export
|
|||
each field to a separate file under `/tmp/`.
|
||||
|
||||
~~~
|
||||
{{
|
||||
:export-fields
|
||||
field:name '/tmp/glossary.name file:spew
|
||||
field:dstack '/tmp/glossary.dstack file:spew
|
||||
|
@ -365,15 +375,22 @@ Next, get the editor from the $EDITOR environment variable.
|
|||
~~~
|
||||
|
||||
~~~
|
||||
:prepare '/tmp/words.new file:W file:open !FOUT ;
|
||||
:cleanup 'mv_/tmp/words.new_words.tsv unix:system ;
|
||||
~~~
|
||||
|
||||
~~~
|
||||
---reveal---
|
||||
:handle-edit
|
||||
'words.new file:W file:open !FOUT
|
||||
prepare
|
||||
'words.tsv
|
||||
[ s:keep !SourceLine field:name TARGET2 s:eq?
|
||||
[ select-field generate-entry ]
|
||||
[ @SourceLine write-line ] choose write-nl
|
||||
] file:for-each-line
|
||||
@FOUT file:close delete-temporary
|
||||
'mv_words.new_words.tsv unix:system ;
|
||||
cleanup ;
|
||||
}}
|
||||
~~~
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue