Hi again, On 2012-04-20 16:32, Jelle Huisman wrote:
Hello all,
Here is another question. Consider this test file:
\starttext \setupspellchecking[state=start,method=2] \ctxlua{languages.words.threshold=3} \input knuth \stoptext
Typesetting this file produces a word list 'test.words' which ends like this:
["threshold"]=1, ["total"]=122, ["version"]=1, }
Is there a way to extract the value for ["total"] ('122' in this case) so that I can use that value somewhere else, e.g. in a project file where I want to present a word count.
The “.words”-file is well formed Lua code, so you can just integrate it as a table: ········································································ \define\wordcount{%%% Displays word count. This document consists of \startluacode local data = dofile"\jobname.words" %% Load data of _previous_ pass context(data.total) %% access the requested field \stopluacode \space words.% } \starttext \setupspellchecking[state=start,method=2] \ctxlua{languages.words.threshold=3} \input knuth \hairline \wordcount %% call to the macro \stoptext ········································································
Thanks for a pointer!
Thanks as well, btw, I didn’t know the word count facility yet! Philipp
Jelle ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments