summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/luatex/nodetree/nodetree.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/luatex/nodetree/nodetree.dtx')
-rw-r--r--Master/texmf-dist/source/luatex/nodetree/nodetree.dtx83
1 files changed, 38 insertions, 45 deletions
diff --git a/Master/texmf-dist/source/luatex/nodetree/nodetree.dtx b/Master/texmf-dist/source/luatex/nodetree/nodetree.dtx
index 764c9684cf0..0b3668a8cec 100644
--- a/Master/texmf-dist/source/luatex/nodetree/nodetree.dtx
+++ b/Master/texmf-dist/source/luatex/nodetree/nodetree.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2016-2022 by Josef Friedrich <josef@friedrich.rocks>
+% Copyright (C) 2016-2023 by Josef Friedrich <josef@friedrich.rocks>
% ----------------------------------------------------------------------
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 of this license
@@ -28,7 +28,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{nodetree}
%<*package>
- [2022/12/17 v2.2.1 Visualize node lists in a tree view]
+ [2023/09/10 v2.3.0 Visualize node lists in a tree view]
%</package>
% \fi
%
@@ -50,34 +50,6 @@
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-%
-% \changes{v0.1}{2015/06/16}{Converted to DTX file}
-% \changes{v1.0}{2016/07/07}{Inital release}
-% \changes{v1.1}{2016/07/13}{Fix the registration of same callbacks}
-% \changes{v1.2}{2016/07/18}{Fix difference between README.md in the upload and that from nodetree.dtx}
-% \changes{v2.0}{2020/05/29}{
-% * Switch from lowercase macro names to PascalCase names for better readability.
-% * The Lua code is no longer developed inside the DTX file, instead in a separate file named nodetree.lua.
-% * Add a sub package named nodetree-embed.sty for embedding nodetree views into a \LaTeX{} document.
-% * Add support for new node subtype names.
-% * Add support for a new Lua\TeX{} node callback.
-% * Add support for node properties.
-% * Less verbose representation of node attributes.
-% * Minor tree output adjustments.
-% }
-% \changes{v2.1}{2020/10/03}{
-% * Make the package compatible with the Harfbuzz mode of the luaotfload fontloader.
-% * Print node properties of copied nodes.
-% }
-% \changes{v2.2}{2020/10/23}{
-% * Fix unavailable library error (utf8 not in Lua5.1)
-% }
-% \changes{v2.2.1}{2022/12/17}{
-% * Replace non-printable unicode symbols with ???.
-% * Add missing newlines for callbacks with multiple node lists.
-% * Print subtype fields with value 0.
-% * Fix the presentation of the subtype field of a glyph as a bit field.
-% }
% \DoNotIndex{\newcommand,\newenvironment,\def,\directlua}
%
% \StopEventually{}
@@ -90,7 +62,7 @@
% \MacroTopsep = 10pt plus 2pt minus 2pt
% \MacrocodeTopsep = 10pt plus 1.2pt minus 1pt
% \makeatletter
-% \c@CodelineNo 25 \relax
+% \c@CodelineNo 22 \relax
% \makeatother
%
% \subsection{The file \tt{nodetree.tex}}
@@ -198,7 +170,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\DeclareStringOption[1]{verbosity}
+\DeclareStringOption[0]{verbosity}
\define@key{NT}{verbosity}[]{\NodetreeSetOption[verbosity]{#1}}
% \end{macrocode}
%
@@ -237,10 +209,16 @@
%</package>
%<*packageembed>
% \fi
+% \makeatletter
+% \c@CodelineNo 22 \relax
+% \makeatother
+%
+% \subsection{The file \tt{nodetree-embed.sty}}
+%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{nodetree-embed}
- [2022/12/17 v2.2.1 Embed node trees into a LaTeX document]
+ [2023/09/10 v2.3.0 Embed node trees into a LaTeX document]
% \end{macrocode}
%
% \begin{macrocode}
@@ -260,18 +238,11 @@
% \end{macrocode}
%
% \begin{macrocode}
-\directlua{
- nodetree = require('nodetree')
- nodetree.check_shell_escape()
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
\define@key{NTE}{callback}[]{\NodetreeSetOption[callback]{#1}}
% \end{macrocode}
%
% \begin{macrocode}
-\DeclareStringOption[1]{verbosity}
+\DeclareStringOption[0]{verbosity}
\define@key{NTE}{verbosity}[]{\NodetreeSetOption[verbosity]{#1}}
% \end{macrocode}
%
@@ -307,6 +278,16 @@
% \end{macrocode}
%
% \begin{macrocode}
+\DeclareStringOption[1]{firstline}
+\define@key{NTE}{firstline}[]{\NodetreeSetOption[firstline]{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareStringOption[-1]{lastline}
+\define@key{NTE}{lastline}[]{\NodetreeSetOption[lastline]{#1}}
+% \end{macrocode}
+%
+% \begin{macrocode}
\DeclareBoolOption{showmarkup}
% \end{macrocode}
%
@@ -404,7 +385,7 @@
%
% \begin{macro}{\NodetreeSet}
% Same definition as in nodetree.sty. Only implement this command
-% if not already registers.
+% if not already registered.
% \begin{macrocode}
\providecommand{\NodetreeSet}[1]{%
\setkeys{NTE}{#1}%
@@ -414,6 +395,7 @@
%
% \begin{macrocode}
\newenvironment{NodetreeEmbedView}[1][]{
+ \directlua{nodetree.push_options()}
\setkeys{NTE}{#1}
\NTE@colors
\begin{mdframed}[
@@ -424,17 +406,21 @@
\NTE@fonts
}{
\end{mdframed}%
+ \directlua{nodetree.pop_options()}%
}
% \end{macrocode}
%
% \begin{environment}{NodetreeEmbedEnv}
% \begin{macrocode}
\NewDocumentEnvironment { NodetreeEmbedEnv } { O{} +b } {
+ \directlua{
+ nodetree.check_shell_escape('NodetreeEmbedEnv', false)
+ nodetree.push_options()
+ }
\setkeys{NTE}{#1}
\ifNTEK@showmarkup
\noindent
\texttt{\detokenize{#2}}
- \else
\fi
\NTE@colors
\begin{NodetreeEmbedView}
@@ -442,6 +428,7 @@
nodetree.compile_include('\luaescapestring{\unexpanded{#2}}')
}
\end{NodetreeEmbedView}
+ \directlua{nodetree.pop_options()}
}{}
% \end{macrocode}
% \end{environment}
@@ -449,11 +436,14 @@
% \begin{macro}{\NodetreeEmbedCmd}
% \begin{macrocode}
\NewDocumentCommand { \NodetreeEmbedCmd } { O{} +v } {
+ \directlua{
+ nodetree.check_shell_escape('\string\\NodetreeEmbedCmd', true)
+ nodetree.push_options()
+ }
\setkeys{NTE}{#1}
\ifNTEK@showmarkup
\noindent
\texttt{#2}
- \else
\fi
\NTE@colors
\begin{NodetreeEmbedView}
@@ -461,6 +451,7 @@
nodetree.compile_include('\luaescapestring{\unexpanded{#2}}')
}
\end{NodetreeEmbedView}
+ \directlua{nodetree.pop_options()}
}
% \end{macrocode}
% \end{macro}
@@ -468,10 +459,12 @@
% \begin{macro}{\NodetreeEmbedInput}
% \begin{macrocode}
\newcommand{\NodetreeEmbedInput}[2][]{
+ \directlua{nodetree.push_options()}
\setkeys{NTE}{#1}
\begin{NodetreeEmbedView}
- \input{#2.nttex}
+ \directlua{nodetree.input('#2.nttex')}
\end{NodetreeEmbedView}
+ \directlua{nodetree.pop_options()}
}
\let\nodetreeterminalemulator\NodetreeEmbedInput
% \end{macrocode}