diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-08-01 13:39:31 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-08-01 13:39:31 +0200 |
commit | c44a9d2f89620e439f335029689e7f0dff9516b7 (patch) | |
tree | 1062a464cb13362d82598c41c437ab1c7eb4f236 /doc/context/sources/general/manuals/languages/languages-goodies.tex | |
parent | 665f9095475ffcd1c8750546727c75e5486a266f (diff) | |
download | context-c44a9d2f89620e439f335029689e7f0dff9516b7.tar.gz |
2016-08-01 13:07:00
Diffstat (limited to 'doc/context/sources/general/manuals/languages/languages-goodies.tex')
-rw-r--r-- | doc/context/sources/general/manuals/languages/languages-goodies.tex | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/doc/context/sources/general/manuals/languages/languages-goodies.tex b/doc/context/sources/general/manuals/languages/languages-goodies.tex new file mode 100644 index 000000000..32de54db3 --- /dev/null +++ b/doc/context/sources/general/manuals/languages/languages-goodies.tex @@ -0,0 +1,138 @@ +% language=uk + +\startcomponent languages-goodies + +\environment languages-environment + +\startchapter[title=Goodies][color=darkorange] + +\startsection[title=Introduction] + +There are some features that will only be used in rare cases. They were often +implemented as experiment but found useful enough to keep around. + +\stopsection + +\startsection[title=Spell checking] + +There are some means to check the spelling of words in your document but get it +right: \CONTEXT\ is not a spell|-|checker. These features were added in order to +be able to do some quick checking of documents written by multiple authors. There +are currently three options and we only show a simple examples. + +First you need to load word lists. These are either text files with just words +separated by spacing. + +\starttyping[color=maincolor] +foobar foo-bar foo=bar foo{}{}{}bar foo{}{}{bar} +\stoptyping + +All these words become \type {foobar} which means that one can use words with +discretionary specifications. A text list is loaded with: + +\startbuffer +\loadspellchecklist[en][t:/manuals/lua/words-en.txt] +\stopbuffer + +\typebuffer \getbuffer + +Instead you can load a \LUA\ file with words. Here we use the same structure that +we use for the spell checker provided for \SCITE: + +\starttyping[color=maincolor] +return { + max = 9, + min = 6, + n = 2, + words = { + ["barfoo"] = "Barfoo" + ["foobarred"] = "foobarred", + } +} +\stoptyping + +We use the same load command (you can also load bytecode files with suffix \type +{luc} this way): + +\startbuffer +\loadspellchecklist[nl][t:/scite/data/context/lexers/data/spell-nl.lua] +\stopbuffer + +\typebuffer \getbuffer + +Usage boils down to enabling the checker. If needed we can add more methods. The +first method colors the known and unknown colors. Words shorter then the +threshold of 4 will be skipped. + +\startbuffer +\setupspellchecking[state=start,method=1] +\en Is this written right or is this wromg?\par % m -> n error +\nl Is dit goed geschreven of niet?\par +\setupspellchecking[state=stop] +\stopbuffer + +\typebuffer \startpacked \getbuffer \stoppacked + +You can change the colors: + +\starttyping +\definecolor[word:yes] [g=.75] +\definecolor[word:no] [r=.75] +\stoptyping + +The second method doesn't show anything but produces a file \type +{jobname.words}) with used words. The \type {found} value of \type {list} is used +as key in the produced table. + +\startbuffer +\setupspellchecking[state=start,method=2,list=found] +\en Is this written right or is this wrong?\par +\nl Is dit goed geschreven of niet?\par +\setupspellchecking[state=stop] +\stopbuffer + +\typebuffer \startpacked \getbuffer \stoppacked + +The produced table is: + +\typefile{\jobname.words} + +The result can be traced with a module: + +\startbuffer +\usemodule[s-languages-words] + +\showwords +\stopbuffer + +\typebuffer + +This shows up as: + +\getbuffer + +The third mechanism colors languages differently. We only defined a few colors: + +\starttyping +\definecolor[word:en] [b=.75] +\definecolor[word:de] [r=.75] +\definecolor[word:nl] [g=.75] +\definecolor[word:unknown][r=.75,g=.75] +\stoptyping + +but you can of course define a color for your favourite language in a similar way. + +\startbuffer +\setupspellchecking[state=start,method=3] +\en Is this written right or is this wrong?\par +\nl Is dit goed geschreven of niet?\par +\setupspellchecking[state=stop] +\stopbuffer + +\typebuffer \startpacked \getbuffer \stoppacked + +\stopsection + +\stopchapter + +\stopcomponent |