summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/spelling/spelling.sty89
1 files changed, 44 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/luatex/spelling/spelling.sty b/Master/texmf-dist/tex/luatex/spelling/spelling.sty
index d73661ee1ea..7b06b097c23 100644
--- a/Master/texmf-dist/tex/luatex/spelling/spelling.sty
+++ b/Master/texmf-dist/tex/luatex/spelling/spelling.sty
@@ -11,7 +11,7 @@
%% See file README for more information.
%%
\ProvidesPackage{spelling}
- [2013/02/12 v0.3 Aid spell-checking (SH)]
+ [2013/05/23 v0.4 Support for spell-checking of LuaTeX documents (SH)]
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
% Test for the LuaTeX engine.
\RequirePackage{ifluatex}
@@ -20,104 +20,103 @@
\PackageError{spelling}{LuaTeX engine required}{You could try with the
`lualatex' command.}
\fi
-\RequirePackage{ifthen}
-\RequirePackage{luatexbase}
+% Lua module version management.
+\RequirePackage{luatexbase-modutils}
+% User-defined whatsit node ID allocation.
+\RequirePackage{luatexbase-attr}
% Load main Lua file.
\directlua name {spelling}{
% The main Lua file is not a module, so we must pass a full path to
% `dofile`.
- local f = kpse.find_file('spelling.lua', 'lua')
+ local f = kpse.find_file('spelling-main.lua', 'lua')
dofile(f)
}
% Words are extracted after pages have been built. In lack of a proper
% Lua call-back, we're hooking into shipout from the LaTeX side.
\RequirePackage{atbegshi}
\AtBeginShipout{%
- \directlua name {spelling-atbeginshipout}{cb_AtBeginShipout_pkg_spelling(\the\AtBeginShipoutBox)}%
+ \directlua name {spelling-atbeginshipout}{
+ PKG_spelling.cb_AtBeginShipout(\the\AtBeginShipoutBox)
+ }%
}
% Provide command for reading-in a list of bad spellings.
\newcommand*{\spellingreadbad}[1]{%
\directlua{
- pkg_spelling_stage[1].parse_bad_plain_list_file('\luaescapestring{#1}')
+ PKG_spelling.stage[1].parse_bad_plain_list_file('\luaescapestring{#1}')
}%
}
% Provide command for reading-in a list of good spellings.
\newcommand*{\spellingreadgood}[1]{%
\directlua{
- pkg_spelling_stage[1].parse_good_plain_list_file('\luaescapestring{#1}')
+ PKG_spelling.stage[1].parse_good_plain_list_file('\luaescapestring{#1}')
}%
}
% Provide command for reading bad spellings from a LanguageTool XML
% file.
\newcommand*{\spellingreadLT}[1]{%
\directlua{
- pkg_spelling_stage[1].parse_XML_LanguageTool_file('\luaescapestring{#1}')
+ PKG_spelling.stage[1].parse_XML_LanguageTool_file('\luaescapestring{#1}')
+ }%
+}
+% Provide command for reading match rules from a file. Argument must be
+% a file name.
+\newcommand*{\spellingmatchrules}[1]{%
+ \directlua{
+ PKG_spelling.stage[1].read_match_rules('\luaescapestring{#1}')
}%
}
% Provide command for enabling/disabling visual feedback.
\newcommand*{\spellinghighlight}[1]{%
- \ifthenelse{\equal{#1}{on}}{%
- \directlua{
- pkg_spelling_stage[2].enable_word_highlighting()
- }%
- }{%
- \directlua{
- pkg_spelling_stage[2].disable_word_highlighting()
- }%
+ \directlua{
+ if '\luaescapestring{#1}' == 'on' then
+ PKG_spelling.stage[2].enable_word_highlighting()
+ else
+ PKG_spelling.stage[2].disable_word_highlighting()
+ end
}%
}
% Provide command for setting visual feedback colour.
\newcommand*{\spellinghighlightcolor}[1]{%
\directlua{
- pkg_spelling_stage[2].set_highlight_color('\luaescapestring{#1}')
+ PKG_spelling.stage[2].set_highlight_color('\luaescapestring{#1}')
}%
}
% Provide command for enabling/disabling text ouput.
\newcommand*{\spellingoutput}[1]{%
- \ifthenelse{\equal{#1}{on}}{%
- \directlua{
- pkg_spelling_stage[4].enable_text_output()
- }%
- }{%
- \directlua{
- pkg_spelling_stage[4].disable_text_output()
- }%
+ \directlua{
+ if '\luaescapestring{#1}' == 'on' then
+ PKG_spelling.stage[4].enable_text_output()
+ else
+ PKG_spelling.stage[4].disable_text_output()
+ end
}%
}
% Provide command for setting text output file name.
\newcommand*{\spellingoutputname}[1]{%
\directlua{
- pkg_spelling_stage[4].set_output_file_name('\luaescapestring{#1}')
+ PKG_spelling.stage[4].set_output_file_name('\luaescapestring{#1}')
}%
}
% Provide command for setting text output file line length.
\newcommand*{\spellingoutputlinelength}[1]{%
\directlua{
- pkg_spelling_stage[4].set_output_line_length('\luaescapestring{#1}')
- }%
-}
-% Provide command for setting text output EOL character.
-\newcommand*{\spellingoutputeol}[1]{%
- \directlua{
- pkg_spelling_stage[4].set_output_eol('\luaescapestring{#1}')
+ PKG_spelling.stage[4].set_output_line_length(\luaescapestring{#1})
}%
}
% Provide command for enabling/disabling text extraction.
\newcommand*{\spellingextract}[1]{%
- \ifthenelse{\equal{#1}{on}}{%
- \directlua{
- pkg_spelling_stage[2].enable_text_tagging()
- }%
- }{%
- \directlua{
- pkg_spelling_stage[2].disable_text_tagging()
- }%
+ \directlua{
+ if '\luaescapestring{#1}' == 'on' then
+ PKG_spelling.stage[2].enable_text_tagging()
+ else
+ PKG_spelling.stage[2].disable_text_tagging()
+ end
}%
}
% Provide command to declare code point mappings.
\newcommand*{\spellingmapping}[2]{%
\directlua{
- local r = pkg_spelling_stage[2].set_mapping(\luaescapestring{#1}, '\luaescapestring{#2}')
+ local r = PKG_spelling.stage[2].set_mapping(\luaescapestring{#1}, '\luaescapestring{#2}')
if r == false then
texio.write_nl('package spelling: invalid mapping: \luaescapestring{#1} => \luaescapestring{#2}')
end
@@ -126,19 +125,19 @@
% Provide command to clear all existing code point mappings.
\newcommand*{\spellingclearallmappings}{%
\directlua{
- pkg_spelling_stage[2].clear_all_mappings()
+ PKG_spelling.stage[2].clear_all_mappings()
}%
}
% Provide command to specify table paragraph behaviour.
\newcommand*{\spellingtablepar}[1]{%
\directlua{
- pkg_spelling_stage[3].set_table_paragraphs(\luaescapestring{#1})
+ PKG_spelling.stage[3].set_table_paragraphs(\luaescapestring{#1})
}%
}
%
% Read bad and good spellings from default sources.
\directlua{
- pkg_spelling_stage[1].parse_default_bad_and_good()
+ PKG_spelling.stage[1].parse_default_bad_and_good()
}%
%
% Enable visual feedback.