From 91ea82ef8644f19a303674611c4ce9bfc47f1274 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Sat, 15 Feb 2014 15:37:14 +0100
Subject: [doc] kill dtx

The file ``luaotfload.dtx`` which made the documentation a huge PITA to
extend, has finally been converted to ordinary Latex format. In the
course of this conversion the style directives have been moved to file
(``luaotfload-latex.tex``) so as to separate them from the content
(``luaotfload-main.tex``).
---
 doc/luaotfload-latex.tex | 132 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)
 create mode 100644 doc/luaotfload-latex.tex

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
new file mode 100644
index 0000000..615ad42
--- /dev/null
+++ b/doc/luaotfload-latex.tex
@@ -0,0 +1,132 @@
+%% Copyright (C) 2009-2014
+%%
+%%      by  Elie Roux      <elie.roux@telecom-bretagne.eu>
+%%      and Khaled Hosny   <khaledhosny@eglug.org>
+%%      and Philipp Gesang <philipp.gesang@alumni.uni-heidelberg.de>
+%%
+%% This file is part of Luaotfload.
+%%
+%%      Home:      https://github.com/lualatex/luaotfload
+%%      Support:   <lualatex-dev@tug.org>.
+%%
+%% Luaotfload is under the GPL v2.0 (exactly) license.
+%%
+%% ----------------------------------------------------------------------------
+%%
+%% Luaotfload is free software; you can redistribute it and/or
+%% modify it under the terms of the GNU General Public License
+%% as published by the Free Software Foundation; version 2
+%% of the License.
+%%
+%% Luaotfload is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%% GNU General Public License for more details.
+%%
+%% You should have received a copy of the GNU General Public License
+%% along with Luaotfload; if not, see <http://www.gnu.org/licenses/>.
+%%
+%% ----------------------------------------------------------------------------
+%%
+
+\documentclass{ltxdoc}
+
+\usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
+\usepackage[x11names]{xcolor}
+
+\def\primarycolor{DodgerBlue4}  %%-> rgb  16  78 139 | #104e8b
+\def\secondarycolor{Goldenrod4} %%-> rgb 139 105 200 | #8b6914
+
+\usepackage[
+    bookmarks=true,
+   colorlinks=true,
+    linkcolor=\primarycolor,
+     urlcolor=\secondarycolor,
+    citecolor=\primarycolor,
+     pdftitle={The luaotfload package},
+   pdfsubject={OpenType layout system for Plain TeX and LaTeX},
+    pdfauthor={Elie Roux & Khaled Hosny & Philipp Gesang},
+  pdfkeywords={luatex, lualatex, unicode, opentype}
+]{hyperref}
+
+\usepackage{fontspec}
+\usepackage{unicode-math}
+
+\setmainfont[
+% Numbers     = OldStyle, %% buggy with font cache
+  Ligatures   = TeX,
+  BoldFont    = {Linux Libertine O Bold},
+  ItalicFont  = {Linux Libertine O Italic},
+  SlantedFont = {Linux Libertine O Italic},
+]{Linux Libertine O}
+\setmonofont[Ligatures=TeX,Scale=MatchLowercase]{Liberation Mono}
+%setsansfont[Ligatures=TeX]{Linux Biolinum O}
+\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{Iwona Medium}
+%setmathfont{XITS Math}
+
+\usepackage{hologo}
+
+\newcommand\TEX      {\TeX\xspace}
+\newcommand\LUA      {Lua\xspace}
+\newcommand\PDFTEX   {pdf\TeX\xspace}
+\newcommand\LUATEX   {Lua\TeX\xspace}
+\newcommand\XETEX    {\XeTeX\xspace}
+\newcommand\LATEX    {\LaTeX\xspace}
+\newcommand\LUALATEX {Lua\LaTeX\xspace}
+\newcommand\CONTEXT  {Con\TeX t\xspace}
+\newcommand\OpenType {\identifier{Open\kern-.25ex Type}\xspace}
+
+\def\definehighlight[#1][#2]%
+ {\ifcsname #1\endcsname\else
+    \expandafter\def\csname #1\endcsname%
+      {\bgroup#2\csname #1_indeed\endcsname}
+    \expandafter\def\csname #1_indeed\endcsname##1%
+      {##1\egroup}%
+  \fi}
+
+\def\restoreunderscore{\catcode`\_=12\relax}
+
+\definehighlight    [fileent][\ttfamily\restoreunderscore]         %% files, dirs
+\definehighlight   [texmacro][\sffamily\itshape\textbackslash]     %% cs
+\definehighlight[luafunction][\sffamily\itshape\restoreunderscore] %% lua identifiers
+\definehighlight [identifier][\sffamily]                           %% names
+\definehighlight     [abbrev][\rmfamily\scshape]                   %% acronyms
+\definehighlight   [emphasis][\rmfamily\slshape]                   %% level 1 emph
+
+\newcommand*\email[1]{\href{mailto:#1}{#1}}
+
+\renewcommand\partname{Part}%% gets rid of the stupid “file” heading
+
+\usepackage{syntax}%% bnf for font request syntax
+
+\usepackage{titlesec}
+
+\def\movecountertomargin#1{\llap{\rmfamily\upshape#1\hskip2em}}
+\def\zeropoint{0pt}
+\titleformat \part
+             {\normalsize\rmfamily\bfseries}
+             {\movecountertomargin\thepart} \zeropoint {}
+\titleformat \section
+             {\normalsize\rmfamily\scshape}
+             {\movecountertomargin\thesection} \zeropoint {}
+\titleformat \subsection
+             {\small\rmfamily\itshape}
+             {\movecountertomargin\thesubsection} \zeropoint {}
+\titleformat \subsubsection
+             {\normalsize\rmfamily\upshape}
+             {\movecountertomargin\thesubsubsection} \zeropoint {}
+
+\usepackage{tocloft}
+\renewcommand \cftpartfont   {\rmfamily\upshape}
+\renewcommand \cftsecfont    {\rmfamily\upshape}
+\renewcommand \cftsubsecfont {\rmfamily\upshape}
+\setlength \cftbeforepartskip {1ex}
+\setlength \cftbeforesecskip  {1ex}
+
+\VerbatimFootnotes
+
+\begin {document}
+	\input {luaotfload-main.tex}
+\end {document}
+
+
-- 
cgit v1.2.3


From 8a24f30e6a055de51461304d40ece070511530bb Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Sun, 16 Feb 2014 13:43:19 +0100
Subject: [doc] use abstract macros

---
 doc/luaotfload-latex.tex | 147 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 146 insertions(+), 1 deletion(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 615ad42..d00a617 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -1,3 +1,4 @@
+\luatexsuppresslongerror1%% sigh ...
 %% Copyright (C) 2009-2014
 %%
 %%      by  Elie Roux      <elie.roux@telecom-bretagne.eu>
@@ -31,6 +32,8 @@
 
 \documentclass{ltxdoc}
 
+\makeatletter
+
 \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
 \usepackage[x11names]{xcolor}
 
@@ -125,8 +128,150 @@
 
 \VerbatimFootnotes
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% structurals
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def \definestructural #1{%
+  \expandafter \let \csname end#1\endcsname \relax
+
+  \expandafter \def \csname begin#1\endcsname {%
+    \@ifnextchar[{\csname begin#1indeed\endcsname}
+                 {\csname begin#1indeed\endcsname[]}%
+  }
+
+  \expandafter \def \csname begin#1indeed\endcsname [##1]##2{%
+    \edef \first {##1}%
+    \ifx \first \empty
+      \csname #1\endcsname [##2]{##2}%
+    \else
+      \csname #1\endcsname [\first]{##2}%
+    \fi
+  }
+}
+
+\definestructural {section}
+\definestructural {subsection}
+\definestructural {subsubsection}
+
+\def \fakesection #1{\section*{#1}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% codelistings; this sucks hard since we lack access to buffers
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcount \othercatcode  \othercatcode 12
+\newcount \activecatcode \othercatcode 13
+
+\newluatexcatcodetable \vrbcatcodes
+\setluatexcatcodetable \vrbcatcodes {%
+  \luatexcatcodetable \CatcodeTableIniTeX
+  \catcode  9 \othercatcode %% \tabasciicode
+  \catcode 13 \othercatcode %% \endoflineasciicode
+  \catcode 12 \othercatcode %% \formfeedasciicode
+  \catcode 26 \othercatcode %% \endoffileasciicode
+  \catcode 32 \othercatcode %% \spaceasciicode
+}
+
+\newluatexcatcodetable \literalcatcodes
+\setluatexcatcodetable \literalcatcodes {%
+  \luatexcatcodetable \CatcodeTableString
+  \catcode 32 \activecatcode %% \spaceasciicode
+}
+
+\def \beginlisting {%
+  \begingroup
+    \luatexcatcodetable \vrbcatcodes
+    \beginlistingindeed%
+}
+
+\directlua {
+  local texprint   = tex.print
+  document         = document or { }
+  document.printlines = function (buffer)
+    for _, line in next, string.explode (buffer, "\noexpand\n") do
+      texprint (-1, line)
+      texprint (-1, "")
+    end
+  end
+}
+
+\def \beginlistingindeed#1\endlisting{%
+  \endgroup
+  \begingroup
+    \ttfamily
+    \small
+    \begin {quote}
+      \bgroup
+        \luatexcatcodetable \literalcatcodes
+        \obeyspaces
+        \obeylines
+        \directlua{document.printlines ([==[\detokenize {#1}]==])}
+      \egroup
+    \end {quote}
+  \endgroup
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% enumerations and lists
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def \definelist [#1]#2{% name, itemcode
+  \expandafter \def \csname begin#1\endcsname {%
+    \begin {itemize}
+      \let \normalitem = \item
+      \def \altitem ####1{%
+        \def \first {####1}%
+        #2
+      }
+  }
+
+  \expandafter \def \csname end#1\endcsname {%
+    \end {itemize}
+  }
+}
+
+\definelist  [definitions]{\normalitem {\fileent {\first}}}
+\definelist     [filelist]{\normalitem {\fileent {\first}}\space--\hskip 1em}
+\definelist [functionlist]{\normalitem {\luafunction {\first}}\hfill\break}
+
+\def \beginenumeration {\begin {enumerate}}
+\def \endenumeration   {\end {enumerate}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% columns
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def \begindoublecolumns {\begin {multicols} {2}}
+\def \enddoublecolumns   {\end {multicols}}
+
+\def \begintriplecolumns {\begin {multicols} {3}}
+\def \endtriplecolumns   {\end {multicols}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% alignment
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def \begincentered {\begin {center}}
+\def \endcentered   {\end {center}}
+\makeatother
+
+\def \beginnarrower {\begin {quote}}
+\def \endnarrower   {\end {quote}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% special elements
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def \beginabstractcontent {\begin {abstract}}
+\def \endabstractcontent   {\end {abstract}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% main
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 \begin {document}
-	\input {luaotfload-main.tex}
+  \input {luaotfload-main.tex}
 \end {document}
 
 
-- 
cgit v1.2.3


From 22caa4363c76153ba2ac1ef896ca5d08f5c34236 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Mon, 17 Feb 2014 07:35:44 +0100
Subject: [doc] wrap further code in more abstract macros

---
 doc/luaotfload-latex.tex | 64 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index d00a617..dcdcab2 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -156,6 +156,18 @@
 
 \def \fakesection #1{\section*{#1}}
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% inline verbatim
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% Context offers both \type{…} and \type<<…>>, but not an unbalanced
+%% one that we could map directly onto Latex’s \verb|…|.
+
+%% TODO
+%\def \inlinecode·#1·{%
+  %\verb·#1·%
+%}
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% codelistings; this sucks hard since we lack access to buffers
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -203,6 +215,7 @@
     \small
     \begin {quote}
       \bgroup
+        \addfontfeature {RawFeature=-tlig;-liga}%% So one can’t just turn them all off at once using the ``Ligatures`` key?
         \luatexcatcodetable \literalcatcodes
         \obeyspaces
         \obeylines
@@ -254,7 +267,6 @@
 
 \def \begincentered {\begin {center}}
 \def \endcentered   {\end {center}}
-\makeatother
 
 \def \beginnarrower {\begin {quote}}
 \def \endnarrower   {\end {quote}}
@@ -266,10 +278,60 @@
 \def \beginabstractcontent {\begin {abstract}}
 \def \endabstractcontent   {\end {abstract}}
 
+\let \setdocumenttitle      \title
+\let \setdocumentdate       \date
+\let \setdocumentauthor     \author
+\let \typesetdocumenttitle  \maketitle
+
+\let \typesetcontent        \tableofcontent
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% figure floats
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def \beginsyntaxfloat #1{%% the request syntax diagram
+  \begin {figure} [b]
+    \def \syntaxcaption {#1}%
+    \setlength\grammarparsep{12pt plus 2pt minus 2pt}%
+    \setlength\grammarindent{5cm}%
+    \begingroup
+      \small
+      \begin {grammar}
+}
+
+\def \endsyntaxfloat {%
+      \end {grammar}
+    \endgroup
+    \caption \syntaxcaption
+    \label{font-syntax}
+  \end {figure}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% hyperlinks
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\protected \def \hyperlink{%
+  \@ifnextchar[{\hyperlinkindeed}%
+               {\hyperlinkindeed[]}%
+}
+
+\def \hyperlinkindeed [#1]#2{%
+  \def \first {#1}%
+  \ifx \first \empty
+    \url {#2}%
+  \else
+    \href {#2}{#1}%
+  \fi%
+}
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% main
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+\makeatother
+
 \begin {document}
   \input {luaotfload-main.tex}
 \end {document}
-- 
cgit v1.2.3


From a7d9c930f9f0c688a2530bd23e59f0cd830fc9d6 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Tue, 25 Feb 2014 07:02:39 +0100
Subject: [doc] move Latex inline verbatim commands to listings

---
 doc/luaotfload-latex.tex | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index dcdcab2..58c8793 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -34,11 +34,11 @@
 
 \makeatletter
 
-\usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
-\usepackage[x11names]{xcolor}
+\usepackage {metalogo,multicol,mdwlist,fancyvrb,xspace}
+\usepackage [x11names] {xcolor}
 
-\def\primarycolor{DodgerBlue4}  %%-> rgb  16  78 139 | #104e8b
-\def\secondarycolor{Goldenrod4} %%-> rgb 139 105 200 | #8b6914
+\def \primarycolor   {DodgerBlue4} %%-> rgb  16  78 139 | #104e8b
+\def \secondarycolor {Goldenrod4}  %%-> rgb 139 105 200 | #8b6914
 
 \usepackage[
     bookmarks=true,
@@ -46,14 +46,14 @@
     linkcolor=\primarycolor,
      urlcolor=\secondarycolor,
     citecolor=\primarycolor,
-     pdftitle={The luaotfload package},
+     pdftitle={The Luaotfload package},
    pdfsubject={OpenType layout system for Plain TeX and LaTeX},
     pdfauthor={Elie Roux & Khaled Hosny & Philipp Gesang},
   pdfkeywords={luatex, lualatex, unicode, opentype}
 ]{hyperref}
 
-\usepackage{fontspec}
-\usepackage{unicode-math}
+\usepackage {fontspec}
+\usepackage {unicode-math}
 
 \setmainfont[
 % Numbers     = OldStyle, %% buggy with font cache
@@ -163,10 +163,14 @@
 %% Context offers both \type{…} and \type<<…>>, but not an unbalanced
 %% one that we could map directly onto Latex’s \verb|…|.
 
-%% TODO
-%\def \inlinecode·#1·{%
-  %\verb·#1·%
-%}
+\usepackage {listings}
+\lstset {
+  basicstyle=\ttfamily,
+}
+
+\def \inlinecode #1{%
+  \lstinline {#1}%
+}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% codelistings; this sucks hard since we lack access to buffers
-- 
cgit v1.2.3


From 07d7f65c89e51d356145560dc6acfaded011398e Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Wed, 26 Feb 2014 07:08:04 +0100
Subject: [doc] move description and figure environment to more abstract macros

---
 doc/luaotfload-latex.tex | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 58c8793..0e86b83 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -248,9 +248,10 @@
   }
 }
 
-\definelist  [definitions]{\normalitem {\fileent {\first}}}
-\definelist     [filelist]{\normalitem {\fileent {\first}}\space--\hskip 1em}
-\definelist [functionlist]{\normalitem {\luafunction {\first}}\hfill\break}
+\definelist  [descriptions]{\normalitem {\textbf \first}\hfill\break}
+\definelist   [definitions]{\normalitem {\fileent {\first}}}
+\definelist      [filelist]{\normalitem {\fileent {\first}}\space--\hskip 1em}
+\definelist  [functionlist]{\normalitem {\luafunction {\first}}\hfill\break}
 
 \def \beginenumeration {\begin {enumerate}}
 \def \endenumeration   {\end {enumerate}}
@@ -293,9 +294,11 @@
 %% figure floats
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-\def \beginsyntaxfloat #1{%% the request syntax diagram
+%% syntax definition
+\def \beginsyntaxfloat #1#2{%% #1:label #2:caption
   \begin {figure} [b]
-    \def \syntaxcaption {#1}%
+    \edef \syntaxlabel  {#1}%
+    \def \syntaxcaption {#2}%
     \setlength\grammarparsep{12pt plus 2pt minus 2pt}%
     \setlength\grammarindent{5cm}%
     \begingroup
@@ -307,10 +310,24 @@
       \end {grammar}
     \endgroup
     \caption \syntaxcaption
-    \label{font-syntax}
+    \label   \syntaxlabel
   \end {figure}
 }
 
+%% figures, e.g. the file graph
+\def \beginfigurefloat #1#2{%% #1:label #2:caption
+  \begingroup
+    \begin {figure} [b]
+      \edef \figurelabel {#1}%
+      \caption {#2}%
+}
+
+\def \endfigurefloat {%
+      \label \figurelabel
+    \end {figure}
+  \endgroup
+}
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% hyperlinks
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-- 
cgit v1.2.3


From 959794804e53aaea76298cba35ccb6c3f347fb1c Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Tue, 4 Mar 2014 06:45:57 +0100
Subject: [doc] move table floats and inline code snippets to new macros

---
 doc/luaotfload-latex.tex | 43 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 0e86b83..e0afe45 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -89,12 +89,16 @@
 
 \def\restoreunderscore{\catcode`\_=12\relax}
 
-\definehighlight    [fileent][\ttfamily\restoreunderscore]         %% files, dirs
-\definehighlight   [texmacro][\sffamily\itshape\textbackslash]     %% cs
-\definehighlight[luafunction][\sffamily\itshape\restoreunderscore] %% lua identifiers
-\definehighlight [identifier][\sffamily]                           %% names
-\definehighlight     [abbrev][\rmfamily\scshape]                   %% acronyms
-\definehighlight   [emphasis][\rmfamily\slshape]                   %% level 1 emph
+\definehighlight      [fileent][\ttfamily\restoreunderscore]         %% files, dirs
+\definehighlight     [texmacro][\sffamily\itshape\textbackslash]     %% cs
+\definehighlight  [luafunction][\sffamily\itshape\restoreunderscore] %% lua identifiers
+\definehighlight   [identifier][\sffamily]                           %% names
+\definehighlight       [abbrev][\rmfamily\scshape]                   %% acronyms
+\definehighlight     [emphasis][\rmfamily\slshape]                   %% level 1 emph
+
+\definehighlight    [Largefont][\Large]                              %% font size
+\definehighlight    [smallcaps][\sc]                                 %% font feature
+\definehighlight [proportional][\tt]                                 %% font switch
 
 \newcommand*\email[1]{\href{mailto:#1}{#1}}
 
@@ -291,7 +295,7 @@
 \let \typesetcontent        \tableofcontent
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% figure floats
+%% floats
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %% syntax definition
@@ -328,6 +332,24 @@
   \endgroup
 }
 
+%% tables
+
+\def \begintablefloat #1#2{%% #1:label #2:caption
+  \begingroup
+    \begin {table} [t]
+      \hrule
+      \edef \floatlabel {#1}%
+      \caption {#2}%
+}
+
+\def \endtablefloat {%
+      \label \floatlabel
+      \hrule
+    \end {table}
+  \endgroup
+}
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% hyperlinks
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -347,6 +369,13 @@
 }
 
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% escaped characters
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\let \charpercent   \textpercent
+\let \charbackslash \textbackslash
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% main
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-- 
cgit v1.2.3


From fba29372991e64a7ee36366988d2da59be03f728 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Wed, 5 Mar 2014 22:42:53 +0100
Subject: [doc] move tables to more abstract syntax

---
 doc/luaotfload-latex.tex | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index e0afe45..80e741c 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -369,12 +369,36 @@
 }
 
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% tables
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Our tables aren’t anything special so we stick with “tabular” on the
+%% Latex end.
+%%
+%% This is going to be largely incompatible with Context since format
+%% specifications work quite differently (even between different
+%% Context table variants).
+
+\def \begintabulate [#1]#2\endtabulate{%
+  \begingroup
+    \let \beginrow  = \relax %% -> \NC in Context
+    \let \newcell   = &      %% -> \NC
+    \let \endrow    = \cr    %% -> \NC \NR
+    \begin {tabular}{#1}%
+      #2
+    \end {tabular}
+  \endgroup
+}
+
+\let \endtabulate \relax
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% escaped characters
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \let \charpercent   \textpercent
 \let \charbackslash \textbackslash
+\let \chartilde     \textasciitilde
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% main
-- 
cgit v1.2.3


From 7ccc3a604d4856e00c2274512bbca85d015ace2f Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Fri, 7 Mar 2014 06:54:25 +0100
Subject: [doc] erase gpl from pdf

---
 doc/luaotfload-latex.tex | 6 ------
 1 file changed, 6 deletions(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 80e741c..42799bf 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -257,9 +257,6 @@
 \definelist      [filelist]{\normalitem {\fileent {\first}}\space--\hskip 1em}
 \definelist  [functionlist]{\normalitem {\luafunction {\first}}\hfill\break}
 
-\def \beginenumeration {\begin {enumerate}}
-\def \endenumeration   {\end {enumerate}}
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% columns
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -267,9 +264,6 @@
 \def \begindoublecolumns {\begin {multicols} {2}}
 \def \enddoublecolumns   {\end {multicols}}
 
-\def \begintriplecolumns {\begin {multicols} {3}}
-\def \endtriplecolumns   {\end {multicols}}
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% alignment
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-- 
cgit v1.2.3


From b220b4598c6c09e3148fa42b987f9615b1e8f135 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Sun, 9 Mar 2014 14:17:30 +0100
Subject: [doc] introduce fake environment for items

---
 doc/luaotfload-latex.tex | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 42799bf..3045c26 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -245,6 +245,8 @@
         \def \first {####1}%
         #2
       }
+      \let \beginaltitem \altitem
+      \let \endaltitem   \relax
   }
 
   \expandafter \def \csname end#1\endcsname {%
-- 
cgit v1.2.3


From 4e1f4ca586bd51ccf70343411162103dfc96e1e0 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Thu, 20 Mar 2014 07:17:33 +0100
Subject: [doc] make inline code work consistently with both formats

---
 doc/luaotfload-latex.tex | 124 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 80 insertions(+), 44 deletions(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 3045c26..409adcf 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -79,26 +79,64 @@
 \newcommand\CONTEXT  {Con\TeX t\xspace}
 \newcommand\OpenType {\identifier{Open\kern-.25ex Type}\xspace}
 
-\def\definehighlight[#1][#2]%
- {\ifcsname #1\endcsname\else
-    \expandafter\def\csname #1\endcsname%
-      {\bgroup#2\csname #1_indeed\endcsname}
-    \expandafter\def\csname #1_indeed\endcsname##1%
-      {##1\egroup}%
-  \fi}
+%% \groupedcommand, with some omissions taken from syst-aux.mkiv
+\let \handlegroupnormalbefore \relax
+\let \handlegroupnormalafter  \relax
+
+\protected \def \handlegroupnormal #1#2{%
+  \bgroup % 1
+  \def \handlegroupbefore {#1}%
+  \def \handlegroupafter  {#2}%
+  \afterassignment \handlegroupnormalbefore
+  \let \next =
+}
+
+\def \handlegroupnormalbefore {%
+  \bgroup % 2
+  \handlegroupbefore
+  \bgroup % 3
+  \aftergroup \handlegroupnormalafter%
+}
+
+\def \handlegroupnormalafter {%
+  \handlegroupafter
+  \egroup % 3
+  \egroup % 2
+}
+
+\let \groupedcommand \handlegroupnormal %% only the two arg version
+
+\def \definehighlight [#1][#2]{%
+  \ifcsname #1\endcsname\else
+    \expandafter\def\csname #1\endcsname{%
+      \leavevmode
+      \groupedcommand {#2}\empty%
+    }
+  \fi%
+}
+
+%% old, simplistic definition: obsolete now that we have
+%% \groupedcommand
+%\def\definehighlight[#1][#2]%
+ %{\ifcsname #1\endcsname\else
+    %\expandafter\def\csname #1\endcsname%
+      %{\bgroup#2\csname #1_indeed\endcsname}
+    %\expandafter\def\csname #1_indeed\endcsname##1%
+      %{##1\egroup}%
+  %\fi}
 
 \def\restoreunderscore{\catcode`\_=12\relax}
 
-\definehighlight      [fileent][\ttfamily\restoreunderscore]         %% files, dirs
-\definehighlight     [texmacro][\sffamily\itshape\textbackslash]     %% cs
-\definehighlight  [luafunction][\sffamily\itshape\restoreunderscore] %% lua identifiers
-\definehighlight   [identifier][\sffamily]                           %% names
-\definehighlight       [abbrev][\rmfamily\scshape]                   %% acronyms
-\definehighlight     [emphasis][\rmfamily\slshape]                   %% level 1 emph
+\definehighlight         [fileent][\ttfamily\restoreunderscore]         %% files, dirs
+\definehighlight        [texmacro][\sffamily\itshape\textbackslash]     %% cs
+\definehighlight     [luafunction][\sffamily\itshape\restoreunderscore] %% lua identifiers
+\definehighlight      [identifier][\sffamily]                           %% names
+\definehighlight          [abbrev][\rmfamily\scshape]                   %% acronyms
+\definehighlight        [emphasis][\rmfamily\slshape]                   %% level 1 emph
 
-\definehighlight    [Largefont][\Large]                              %% font size
-\definehighlight    [smallcaps][\sc]                                 %% font feature
-\definehighlight [proportional][\tt]                                 %% font switch
+\definehighlight       [Largefont][\Large]                              %% font size
+\definehighlight       [smallcaps][\sc]                                 %% font feature
+\definehighlight [nonproportional][\tt]                                 %% font switch
 
 \newcommand*\email[1]{\href{mailto:#1}{#1}}
 
@@ -170,6 +208,7 @@
 \usepackage {listings}
 \lstset {
   basicstyle=\ttfamily,
+  escapechar=Ö,
 }
 
 \def \inlinecode #1{%
@@ -245,8 +284,10 @@
         \def \first {####1}%
         #2
       }
-      \let \beginaltitem \altitem
-      \let \endaltitem   \relax
+      \let \beginnormalitem \item
+      \let \endnormalitem   \relax
+      \let \beginaltitem    \altitem
+      \let \endaltitem      \relax
   }
 
   \expandafter \def \csname end#1\endcsname {%
@@ -280,6 +321,9 @@
 %% special elements
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+\let \beginfrontmatter \relax
+\let \endfrontmatter   \relax
+
 \def \beginabstractcontent {\begin {abstract}}
 \def \endabstractcontent   {\end {abstract}}
 
@@ -288,7 +332,9 @@
 \let \setdocumentauthor     \author
 \let \typesetdocumenttitle  \maketitle
 
-\let \typesetcontent        \tableofcontent
+\AtBeginDocument {%% seriously?
+  \let \typesetcontent \tableofcontents%
+}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% floats
@@ -315,34 +361,22 @@
 }
 
 %% figures, e.g. the file graph
-\def \beginfigurefloat #1#2{%% #1:label #2:caption
-  \begingroup
-    \begin {figure} [b]
-      \edef \figurelabel {#1}%
-      \caption {#2}%
-}
-
-\def \endfigurefloat {%
-      \label \figurelabel
-    \end {figure}
-  \endgroup
+\def \figurefloat #1#2#3{%% #1:label #2:caption #3:file
+  \begin {figure} [b]
+    \caption {#2}%
+    \includegraphics[width=\textwidth]{#3}%
+    \label {#1}
+  \end {figure}
 }
 
 %% tables
-
-\def \begintablefloat #1#2{%% #1:label #2:caption
-  \begingroup
-    \begin {table} [t]
-      \hrule
-      \edef \floatlabel {#1}%
-      \caption {#2}%
-}
-
-\def \endtablefloat {%
-      \label \floatlabel
-      \hrule
-    \end {table}
-  \endgroup
+\def \tablefloat #1#2{%% #1:label #2:caption
+  \begin {table} [t]
+    \hrule
+    \caption {#2}%
+    \label {#1}
+    \hrule
+  \end {table}
 }
 
 
@@ -402,6 +436,8 @@
 
 \makeatother
 
+\newif \ifcontextmkiv \contextmkivfalse
+
 \begin {document}
   \input {luaotfload-main.tex}
 \end {document}
-- 
cgit v1.2.3


From d0d63530acf762f080e8c6255949398a918bf0bc Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Sun, 30 Mar 2014 11:54:45 +0200
Subject: [doc] workaround for inline code in tables

---
 doc/luaotfload-latex.tex | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 409adcf..c886462 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -208,12 +208,10 @@
 \usepackage {listings}
 \lstset {
   basicstyle=\ttfamily,
-  escapechar=Ö,
 }
 
-\def \inlinecode #1{%
-  \lstinline {#1}%
-}
+%\let \inlinecode \lstinline
+\protected \def \inlinecode {\lstinline}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% codelistings; this sucks hard since we lack access to buffers
-- 
cgit v1.2.3


From d36629e9b1e2bd0f4b0740d3d797534a04edd729 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Thu, 15 May 2014 22:32:38 +0200
Subject: [doc] remove dependency on mdwlist.sty

---
 doc/luaotfload-latex.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index c886462..3aab22b 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -34,7 +34,7 @@
 
 \makeatletter
 
-\usepackage {metalogo,multicol,mdwlist,fancyvrb,xspace}
+\usepackage {metalogo,multicol,fancyvrb,xspace}
 \usepackage [x11names] {xcolor}
 
 \def \primarycolor   {DodgerBlue4} %%-> rgb  16  78 139 | #104e8b
-- 
cgit v1.2.3


From 458e2556a1ea7426735486be11523cba8dff177d Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Wed, 4 Jun 2014 23:16:49 +0200
Subject: doc: fix indentation in listings

---
 doc/luaotfload-latex.tex | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'doc/luaotfload-latex.tex')

diff --git a/doc/luaotfload-latex.tex b/doc/luaotfload-latex.tex
index 3aab22b..34c494d 100644
--- a/doc/luaotfload-latex.tex
+++ b/doc/luaotfload-latex.tex
@@ -244,9 +244,14 @@
 
 \directlua {
   local texprint   = tex.print
+  local stringsub  = string.sub
+  local backslash  = string.byte (0x5c)
   document         = document or { }
   document.printlines = function (buffer)
     for _, line in next, string.explode (buffer, "\noexpand\n") do
+      if stringsub (line, 1, 1) == " " then
+        line = backslash .. line
+      end
       texprint (-1, line)
       texprint (-1, "")
     end
-- 
cgit v1.2.3

