summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/lua-check-hyphen
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/luatex/latex/lua-check-hyphen
Initial commit
Diffstat (limited to 'macros/luatex/latex/lua-check-hyphen')
l---------macros/luatex/latex/lua-check-hyphen/README.md1
-rw-r--r--macros/luatex/latex/lua-check-hyphen/doc/README.md27
-rw-r--r--macros/luatex/latex/lua-check-hyphen/doc/luacheckhyphenmanual.pdfbin0 -> 112214 bytes
-rw-r--r--macros/luatex/latex/lua-check-hyphen/doc/luacheckhyphenmanual.tex173
-rw-r--r--macros/luatex/latex/lua-check-hyphen/doc/mit-license.txt19
-rw-r--r--macros/luatex/latex/lua-check-hyphen/doc/sample.pdfbin0 -> 5268 bytes
-rw-r--r--macros/luatex/latex/lua-check-hyphen/doc/sample.tex10
-rw-r--r--macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.lua284
-rw-r--r--macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.sty44
9 files changed, 558 insertions, 0 deletions
diff --git a/macros/luatex/latex/lua-check-hyphen/README.md b/macros/luatex/latex/lua-check-hyphen/README.md
new file mode 120000
index 0000000000..fd42db32e3
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/README.md
@@ -0,0 +1 @@
+doc/README.md \ No newline at end of file
diff --git a/macros/luatex/latex/lua-check-hyphen/doc/README.md b/macros/luatex/latex/lua-check-hyphen/doc/README.md
new file mode 100644
index 0000000000..24384114ef
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/doc/README.md
@@ -0,0 +1,27 @@
+# lua-check-hyphen
+
+## Usage
+
+ \usepackage{lua-check-hyphen}
+ ...
+ \LuaCheckHyphen{mark,whitelist={filea.txt,fileb.txt}}
+
+## What it does
+
+It lists all hyphenated words in the log file as well as in the file with the extension `.uhy`
+
+## How to use
+
+A typical workflow is:
+
+* run final document
+* put the correctly hyphenated words into a text file (format: each word separated with space or on a single line, only whitespace matters as a separator)
+* add that file to the whitelist (as given above)
+* optionally use the option `mark` to make the unknown hyphenated words visible in the PDF file
+
+
+Copyright 2012–2018 Patrick Gundlach (patrick@gundla.ch) and other contributors (see github)<br>
+Package version: 0.7a
+Public repository: https://github.com/pgundlach/lua-check-hyphen<br>
+Licensed under the MIT license. See the file 'mit-license.txt' for exact terms.<br>
+Status: works fine, slightly unmaintained.<br>
diff --git a/macros/luatex/latex/lua-check-hyphen/doc/luacheckhyphenmanual.pdf b/macros/luatex/latex/lua-check-hyphen/doc/luacheckhyphenmanual.pdf
new file mode 100644
index 0000000000..a701120890
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/doc/luacheckhyphenmanual.pdf
Binary files differ
diff --git a/macros/luatex/latex/lua-check-hyphen/doc/luacheckhyphenmanual.tex b/macros/luatex/latex/lua-check-hyphen/doc/luacheckhyphenmanual.tex
new file mode 100644
index 0000000000..5d043a7124
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/doc/luacheckhyphenmanual.tex
@@ -0,0 +1,173 @@
+\documentclass{ltxdockit}
+\usepackage{csquotes,graphicx}
+\newcommand\pkgversion{0.7a}
+
+\titlepage{%
+ title={The lua-check-hyphen package},
+ subtitle={Checking your hyphenated words},
+ url={https://github.com/pgundlach/lua-check-hyphen},
+ author={Patrick Gundlach},
+ email={patrick@gundla.ch},
+ revision={\pkgversion},
+ date={\today}}
+
+\hypersetup{%
+ pdftitle={The lua-check-hyphen package},
+ pdfsubject={Checking your hyphenated words},
+ pdfauthor={Patrick Gundlach},
+ pdfkeywords={tex, latex, hyphenation}}
+
+
+
+
+\begin{document}
+\printtitlepage
+\tableofcontents
+
+\section{Introduction}
+
+\TeX\ is pretty good at hyphenating words. But a computer algorithm is not perfect, sometimes we wish to manually check all used hyphenations in a document. This package helps you on this task.
+
+\section{Usage}
+
+This package only works with Lua\TeX. To activate it a
+
+\begin{verbatim}
+ \usepackage{lua-check-hyphen}
+\end{verbatim}
+is enough.
+
+When you process your document with Lua\LaTeX, a file with the suffix \verb|.uhy| is created with that contains every hyphenated word. You can check that file for hyphenation errors. With the package option \texttt{nofile}, you can tell the package not to write the external file. In any case the list is written to the log file.
+
+\section{Advanced usage}
+\label{sec:advanced_usage}
+
+With longer documents it becomes tedious checking for the same hyphenated words over and over. Therefore this package allows you to create a whitelist of \emph{accepted hyphenation}. This whitelist is a simple textfile where the words are separated by whitespace and the allowed hyphenation is marked with a dash (-). You can use the output file \texttt{.uhy} as an input for the whitelist file. You load the file in your document with
+
+\begin{verbatim}
+ \LuaCheckHyphen{whitelist=myfile.txt}
+\end{verbatim}
+
+and a sample file looks like this:
+
+\begin{verbatim}
+seren-ity
+morn-ings
+posses-sion
+\end{verbatim}
+
+or
+
+\begin{verbatim}
+seren-ity morn-ings posses-sion
+\end{verbatim}
+
+The format is not important, the entries must be separated by whitespace.
+
+Words in this whitelist won't be reported. \sty{lua-check-hyphen} assumes that these are valid break points.
+
+You can have more than one whitelist file by giving the filenames separated by comma:
+
+\begin{verbatim}
+\LuaCheckHyphen{whitelist={file1.txt,file2.txt,file3.txt}}
+\end{verbatim}
+
+\section{Visual marker}
+
+You might want to use the PDF viewer to check for incorrectly hyphenated words. To enable visual feedback, just pass the \texttt{mark} option to the \cmd{usepackage} or to the \cmd{LuaCheckHyphen} command:
+
+\begin{verbatim}
+\usepackage[mark]{lua-check-hyphen}
+% or:
+\LuaCheckHyphen{mark}
+\end{verbatim}
+
+This marks all non-whitelisted used hyphenation points in the document with a black square (not to be confused with overfull boxes):
+
+\includegraphics{sample-crop}
+
+\section{Options to \cmd{LuaCheckHyphen}}
+
+For the true/false options you don't need to write the \texttt{=true} part. All options except for the \texttt{whitelist} can be passed directly to the package:
+
+\begin{verbatim}
+\usepackage[mark,nofile]{lua-check-hyphen}
+\end{verbatim}
+
+\noindent All options can be set in \cmd{LuaCheckHyphen}.
+
+\begin{verbatim}
+\LuaCheckHyphen{mark,nofile,whitelist=myfile.txt}
+\end{verbatim}
+
+
+\begin{optionlist}
+ \boolitem[true]{compact}{Words with different hyphenation occurrences are listed only once.}
+ \boolitem[false]{mark}{Create visual markers when an unknown hyphenation encountered.}
+ \boolitem[false]{nofile}{Don't write to an external file (\texttt{.uhy}).}
+ \boolitem[false]{file}{Don't do anything. This is for the last document run, no marks will be generated.}
+ \valitem{whitelist}{files}{List of files, separated by \enquote{\texttt{,}}. You need to wrap the filenames in braces \texttt{\textbraceleft...\textbraceright} so that the comma won't be seen as a option separator.}
+\end{optionlist}
+
+\section{Final document}
+
+When you pass the Option \opt{final} to the \cmd{documentclass}, the \cmd{usepackage} or the \cmd{LuaCheckHyphen} command, all processing is disabled.
+
+\section{Changes}
+\begin{changelog}
+\begin{release}{0.7a}{2018-04-19}
+ \item Bugfix for \texttt{--output-directory} with argument separated by = instead of whitespace.
+\end{release}
+\begin{release}{0.7}{2018-04-16}
+ \item Take \texttt{--output-directory} into account.
+\end{release}
+\begin{release}{0.6}{2018-02-07}
+ \item Remove dependencies and update package to a modern LuaTeX. Thanks to Christian Stadelmann.
+\end{release}
+\begin{release}{0.5}{2017-07-31}
+ \item Fix error where I can't find a whitelist file, but the io.open() call does not return an error message.
+\end{release}
+\begin{release}{0.4}{2016-04-01}
+ \item Compact representation of hyphenated words that occur more than once with different hyphenation positions (option copmact=true).
+ \item Sort uhy entries alphabetically and only use lowercase words in the file.
+\end{release}
+ \begin{release}{0.2}{2012-06-22}
+ \item Fix ligature counting error (github issue \#1)
+ \item Add nofile option
+ \item No hyphenation list in the terminal output (log only)
+ \item License details added
+ \end{release}
+\end{changelog}
+
+\section{Bugs}
+
+\begin{itemize}
+ \item Paragraphs that end with \verb+\end{document}+ are ignored. Inserting an empty line or
+ \cmd{par} helps.
+\end{itemize}
+
+\section{License}
+
+This file (documentation and the package) is released under the terms of the MIT License. See the file \texttt{mit-license.txt} in the distribution.
+
+% Copyright (c) 2012 Patrick Gundlach
+
+% Permission is hereby granted, free of charge, to any person obtaining a copy
+% of this software and associated documentation files (the \enquote{Software}), to deal
+% in the Software without restriction, including without limitation the rights
+% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+% copies of the Software, and to permit persons to whom the Software is
+% furnished to do so, subject to the following conditions:
+
+% The above copyright notice and this permission notice shall be included in all
+% copies or substantial portions of the Software.
+
+% THE SOFTWARE IS PROVIDED \enquote{AS IS}, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+% SOFTWARE.
+
+\end{document} \ No newline at end of file
diff --git a/macros/luatex/latex/lua-check-hyphen/doc/mit-license.txt b/macros/luatex/latex/lua-check-hyphen/doc/mit-license.txt
new file mode 100644
index 0000000000..1bc0d0e99e
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/doc/mit-license.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2012-2014 Patrick Gundlach
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/macros/luatex/latex/lua-check-hyphen/doc/sample.pdf b/macros/luatex/latex/lua-check-hyphen/doc/sample.pdf
new file mode 100644
index 0000000000..83d16992ee
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/doc/sample.pdf
Binary files differ
diff --git a/macros/luatex/latex/lua-check-hyphen/doc/sample.tex b/macros/luatex/latex/lua-check-hyphen/doc/sample.tex
new file mode 100644
index 0000000000..618fbf7f17
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/doc/sample.tex
@@ -0,0 +1,10 @@
+\documentclass{article}
+\usepackage{fontspec,nopageno}
+\usepackage[mark]{lua-check-hyphen}
+\begin{document}
+\parindent0.9em
+\hsize 1.3in
+A wonderful serenity has taken possession of my entire soul, like these sweet
+mornings of spring which I enjoy with my whole heart.
+
+\end{document} \ No newline at end of file
diff --git a/macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.lua b/macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.lua
new file mode 100644
index 0000000000..b21a39bcde
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.lua
@@ -0,0 +1,284 @@
+-- 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.
+
+-- Version: 0.7a
+
+
+-- for debugging purpuse:
+-- function w( ... )
+-- texio.write_nl("--->" .. string.format(...))
+-- end
+
+local explode = function(s,p)
+ local t = { }
+ for s in unicode.utf8.gmatch(s,p) do
+ if s ~= "" then
+ t[#t+1] = s
+ end
+ end
+ return t
+end
+
+luacheckhyphen = {}
+
+
+local hyphenattr = luatexbase.new_attribute("hyphenattr")
+
+luacheckhyphen.hyphenwords = {}
+luacheckhyphen.all_hyphenatedwords = {}
+luacheckhyphen.word_whitelist = {}
+luacheckhyphen.rectangle = node.new("whatsit","pdf_literal")
+luacheckhyphen.rectangle.data = string.format("q 0 0 10 10 re f S Q")
+
+local a_glyph_node = node.id("glyph")
+local a_disc_node = node.id("disc")
+local a_glue_node = node.id("glue")
+local a_whatsit_node = node.id("whatsit")
+local subtype_rightskip = 9
+
+
+local sln = unicode.utf8
+
+luacheckhyphen.deligature = function ( glyph_node )
+ local head = glyph_node.components
+ local str = ""
+ while head do
+ if head.id == a_glyph_node then
+ if head.components then
+ str = str .. luacheckhyphen.deligature(head)
+ else
+ str = str .. sln.char(head.char)
+ end
+ end
+ head = head.next
+ end
+ return str
+end
+
+
+-- This functions analyzes the list beginning at head. If it encounters a box,
+-- it recurses into the box. If it finds a disc node, it goes back until it finds the word
+-- start. Then it analyzes the word und finds all hyphenation points. For example the German
+-- word "Salpetersäure" has these disc nodes: , "Sal-petersäure", "Salpe-tersäure",
+-- "Salpeter-säure", and "Salpetersäu-re". Each of these "word with hyphen" gets stored in
+-- the hash hyphenwords
+luacheckhyphen.collect_discs = function(head)
+ local word_start
+ local word
+ -- this is where we store all the breakpoints
+ local thisbreakpoint
+ local word_with_hyphen
+ local c
+ local hyphencounter = #luacheckhyphen.hyphenwords + 1
+ local sln = unicode.utf8
+ local ligature_chars
+ while head do
+ if head.id == 0 then
+ elseif head.id == a_disc_node then
+ word_start = head
+ word_end = head
+ while word_start.prev and word_start.prev.id ~= a_glue_node do
+ word_start = word_start.prev
+ end
+ word = ""
+ c = 0
+ while word_start and word_start.id ~= a_glue_node do
+ if word_start == head then -- disc
+ -- there is a breakpoint after letter c
+ node.set_attribute(head,hyphenattr,hyphencounter)
+ thisbreakpoint = c
+ elseif word_start.id == a_glyph_node then
+ if word_start.components then
+ ligature_chars = luacheckhyphen.deligature(word_start)
+ word = word .. ligature_chars
+ c = c + string.len(ligature_chars)
+ elseif sln.match(sln.char(word_start.char),"%a") then
+ c = c + 1
+ word = word .. sln.char(word_start.char)
+ end
+ end
+ word_start = word_start.next
+ end
+ if thisbreakpoint then
+ word_with_hyphen = sln.sub(word,1,thisbreakpoint) .. "-" .. sln.sub(word,thisbreakpoint+1,-1)
+ -- word with hyphen has all possible hyphenation points
+ luacheckhyphen.hyphenwords[hyphencounter] = word_with_hyphen
+ hyphencounter = #luacheckhyphen.hyphenwords + 1
+ end
+ end
+ head = head.next
+ end
+ return true
+end
+
+-- Remove '-' from word
+local function removedash( word )
+ local ret = sln.gsub(word,"-","")
+ return ret
+end
+
+luacheckhyphen.check_discs = function (head,parent)
+ local c
+ local word
+ local tmp
+ while head do
+ if head.id < 2 then -- a box, recurse
+ luacheckhyphen.check_discs(head.list,head)
+ -- package luashowhyphens has disc-whatsit-rightskip, without luashowhyphens it is disc-rightskip
+ elseif head.id == a_disc_node and head.next and head.next.id == a_glue_node and head.next.subtype == subtype_rightskip or
+ head.id == a_disc_node and head.next and head.next.next and head.next.id == a_whatsit_node and head.next.next.id == a_glue_node and head.next.next.subtype == subtype_rightskip then
+ c = node.has_attribute(head,hyphenattr)
+ word = sln.lower(luacheckhyphen.hyphenwords[c])
+ if luacheckhyphen.word_whitelist[word] then
+ -- word found, but OK (whitelisted)
+ else
+ if luachekchyphen.compact == nil or luachekchyphen.compact == "true" then
+ local word_without_hyphen = removedash(word)
+ local tmp = luacheckhyphen.all_hyphenatedwords[word_without_hyphen] or {}
+ tmp[word] = true
+ luacheckhyphen.all_hyphenatedwords[word_without_hyphen] = tmp
+ else
+ luacheckhyphen.all_hyphenatedwords[word] = true
+ end
+ if luacheckhyphen.drawmarks then
+ tmp = node.copy(luacheckhyphen.rectangle)
+ node.insert_after(parent,head,tmp)
+ end
+ end
+ end
+ head = head.next
+ end
+ return true
+end
+
+-- http://www.lua.org/pil/19.3.html
+local function pairsByKeys (t)
+ local a = {}
+ for n in pairs(t) do table.insert(a, n) end
+ table.sort(a)
+ local i = 0 -- iterator variable
+ local iter = function () -- iterator function
+ i = i + 1
+ if a[i] == nil then return nil
+ else return a[i], t[a[i]]
+ end
+ end
+ return iter
+end
+
+local function getUhyFilename (tex_jobname)
+ local unknown_hyphenation_filename = tex_jobname .. ".uhy"
+ local i = 1
+ local FLAG = '-output-directory'
+ while (arg[i] ~= nil) do
+ local argument = arg[i]
+ if (string.sub(argument, 2, 2) == '-' ) then
+ argument = string.sub(argument, 2)
+ end
+ if (string.sub(argument, 1, string.len(FLAG)) == FLAG) then
+ local prefix = nil
+ if (string.sub(argument, string.len(FLAG)+1, string.len(FLAG)+1) == '=') then
+ prefix = string.sub(argument, string.len(FLAG)+2)
+ else
+ prefix = arg[i+1]
+ end
+ unknown_hyphenation_filename = prefix .. "/" .. unknown_hyphenation_filename
+ break
+ end
+ i = i + 1
+ end
+ return unknown_hyphenation_filename
+end
+
+luacheckhyphen.listhyphenatedwords = function()
+ if luacheckhyphen.final == "true" then
+ return
+ end
+ -- don't write if the use has turned that off!
+ if not luacheckhyphen.nofile then
+ local unknown_hyphenation_filename = getUhyFilename(tex.jobname)
+ local unknown_hyphenation_file = io.open(unknown_hyphenation_filename,"w")
+ for k,v in pairsByKeys(luacheckhyphen.all_hyphenatedwords) do
+ if luachekchyphen.compact == "true" or luachekchyphen.compact == nil then
+ local hyphenationlist = {}
+ local hyphenpos = {}
+ for l,_ in pairs(v) do
+ local tmp = string.find(l,"-")
+ if tmp then
+ hyphenpos[#hyphenpos + 1] = tmp
+ end
+ hyphenationlist[#hyphenationlist + 1] = l
+ end
+ table.sort(hyphenpos)
+ local word_with_all_hyphenationpoints = {}
+ local cur = 1
+ for i=1,string.len(k) do
+ if hyphenpos[cur] == i then
+ word_with_all_hyphenationpoints[#word_with_all_hyphenationpoints + 1] = "-"
+ cur = cur + 1
+ end
+ word_with_all_hyphenationpoints[#word_with_all_hyphenationpoints + 1] = string.sub(k,i, i)
+ end
+ unknown_hyphenation_file:write(table.concat(word_with_all_hyphenationpoints,"") .. "\n")
+ else
+ unknown_hyphenation_file:write(k .. "\n")
+ end
+ end
+ unknown_hyphenation_file:close()
+ end
+
+ texio.write_nl("log","All words with unknown hyphenation below")
+ for k,v in pairs(luacheckhyphen.all_hyphenatedwords) do
+ texio.write_nl("log",k)
+ end
+end
+
+luacheckhyphen.enable = function()
+ if luacheckhyphen.final == "true" then
+ return
+ end
+ local whitelistfile,err
+ local filecontents
+ if luacheckhyphen.whitelist then
+ for i,v in ipairs(string.explode(luacheckhyphen.whitelist,",")) do
+ whitelistfile,err = io.open(v)
+ if not whitelistfile then
+ if err then
+ texio.write_nl(err)
+ else
+ texio.write_nl(string.format("White list %q not found, ignored.",tostring(v)))
+ end
+ else
+ filecontents = whitelistfile:read("*a")
+ for _,entry in ipairs(explode(filecontents,"[^%s]+")) do
+ parts = string.explode(entry,"-")
+ if #parts > 2 then
+ local c = 1
+ for c=1,#parts - 1 do
+ local word = {}
+ for i=1,#parts do
+ word[#word + 1] = parts[i]
+ if i == c then
+ word[#word + 1] = "-"
+ end
+ end
+ luacheckhyphen.word_whitelist[table.concat(word,"")] = true
+ end
+ else
+ luacheckhyphen.word_whitelist[entry] = true
+ end
+ end
+ end
+ end
+ end
+ if luacheckhyphen.mark == "true" then
+ luacheckhyphen.drawmarks = true
+ end
+ luatexbase.add_to_callback("pre_linebreak_filter", luacheckhyphen.collect_discs,"collect_discs")
+ luatexbase.add_to_callback("post_linebreak_filter",luacheckhyphen.check_discs,"check_discs")
+end
+
+return luacheckhyphen
+
+-- end of file
diff --git a/macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.sty b/macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.sty
new file mode 100644
index 0000000000..933694871a
--- /dev/null
+++ b/macros/luatex/latex/lua-check-hyphen/lua-check-hyphen.sty
@@ -0,0 +1,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
+
+