texlive[42670] Master: luahyphenrules (10dec16)

commits+karl at tug.org commits+karl at tug.org
Sat Dec 10 23:48:29 CET 2016


Revision: 42670
          http://tug.org/svn/texlive?view=revision&revision=42670
Author:   karl
Date:     2016-12-10 23:48:29 +0100 (Sat, 10 Dec 2016)
Log Message:
-----------
luahyphenrules (10dec16)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/
    trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/README.md
    trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.pdf
    trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.tex
    trunk/Master/texmf-dist/tex/lualatex/luahyphenrules/
    trunk/Master/texmf-dist/tex/lualatex/luahyphenrules/luahyphenrules.sty
    trunk/Master/tlpkg/tlpsrc/luahyphenrules.tlpsrc

Added: trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/README.md	2016-12-10 22:48:29 UTC (rev 42670)
@@ -0,0 +1,15 @@
+luahyphenrules
+==============
+
+Preloading hyphenation patterns (or “hyphen rules”) into the format is
+not required in LuaTeX and recent releases of `babel` don't do it.
+This package is addressed to those who just want to select the
+language and load their patterns by means of `language.dat` without
+loading `babel`.
+
+* Javier Bezos
+* 2016-12-07
+* Released under the LaTeX Project Public License v1.3c or later
+  See http://www.latex-project.org/lppl.txt
+* It requires LuaLaTeX
+

Added: trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.pdf	2016-12-10 22:47:59 UTC (rev 42669)
+++ trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.pdf	2016-12-10 22:48:29 UTC (rev 42670)

