texlive[52569] Master: luavlna.tex in runtime

commits+karl at tug.org commits+karl at tug.org
Tue Oct 29 22:22:13 CET 2019


Revision: 52569
          http://tug.org/svn/texlive?view=revision&revision=52569
Author:   karl
Date:     2019-10-29 22:22:13 +0100 (Tue, 29 Oct 2019)
Log Message:
-----------
luavlna.tex in runtime

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/luavlna/README.md
    trunk/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf
    trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua
    trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty
    trunk/Master/tlpkg/libexec/ctan2tds

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/luatex/luavlna/luavlna.tex

Modified: trunk/Master/texmf-dist/doc/luatex/luavlna/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luavlna/README.md	2019-10-29 21:16:46 UTC (rev 52568)
+++ trunk/Master/texmf-dist/doc/luatex/luavlna/README.md	2019-10-29 21:22:13 UTC (rev 52569)
@@ -1,4 +1,4 @@
-# Luavlna, version v0.1d, 2019-10-22
+# Luavlna, version v0.1e, 2019-10-29
 
 # Introduction
 

Modified: trunk/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf
===================================================================
(Binary files differ)

Deleted: trunk/Master/texmf-dist/doc/luatex/luavlna/luavlna.tex
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luavlna/luavlna.tex	2019-10-29 21:16:46 UTC (rev 52568)
+++ trunk/Master/texmf-dist/doc/luatex/luavlna/luavlna.tex	2019-10-29 21:22:13 UTC (rev 52569)
@@ -1,122 +0,0 @@
-% Modify pre_linebreak_filter callback so the spaces can be inserted
-\directlua{%         
-luavlna = require "luavlna" 
-langno  = require "luavlna-langno"
-
-require "ltluatex"
-luatexbase.add_to_callback("pre_linebreak_filter", luavlna.preventsingle,"LuaVlna")
-luatexbase.add_to_callback("hyphenate", luavlna.split_hyphens, "allow hyphen breaks")
-% -- define the attribute number
-luavlna.preventsingleid = math.random(2^16)
-
-local languages = langno.load_languages()
-local get_lang_id = function(lang)
-  local langid = lang 
-  if not tonumber(lang) then
-    langid = languages:get_number(lang)
-  end
-  return langid
-end
-
-% Process string and make table of enabled single letters
-% By default, spaces for all single letters are inserted
-% This can be modified with \singlechars macro
-set_singlechars = function(lang,chars)
-  local utf_gmatch = unicode.utf8.gmatch
-  % local langnumbers = languages.names
-  local langid = get_lang_id(lang) 
-  if not langid then return nil, "Cannot find language number for: "..lang end
-  local chars = chars  or ""
-  local singlechars = {}
-  local percent = string.char(37)
-  local alpha = percent .. "a"
-  for char in utf_gmatch(chars,"("..alpha..")") do
-    singlechars[char] = true
-  end
-  luavlna.singlechars(langid,singlechars)
-end
-
-% set compound characters for initials handling
-% useful for Czech "Ch" etc.
-% comma separated list of compounds
-set_compounds = function(lang, compounds)
-  local langid = get_lang_id(lang)
-  if not langid then return nil, "Cannot find language number for: "..lang end
-  local c = compounds:explode(",+") % match multiple colons as one
-  local  compoundstable = {}
-  for _, compound in pairs(c) do
-    compoundstable[compound] = true
-  end
-  luavlna.initials(langid, compoundstable)
-end
-
-set_main_language = function(lang)
-  local langid = languages:get_number(lang)
-  if not langid then return nil, "Cannot find language number for: "..lang end
-  luavlna.set_main_language(langid)
-end	
-
-enable_split_hyphens = function(lang)
-  local langid = languages:get_number(lang)
-  if not langid then return nil, "Cannot find language number for: "..lang end
-  luavlna.split_hyphen_langs[langid] = true
-end
-
-disable_split_hyphens = function(lang)
-  local langid = languages:get_number(lang)
-  if not langid then return nil, "Cannot find language number for: "..lang end
-  luavlna.split_hyphen_langs[langid] = nil
-end
-}     
-
-% Set letters which are prevented from breaking
-\def\singlechars#1#2{%
-\directlua{set_singlechars("#1","#2")}
-}
-
-% Define compound initials
-\def\compoundinitials#1#2{%
-\directlua{set_compounds("#1","#2")}
-}
-% Enable inserting of visual marks for debugging
-\def\preventsingledebugon{%
-\directlua{luavlna.debug(true)}
-}
-
-\def\preventsinglelang#1{%
-	\directlua{set_main_language("#1")}
-} 
-
-%\newluatexattribute\preventsinglestatus
-\attributedef\preventsinglestatus=\directlua{tex.print(luavlna.preventsingleid)} % just a random number
-
-\def\preventsingleon{%
-	\preventsinglestatus=2
-}
-
-\def\preventsingleoff{
-	\preventsinglestatus=1
-}
-% Disable inserting of visual marks for dewbugging
-\def\preventsingledebugoff{%
-\directlua{luavlna.debug(false)}
-}
-
-% enable/disable split hyphens for a language
-
-\def\enablesplithyphens#1{\directlua{enable_split_hyphens("#1")}}
-\def\disablesplithyphens#1{\directlua{disable_split_hyphens("#1")}}
-
-% disable processing of units or degrees
-
-\def\nopredegrees{\directlua{luavlna.no_predegrees = true}}
-\def\nosufdegrees{\directlua{luavlna.no_sufdegrees = true}}
-\def\nounits{\directlua{luavlna.no_unit = true}}
-
-\ifdefined\nosingledefaults\else
-  \singlechars{czech}{AIiVvOoUuSsZzKk}
-  \singlechars{slovak}{AIiVvOoUuSsZzKk}
-  \compoundinitials{czech}{Ch,CH}
-  \enablesplithyphens{czech}
-\fi
-

Modified: trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua	2019-10-29 21:16:46 UTC (rev 52568)
+++ trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.lua	2019-10-29 21:22:13 UTC (rev 52569)
@@ -317,7 +317,8 @@
     local glyph_id = node.id("glyph")
     local n = head
     while n do
-       if n.id == glyph_id and hyphenate_langs[n.lang] and n.char == hyphenchar then
+       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
           -- 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'))

Modified: trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty	2019-10-29 21:16:46 UTC (rev 52568)
+++ trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.sty	2019-10-29 21:22:13 UTC (rev 52569)
@@ -3,6 +3,8 @@
 \def\nosingledefaults{\relax}
 \input luavlna 
 
+% we need to redefine the setting functions to use directly the language numbers
+% in order to support polyglossia
 \def\singlechars#1#2{%
   \ifcsname l@#1\endcsname%
     \expandafter\directlua\expandafter{set_singlechars("\the\csname l@#1\endcsname","#2")}%
@@ -16,10 +18,26 @@
   \fi%
 }
 
+
+\def\enablesplithyphens#1{%
+  \ifcsname l@#1\endcsname%
+  \typeout{set lang #1, \the\csname l@#1\endcsname}
+    \directlua{enable_split_hyphens("\the\csname l@#1\endcsname")}%
+  \fi%
+}
+
+\def\disablesplithyphens#1{%
+  \ifcsname l@#1\endcsname%
+    \directlua{disable_split_hyphens("\the\csname l@#1\endcsname")}%
+  \fi%
+}
+
+
 \AtBeginDocument{%
   \singlechars{czech}{AIiVvOoUuSsZzKk}
   \singlechars{slovak}{AIiVvOoUuSsZzKk}
   \compoundinitials{czech}{Ch,CH}
   \enablesplithyphens{czech}
+  \enablesplithyphens{slovak}
 }
 \endinput

