lang-wrd.mkiv / last modification: 2020-01-30 14:16
%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}{}

\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}
%
% beware, maybe some day we will honour grouping
%
% 1: spell checking
% 2: word counting
% 3: language coloring

\installcorenamespace{spell}

\installdirectcommandhandler \??spell {spellchecking}

\appendtoks
   \doifelse{\directspellcheckingparameter\c!state}\v!start
     {\clf_enablespellchecking
        method {\directspellcheckingparameter\c!method}%
        list   {\directspellcheckingparameter\c!list}%
      \relax}
     {\clf_disablespellchecking}%
\to \everysetupspellchecking

\unexpanded\def\loadspellchecklist
  {\dodoubleempty\lang_spellchecking_load_list}

\def\lang_spellchecking_load_list[#1][#2]%
  {\clf_loadspellchecklist{#1}{#2}}

\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