Property changes on: trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/luahyphenrules/luahyphenrules.tex	2016-12-10 22:48:29 UTC (rev 42670)
@@ -0,0 +1,114 @@
+% +--------------------------------------------------+
+% | Typeset this file to get the documentation.      |
+% +--------------------------------------------------+
+%
+%% Copyright (C) 2016 Javier Bezos
+%% All Rights Reserved
+%% http://www.texnia.com
+%%
+%% This work may be distributed and/or modified under the conditions
+%% of the LaTeX Project Public License, either version 1.3 of this
+%% license or (at your option) any later version.  The latest version
+%% of this license is in
+%%     http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer of this work is Javier Bezos.
+%%
+%% This work consists of the files luahyphenrules.tex and
+%% luahyphenrules.sty.
+\documentclass[a4paper]{ltxguide}
+
+\title{\textsf{luahyphenrules}\\\large Version 1.0}
+
+\author{Javier Bezos\\\texttt{http://www.texnia.com}}
+
+\date{2016-12-07}
+   
+\raggedright
+\parskip=.8ex
+\advance\oddsidemargin-.7cm
+\advance\textwidth2cm
+\addtolength{\textheight}{3.5cm}
+\addtolength{\topmargin}{-2cm}
+
+\usepackage{xcolor,bera}
+
+\definecolor{notes}{rgb}{.75, .3, .3}%
+
+\makeatletter
+\def\@begintheorem#1#2{%
+  \list{}{}%
+  \global\advance\@listdepth\m at ne
+  \item[{\sffamily\bfseries\color{notes}\MakeUppercase{#1}}]}%
+\makeatother
+\newtheorem{warning}{Warning}
+\newtheorem{note}{Note}
+\newtheorem{example}{Example}
+
+\begin{document}
+
+\vspace*{1cm}
+{\fontsize{48}{48}\selectfont \color{notes}{luahyphenrules}\par}
+{\LARGE Loading patterns in \textsf{lualatex} with
+\texttt{language.dat}\par}
+\vspace*{1ex}
+Version 1.0 (2016-12-07)\par
+Javier Bezos (\texttt{http://www.texnia.com})
+
+\vspace*{6ex}
+
+Preloading hyphenation patterns (or ``hyphen rules'') into the format
+is not required in Lua\TeX. On the contrary, it is even discouraged
+and accordingly recent releases of \textsf{babel} don't do it. This file is
+addressed to those who just want to select the language and load their
+patterns without loading at all the \textsf{babel} package with
+|\usepackage|.
+
+When \textsf{luahyphenrules} is loaded, it reads |language.dat| and
+stores its data. Then, you can use the following command to select the
+language.
+
+\begin{decl}
+|\HyphenRules{<language-name>}|
+\end{decl}
+
+Here |<language-name>| is the name in |language.dat|. It select the
+language, if exists, and loads its hyphenations patterns if not done
+before. If the language does not exist or there are no patterns, it
+raises and error.
+
+\begin{note}
+  If you are using \textsf{babel} you do not need this package.
+\end{note}
+
+\begin{note}
+  Actually, loading hypenations patterns in Lua\TeX{} is so simple as
+  inputting the corresponding file with the correct catcode regime
+  when the language is active (which in turn may be created with
+  |\newlanguage|). This package is mostly about reading and
+  parsing |language.dat| at runtime.
+\end{note}
+
+\begin{note}
+  The internal variable |\bbl at languages|, containing the list of
+  languages in |language.dat|, is also set by this package. See the
+  \textsf{babel} manual for further info.
+\end{note}
+
+\begin{warning}
+  This package only works with Lua\LaTeX.
+\end{warning}
+
+
+\end{document}
+
+
+
+
+
+
+

Added: trunk/Master/texmf-dist/tex/lualatex/luahyphenrules/luahyphenrules.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/luahyphenrules/luahyphenrules.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/lualatex/luahyphenrules/luahyphenrules.sty	2016-12-10 22:48:29 UTC (rev 42670)
@@ -0,0 +1,161 @@
+% +--------------------------------------------------------+
+% | Typeset luahyphenrules.tex to get the documentation.   |
+% +--------------------------------------------------------+
+%
+%% Copyright (C) 2016 Javier Bezos
+%% All Rights Reserved
+%% http://www.texnia.com
+%%
+%% This work may be distributed and/or modified under the conditions
+%% of the LaTeX Project Public License, either version 1.3 of this
+%% license or (at your option) any later version.  The latest version
+%% of this license is in
+%%     http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer of this work is Javier Bezos.
+%%
+%% This work consists of the files luahyphenrules.tex and
+%% luahyphenrules.sty.
+\ProvidesPackage{luahyphenrules}
+          [2016/12/07 v1.0 language.dat reader lualatex]
+
+% The code below is essentially the same as in babel.dtx, with a few
+% minor changes. See the latter for further info.
+
+\begingroup
+  \toks@{}
+  \count@\z@ % 0=start, 1=0th, 2=normal
+  \def\bbl at process@line#1#2 #3 #4 {%
+    \ifx=#1%
+      \bbl at process@synonym{#2}%
+    \else
+      \bbl at process@language{#1#2}{#3}{#4}%
+    \fi
+    \ignorespaces}
+  \def\bbl at manylang{%
+    \ifnum\bbl at last>\@ne
+      \bbl at info{Non-standard hyphenation setup}%
+    \fi
+    \let\bbl at manylang\relax}
+  \def\bbl at process@language#1#2#3{%
+    \ifcase\count@
+      \@ifundefined{zth@#1}{\count@\tw@}{\count@\@ne}%
+    \or
+      \count@\tw@
+    \fi
+    \ifnum\count@=\tw@
+      \expandafter\addlanguage\csname l@#1\endcsname
+      \language\allocationnumber
+      \chardef\bbl at last\allocationnumber
+      \bbl at manylang
+      \let\bbl at elt\relax
+      \xdef\bbl at languages{%
+        \bbl at languages\bbl at elt{#1}{\the\language}{#2}{#3}}%
+    \fi
+    \the\toks@
+    \toks@{}}
+  \def\bbl at process@synonym at aux#1#2{%
+    \global\expandafter\chardef\csname l@#1\endcsname#2\relax
+    \let\bbl at elt\relax
+    \xdef\bbl at languages{%
+      \bbl at languages\bbl at elt{#1}{#2}{}{}}}%
+  \def\bbl at process@synonym#1{%
+    \ifcase\count@
+      \toks@\expandafter{\the\toks@\relax\bbl at process@synonym{#1}}%
+    \or
+      \@ifundefined{zth@#1}{\bbl at process@synonym at aux{#1}{0}}{}%
+    \else
+      \bbl at process@synonym at aux{#1}{\the\bbl at last}%
+    \fi}
+  \ifx\bbl at languages\@undefined % Just a (sensible?) guess
+    \chardef\l at english\z@
+    \chardef\l at USenglish\z@
+    \chardef\bbl at last\z@
+    \global\@namedef{bbl at hyphendata@0}{{hyphen.tex}{}}
+    \gdef\bbl at languages{%
+      \bbl at elt{english}{0}{hyphen.tex}{}%
+      \bbl at elt{USenglish}{0}{}{}}
+  \else
+    \def\bbl at elt#1#2#3#4{% Remove all except language 0
+      \ifnum#2>\z@\else
+        \noexpand\bbl at elt{#1}{#2}{#3}{#4}%
+      \fi}%
+    \xdef\bbl at languages{\bbl at languages}%
+  \fi
+  \def\bbl at elt#1#2#3#4{\@namedef{zth@#1}{}} % Define flags
+  \bbl at languages
+  \openin1=language.dat
+  \ifeof1
+    \PackageWarning{luahyphenrules}%
+      {I couldn't find language.dat. No additional\MessageBreak
+       patterns loaded. Reported}%
+  \else
+    \loop
+      \endlinechar\m at ne
+      \read1 to \bbl at line
+      \endlinechar`\^^M
+      \if T\ifeof1F\fi T\relax
+        \ifx\bbl at line\@empty\else
+          \edef\bbl at line{\bbl at line\space\space\space}%
+          \expandafter\bbl at process@line\bbl at line\relax
+        \fi
+    \repeat
+  \fi
+\endgroup
+
+\def\bbl at get@enc#1:#2:#3\@@@{\def\bbl at hyph@enc{#2}}
+
+\newcatcodetable\bbl at tempcattbl
+
+\def\bbl at luapatterns#1#2{%
+  \bbl at get@enc#1::\@@@
+  \setbox\z@\hbox\bgroup
+    \begingroup
+      \savecatcodetable\bbl at tempcattbl
+      \catcodetable\catcodetable at latex
+      \input #1\relax
+      \catcodetable\bbl at tempcattbl
+    \endgroup
+    \def\bbl at tempa{#2}%
+    \ifx\bbl at tempa\@empty\else
+      \input #2\relax
+    \fi
+  \egroup}%
+
+\newcommand\HyphenRules[1]{%
+  \language=\expandafter\ifx\csname l@#1:\f at encoding\endcsname\relax
+    \@ifundefined{l@#1}%
+      {\z@
+       \PackageError{luahyphenrules}%
+        {Unknown language `#1'. Either you have\MessageBreak
+         misspelled its name or language.dat doesn't define\MessageBreak
+          it. Words in this language won't be hyphenated.}%
+        {You may proceed, but expect wrong results}}%
+      {\csname l@#1\endcsname 
+       \edef\bbl at tempa{#1}}%
+  \else
+    \csname l@#1:\f at encoding\endcsname
+    \edef\bbl at tempa{#1:\f at encoding}%
+  \fi\relax
+  \@ifundefined{bbl at hyphendata@\the\language}%
+    {\def\bbl at elt##1##2##3##4{% 1:name, 2:num, 3:pat-file, 4:exc-file
+       \ifnum##2=\csname l@\bbl at tempa\endcsname % tempa=spanish,dutch:OT1...
+         \def\bbl at tempb{##3}%
+         \ifx\bbl at tempb\@empty\else % if not a synonymous (if pat-file)
+           \def\bbl at tempc{{##3}{##4}}%
+         \fi
+         \expandafter\xdef\csname bbl at hyphendata@##2\endcsname{\bbl at tempc}%
+       \fi}%
+     \bbl at languages
+     \@ifundefined{bbl at hyphendata@\the\language}%
+       {\PackageInfo{luahyphenrules}%
+          {No hyphenation patterns were set for\MessageBreak
+           language ‘\bbl at tempa’. Reported}}%
+       {\expandafter\expandafter\expandafter\bbl at luapatterns
+          \csname bbl at hyphendata@\the\language\endcsname}}{}}
+
+\endinput
\ No newline at end of file

Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-12-10 22:47:59 UTC (rev 42669)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-12-10 22:48:29 UTC (rev 42670)
@@ -378,7 +378,7 @@
     lshort-vietnamese lstaddons lstbayes lt3graph ltablex ltabptch
     ltxdockit ltxfileinfo ltximg ltxindex ltxkeys ltxmisc ltxnew ltxtools
     lua-alt-getopt lua-check-hyphen lua-visual-debug
-    lua2dox luabibentry luabidi luacode
+    lua2dox luabibentry luabidi luacode luahyphenrules
     luaindex luainputenc luaintro lualatex-doc lualatex-doc-de
     lualatex-math lualibs
     luamplib luaotfload

Modified: trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc	2016-12-10 22:47:59 UTC (rev 42669)
+++ trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc	2016-12-10 22:48:29 UTC (rev 42670)
@@ -18,6 +18,7 @@
 depend luabibentry
 depend luabidi
 depend luacode
+depend luahyphenrules
 depend luaindex
 depend luainputenc
 depend luaintro

Added: trunk/Master/tlpkg/tlpsrc/luahyphenrules.tlpsrc
===================================================================


More information about the tex-live-commits mailing list