summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.sty
blob: 933694871af13b95660509483acf079f02d89052 (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
% Copyright 2012–2017 Patrick Gundlach (patrick@gundla.ch)
% Public repository: https://github.com/pgundlach/lua-check-hyphen
% Licensed under the MIT license. See the file 'mit-license.txt' for exact terms.

% Don't change these two lines, they are updated automatically
\def\luachekchyphenpkgdate{2018/04/19}
\def\luachekchyphenversion{0.7a}


\RequirePackage{ifluatex}
\RequirePackage{luatexbase}
\RequirePackage{keyval}

\DeclareOption{final}{\setkeys{luacheckhyphen}{final}}
\DeclareOption{nofile}{\setkeys{luacheckhyphen}{nofile}}

\DeclareOption*{\setkeys{luacheckhyphen}{\CurrentOption}}

\ProvidesPackage{lua-check-hyphen}[\luachekchyphenpkgdate\space v\luachekchyphenversion\space Hyphenation checking for LuaTeX (PGU)]



\def\luachekchyphendothings{\directlua{luachekchyphen.enable() }}

\define@key{luacheckhyphen}{nofile}[true]{\directlua{luachekchyphen.nofile  = "\luaescapestring{#1}"}}
\define@key{luacheckhyphen}{compact}[true]{\directlua{luachekchyphen.compact  = "\luaescapestring{#1}"}}
\define@key{luacheckhyphen}{final}[true]{\directlua{luachekchyphen.final  = "\luaescapestring{#1}"}}
\define@key{luacheckhyphen}{mark}[true]{\directlua{luachekchyphen.mark     = "\luaescapestring{#1}"}}
\define@key{luacheckhyphen}{whitelist}{\directlua{luachekchyphen.whitelist = "\luaescapestring{#1}"}}


\ifluatex
  \AtBeginDocument{\luachekchyphendothings}
  \directlua{luachekchyphen = require('lua-check-hyphen')}
  \def\LuaCheckHyphen#1{\setkeys{luacheckhyphen}{#1}}
  \AtEndDocument{\directlua{luachekchyphen.listhyphenatedwords()}}
\else
  \def\LuaCheckHyphen#1{}
  \message{Warning: lua-check-hyphen only works with LuaTeX (LaTeX format for now)}
\fi

\ProcessOptions