summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/luatex/luavlna/README.md2
-rw-r--r--Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdfbin88997 -> 91288 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex17
-rw-r--r--Master/texmf-dist/tex/luatex/luavlna/luavlna.lua38
-rw-r--r--Master/texmf-dist/tex/luatex/luavlna/luavlna.sty14
-rw-r--r--Master/texmf-dist/tex/luatex/luavlna/luavlna.tex1
6 files changed, 65 insertions, 7 deletions
diff --git a/Master/texmf-dist/doc/luatex/luavlna/README.md b/Master/texmf-dist/doc/luatex/luavlna/README.md
index ae6eb4cfb89..dab00a6ca06 100644
--- a/Master/texmf-dist/doc/luatex/luavlna/README.md
+++ b/Master/texmf-dist/doc/luatex/luavlna/README.md
@@ -1,4 +1,4 @@
-# Luavlna, version v0.1e, 2019-10-29
+# Luavlna, version v0.1f, 2019-11-06
# Introduction
diff --git a/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf b/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf
index 177832d3f4f..e62a9bd1d4e 100644
--- a/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf
+++ b/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex b/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex
index f8c95a291cb..eb39ca3ac91 100644
--- a/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex
+++ b/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex
@@ -130,6 +130,19 @@ It is also possible to use the package with Lua\LaTeX, just use
in the preamble.
+\section{Package options}
+The \verb|luavlna| package recognizes the following options
+
+\begin{description}
+ \item[\texttt{noprocess}] -- disable the automatic document processing.
+ \item[\texttt{noinitials}] -- disable processing of the initials.
+ \item[\texttt{nounits}] -- disable processing of the SI units.
+ \item[\texttt{nopredegrees}] -- disable processing of the the academic degrees before names.
+ \item[\texttt{nosufdegrees}] -- disable processing of the the academic degrees after names.
+ \item[\texttt{debug}] -- enable the debugging mode.
+ \item[\texttt{defaults}] -- load default settings. Enabled by default.
+\end{description}
+
\section{Commands}
\begin{mycode}
@@ -222,14 +235,16 @@ To resume processing, use
\cmd{\preventsingleon}
\end{mycode}
-You can also disable units and degrees processing:
+You can also disable initials, units and degrees processing:
\begin{mycode}
+ \cmd{\noinitials}\\
\cmd{\nounits}\\
\cmd{\nopredegrees}\\
\cmd{\nosufdegrees}
\end{mycode}
+
\subsection{Debugging commands}
\begin{mycode}
\cmd{\preventsingledebugon}\par
diff --git a/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua b/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua
index dea4c052eb0..d1eaa6f0044 100644
--- a/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua
+++ b/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua
@@ -14,6 +14,7 @@ local glue_id = node.id "glue"
local glyph_id = node.id "glyph"
local hlist_id = node.id "hlist"
local vlist_id = node.id "vlist"
+local penalty_id = node.id "penalty"
local math_id = node.id "math"
local period_char = string.byte(".")
@@ -224,6 +225,7 @@ local function prevent_single_letter (head)
local word = ""
local no_predegrees = M.no_predegrees
local no_sufdegrees = M.no_sufdegrees
+ local no_initials = M.no_initials
local in_math = false
while head do
local id = head.id
@@ -284,7 +286,7 @@ local function prevent_single_letter (head)
space = false
-- handle initials
-- uppercase letter followed by period (code 46)
- elseif init and head.id == glyph_id and head.char == period_char and nextn.id == glue_id and utf_len(word) == 1 then
+ elseif no_initials~=true and init and head.id == glyph_id and head.char == period_char and nextn.id == glue_id and utf_len(word) == 1 then
head = insert_penalty(head)
elseif head.id == glyph_id then
local char = utf_char(head.char)
@@ -305,20 +307,48 @@ local function prevent_single_letter (head)
return true
end
+local hyphenate_langs = {}
+local hyphenchar = string.byte("-")
+-- don't break if the next or previous char is hyphen, in order to support ligaturing of dashes
+local is_hyphen_ligature = function(n)
+ local next_node = n.next
+ -- split_hyphens code
+ if next_node and next_node.id == glyph_id and next_node.char == hyphenchar then
+ return true
+ end
+ local prev_node = n.prev
+ if prev_node and prev_node.id == glyph_id and prev_node.char == hyphenchar then
+ return true
+ end
+ return false
+end
+
+-- detect if the current character is a hyphen
+local function is_breakable_hyphen(n)
+ return n.id == glyph_id and hyphenate_langs[n.lang] and n.char == hyphenchar
+end
+
+-- don't process hyphens if the next node is penalty
+-- necessary to support \nobreakdash
+local function is_next_penalty(n)
+ local next_node = n.next
+ if next_node and next_node.id == penalty_id then
+ return true
+ end
+end
+
-- Enable hyphenation of words that contain hyphens
-- and repeating of the explicit hyphen on a new line when
-- the hyphen is hyphenated
-- It should be used in the `hyphenate` callback
-- based on ShreewatsaR's code from:
-- https://tex.stackexchange.com/a/417883/2891
-local hyphenate_langs = {}
local break_hyphens = function(head, tail)
- local hyphenchar = string.byte("-")
local glyph_id = node.id("glyph")
local n = head
while n do
local skip = node.has_attribute(n, M.preventsingleid)
- if skip ~= 1 and n.id == glyph_id and hyphenate_langs[n.lang] and n.char == hyphenchar then
+ if skip ~= 1 and is_breakable_hyphen(n) and not is_next_penalty(n) and not is_hyphen_ligature(n) then
-- Insert an infinite penalty before, and a zero-width glue node after, the hyphen.
-- Like writing "\nobreak-\hspace{0pt}" or equivalently "\penalty10000-\hskip0pt"
local p = node.new(node.id('penalty'))
diff --git a/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty b/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty
index 48db36b5f47..c620b670d10 100644
--- a/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty
+++ b/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty
@@ -1,4 +1,6 @@
-\ProvidesPackage{luavlna}[2017/09/30 luavlna]
+\ProvidesPackage{luavlna}[2019/10/30 luavlna]
+
+\RequirePackage{kvoptions}
\def\nosingledefaults{\relax}
\input luavlna
@@ -32,7 +34,16 @@
\fi%
}
+\DeclareVoidOption{noinitials}{\noinitials}
+\DeclareVoidOption{nounits}{\nounits}
+\DeclareVoidOption{nopredegrees}{\nopredegrees}
+\DeclareVoidOption{nosufdegrees}{\nosufdegrees}
+\DeclareVoidOption{noprocess}{\preventsingleoff}
+\DeclareVoidOption{debug}{\preventsingledebugon}
+\DeclareBoolOption[true]{defaults}
+\ProcessKeyvalOptions*
+\ifluavlna@defaults
\AtBeginDocument{%
\singlechars{czech}{AIiVvOoUuSsZzKk}
\singlechars{slovak}{AIiVvOoUuSsZzKk}
@@ -40,4 +51,5 @@
\enablesplithyphens{czech}
\enablesplithyphens{slovak}
}
+\fi
\endinput
diff --git a/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex b/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex
index 5159fbe5b54..ab47b8d6fcf 100644
--- a/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex
+++ b/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex
@@ -112,6 +112,7 @@ end
\def\nopredegrees{\directlua{luavlna.no_predegrees = true}}
\def\nosufdegrees{\directlua{luavlna.no_sufdegrees = true}}
\def\nounits{\directlua{luavlna.no_unit = true}}
+\def\noinitials{\directlua{luavlna.no_initials = true}}
\ifdefined\nosingledefaults\else
\singlechars{czech}{AIiVvOoUuSsZzKk}