diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-02-24 12:15:08 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-02-24 12:15:08 +0100 |
commit | 33e29b1ba0661b0f58605749528362a0e12eae52 (patch) | |
tree | d9c1ceebec1f4869ffa0bdeafbeef390cb916525 /doc/context/sources/general/manuals/languages/languages-goodies.tex | |
parent | a3170089e0016cfc0489c433d9113d94b9ce3d67 (diff) | |
download | context-33e29b1ba0661b0f58605749528362a0e12eae52.tar.gz |
2016-02-24 11:22: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..fbbfafc34 --- /dev/null +++ b/doc/context/sources/general/manuals/languages/languages-goodies.tex @@ -0,0 +1,138 @@ +% language=uk + +\environment languages-environment + +\startcomponent languages-goodies + +\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 |