summaryrefslogtreecommitdiff
path: root/tex/context/base/lang-wrd.mkiv
blob: 2fda3b3442477459d1791e653f2c586c9160f750 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%D \module
%D   [       file=lang-wrd,
%D        version=2006.XX.XX,
%D          title=\CONTEXT\ Language Macros,
%D       subtitle=Checking,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D Experimental.

\writestatus{loading}{ConTeXt Language Macros / Checking}

\registerctxluafile{lang-wrd}{1.001}

\unprotect

% \loadspellchecklist[en][words-en.txt]
% \loadspellchecklist[us][words-en.txt]
% \loadspellchecklist[nl][words-nl.txt]
% \setupspellchecking[state=start,method=1]
%
% \setupspellchecking[state=start,method=2]
% ...
% \typefile{\jobname.words}

\def\loadspellchecklist
  {\dodoubleempty\doloadspellchecklist}

\def\doloadspellchecklist[#1][#2]%
  {\ctxlua{languages.words.load("#1","#2")}}

\unexpanded\def\setupspellchecking
  {\dosingleargument\dosetupspellchecking}

\newtoks\everysetupspellchecking

\unexpanded\def\setupspellchecking[#1]% todo colors
  {\getparameters[\??wl][#1]%
   \the\everysetupspellchecking}

\appendtoks
   \doifelse\@@wlstate\v!start
     {\ctxlua{languages.words.enable { method = "\@@wlmethod", list = "\@@wllist" }}}
     {\ctxlua{languages.words.disable()}}%
\to \everysetupspellchecking

% beware, maybe some day we will honour grouping

% 1: spell checking
% 2: word counting
% 3: language coloring

\setupspellchecking
  [\c!state=\v!stop,
   \c!method=1,
   \c!list=]

\definecolor[word:yes]    [g=.75]
\definecolor[word:no]     [r=.75]

%definecolor[word:unset]  [s=.75]
\definecolor[word:en]     [b=.75]
\definecolor[word:de]     [r=.75]
\definecolor[word:nl]     [g=.75]
\definecolor[word:unknown][r=.75,g=.75]

\protect \endinput