Added: trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex	2019-10-29 21:22:13 UTC (rev 52569)
@@ -0,0 +1,123 @@
+% Modify pre_linebreak_filter callback so the spaces can be inserted
+\directlua{%         
+luavlna = require "luavlna" 
+langno  = require "luavlna-langno"
+
+require "ltluatex"
+luatexbase.add_to_callback("pre_linebreak_filter", luavlna.preventsingle,"LuaVlna")
+luatexbase.add_to_callback("hyphenate", luavlna.split_hyphens, "allow hyphen breaks")
+% -- define the attribute number
+luavlna.preventsingleid = math.random(2^16)
+
+local languages = langno.load_languages()
+local get_lang_id = function(lang)
+  local langid = tonumber(lang)
+  if not tonumber(lang) then
+    langid = languages:get_number(lang)
+  end
+  return langid
+end
+
+% Process string and make table of enabled single letters
+% By default, spaces for all single letters are inserted
+% This can be modified with \singlechars macro
+set_singlechars = function(lang,chars)
+  local utf_gmatch = unicode.utf8.gmatch
+  % local langnumbers = languages.names
+  local langid = get_lang_id(lang) 
+  if not langid then return nil, "Cannot find language number for: "..lang end
+  local chars = chars  or ""
+  local singlechars = {}
+  local percent = string.char(37)
+  local alpha = percent .. "a"
+  for char in utf_gmatch(chars,"("..alpha..")") do
+    singlechars[char] = true
+  end
+  luavlna.singlechars(langid,singlechars)
+end
+
+% set compound characters for initials handling
+% useful for Czech "Ch" etc.
+% comma separated list of compounds
+set_compounds = function(lang, compounds)
+  local langid = get_lang_id(lang)
+  if not langid then return nil, "Cannot find language number for: "..lang end
+  local c = compounds:explode(",+") % match multiple colons as one
+  local  compoundstable = {}
+  for _, compound in pairs(c) do
+    compoundstable[compound] = true
+  end
+  luavlna.initials(langid, compoundstable)
+end
+
+set_main_language = function(lang)
+  local langid = languages:get_number(lang)
+  if not langid then return nil, "Cannot find language number for: "..lang end
+  luavlna.set_main_language(langid)
+end	
+
+enable_split_hyphens = function(lang)
+  local langid = get_lang_id(lang)
+  if not langid then return nil, "Cannot find language number for: "..lang end
+  luavlna.split_hyphen_langs[langid] = true
+end
+
+disable_split_hyphens = function(lang)
+  local langid = get_lang_id(lang)
+  if not langid then return nil, "Cannot find language number for: "..lang end
+  luavlna.split_hyphen_langs[langid] = nil
+end
+}     
+
+% Set letters which are prevented from breaking
+\def\singlechars#1#2{%
+\directlua{set_singlechars("#1","#2")}
+}
+
+% Define compound initials
+\def\compoundinitials#1#2{%
+\directlua{set_compounds("#1","#2")}
+}
+% Enable inserting of visual marks for debugging
+\def\preventsingledebugon{%
+\directlua{luavlna.debug(true)}
+}
+
+\def\preventsinglelang#1{%
+	\directlua{set_main_language("#1")}
+} 
+
+%\newluatexattribute\preventsinglestatus
+\attributedef\preventsinglestatus=\directlua{tex.print(luavlna.preventsingleid)} % just a random number
+
+\def\preventsingleon{%
+	\preventsinglestatus=2
+}
+
+\def\preventsingleoff{
+	\preventsinglestatus=1
+}
+% Disable inserting of visual marks for dewbugging
+\def\preventsingledebugoff{%
+\directlua{luavlna.debug(false)}
+}
+
+% enable/disable split hyphens for a language
+
+\def\enablesplithyphens#1{\directlua{enable_split_hyphens("#1")}}
+\def\disablesplithyphens#1{\directlua{disable_split_hyphens("#1")}}
+
+% disable processing of units or degrees
+
+\def\nopredegrees{\directlua{luavlna.no_predegrees = true}}
+\def\nosufdegrees{\directlua{luavlna.no_sufdegrees = true}}
+\def\nounits{\directlua{luavlna.no_unit = true}}
+
+\ifdefined\nosingledefaults\else
+  \singlechars{czech}{AIiVvOoUuSsZzKk}
+  \singlechars{slovak}{AIiVvOoUuSsZzKk}
+  \compoundinitials{czech}{Ch,CH}
+  \enablesplithyphens{czech}
+  \enablesplithyphens{slovak}
+\fi
+


Property changes on: trunk/Master/texmf-dist/tex/luatex/luavlna/luavlna.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2019-10-29 21:16:46 UTC (rev 52568)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2019-10-29 21:22:13 UTC (rev 52569)
@@ -1877,7 +1877,7 @@
  'luapackageloader', '\.lua|' . $standardtex,
  'luatexko',    '\.lua|' . $standardtex,
  'luatodonotes','\.lua|' . $standardtex, 
- 'luavlna',	'luavlna.*\.lua|' . $standardtex, 
+ 'luavlna',	'luavlna.*\.lua|luavlna\.tex|' . $standardtex, 
  'luaxml',      '\.lua|' . $standardtex,
  'lyluatex',	'\.sty',	# not *.cls
  'magyar',      'NULL',  # do not install in runtime, conflicts with babel



More information about the tex-live-commits mailing list