summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/context/documents/general/manuals/luametatex.pdfbin1283942 -> 1289756 bytes
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex10
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex97
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex.tex5
4 files changed, 102 insertions, 10 deletions
diff --git a/doc/context/documents/general/manuals/luametatex.pdf b/doc/context/documents/general/manuals/luametatex.pdf
index 6d7e0b892..662012f6b 100644
--- a/doc/context/documents/general/manuals/luametatex.pdf
+++ b/doc/context/documents/general/manuals/luametatex.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex b/doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex
index 4c8a0db78..d8e98efa2 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-callbacks.tex
@@ -251,7 +251,7 @@ into a stack of \prm {hbox}es, after the addition of \prm {parfillskip}.
\startfunctioncall
function(<node> head, <string> groupcode)
- return true | false | <node> newhead
+ return <node> newhead
end
\stopfunctioncall
@@ -353,7 +353,7 @@ stack of \prm {hbox}es.
\startfunctioncall
function(<node> head, <string> groupcode)
- return true | false | <node> newhead
+ return <node> newhead
end
\stopfunctioncall
@@ -369,7 +369,7 @@ material. Math items and line boxes are ignored at the moment.
\startfunctioncall
function(<node> head, <string> groupcode, <number> size,
<string> packtype [, <string> direction] [, <node> attributelist])
- return true | false | <node> newhead
+ return <node> newhead
end
\stopfunctioncall
@@ -397,7 +397,7 @@ that it is called at different moments, there is an extra variable that matches
\startfunctioncall
function(<node> head, <string> groupcode, <number> size, <string> packtype,
<number> maxdepth [, <string> direction] [, <node> attributelist]))
- return true | false | <node> newhead
+ return <node> newhead
end
\stopfunctioncall
@@ -462,7 +462,7 @@ This callback is called when \TEX\ is ready to start boxing the box 255 for \prm
\startfunctioncall
function(<node> head, <string> groupcode, <number> size, <string> packtype,
<number> maxdepth [, <string> direction])
- return true | false | <node> newhead
+ return <node> newhead
end
\stopfunctioncall
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex b/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
index d56d85ceb..3c9041e8d 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
@@ -1383,16 +1383,18 @@ The \type{traverse_char} iterator loops over the \nod {glyph} nodes in a list.
Only nodes with a subtype less than 256 are seen.
\startfunctioncall
-<node> n, font, char = node.traverse_char(<node> n)
+<direct> n, font, char = node.direct.traverse_char(<direct> n)
\stopfunctioncall
The \type{traverse_glyph} iterator loops over a list and returns the list and
filters all glyphs:
\startfunctioncall
-<node> n, font, char = node.traverse_glyph(<node> n)
+<direct> n, font, char = node.traverse_glyph(<direct> n)
\stopfunctioncall
+These functions are only available for direct nodes.
+
\stopsubsubsection
\startsubsubsection[title={\type {traverse_list}}]
@@ -1402,15 +1404,100 @@ filters all glyphs:
This iterator loops over the \nod {hlist} and \nod {vlist} nodes in a list.
\startfunctioncall
-<node> n, id, subtype, list = node.traverse_list(<node> n)
+<direct> n, id, subtype, list = node.traverse_list(<direct> n)
+\stopfunctioncall
+
+The four return values can save some time compared to fetching these fields but
+in practice you seldom need them all. This function is only available for direct
+nodes.
+
+\stopsubsubsection
+
+\startsubsubsection[title={\type {traverse_content}}]
+
+\libindex {traverse_content}
+
+This iterator loops over nodes that have content: \nod {hlist}, \nod {vlist}, \nod {glue}
+with leaders, \nod {glyphs}, \nod {disc} and \nod {rules} nodes.
+
+\startfunctioncall
+<direct> n, id, subtype[, list|leader] = node.traverse_list(<direct> n)
\stopfunctioncall
The four return values can save some time compared to fetching these fields but
-in practice you seldom need them all. So consider it a (side effect of
-experimental) convenience.
+in practice you seldom need them all. This function is only available for direct
+nodes.
\stopsubsubsection
+\startsubsubsection[title={Reverse traversing}]
+
+The traversers also support backward traversal. An optional extra boolean triggers
+this. Yet another optional boolean will automatically start at the end of the
+given list.
+
+\starttyping
+\setbox0\hbox{1 2 3 4 5}
+
+local l = tex.box[0].list
+for n in node.traverse(l) do
+ print("1>",n)
+end
+for n in node.traverse(l,true) do
+ print("2>",n)
+end
+for n in node.traverse(l,true,true) do
+ print("3>",n)
+end
+for n in node.traverse_id(nodes.nodecodes.glyph,l) do
+ print("4>",n)
+end
+for n in node.traverse_id(nodes.nodecodes.glyph,l,true) do
+ print("5>",n)
+end
+for n in node.traverse_id(nodes.nodecodes.glyph,l,true,true) do
+ print("6>",n)
+end
+\stoptyping
+
+This produces something similar to this (the glyph subtype indicates that it has
+been processed by the font handlers):
+
+\starttyping
+1> <node : nil <= 1112 => 590 : glyph 32768>
+1> <node : 1112 <= 590 => 1120 : glue spaceskip>
+1> <node : 590 <= 1120 => 849 : glyph 32768>
+1> <node : 1120 <= 849 => 1128 : glue spaceskip>
+1> <node : 849 <= 1128 => 880 : glyph 32768>
+1> <node : 1128 <= 880 => 1136 : glue spaceskip>
+1> <node : 880 <= 1136 => 1020 : glyph 32768>
+1> <node : 1136 <= 1020 => 1144 : glue spaceskip>
+1> <node : 1020 <= 1144 => nil : glyph 32768>
+2> <node : nil <= 1112 => 590 : glyph 32768>
+3> <node : 1020 <= 1144 => nil : glyph 32768>
+3> <node : 1136 <= 1020 => 1144 : glue spaceskip>
+3> <node : 880 <= 1136 => 1020 : glyph 32768>
+3> <node : 1128 <= 880 => 1136 : glue spaceskip>
+3> <node : 849 <= 1128 => 880 : glyph 32768>
+3> <node : 1120 <= 849 => 1128 : glue spaceskip>
+3> <node : 590 <= 1120 => 849 : glyph 32768>
+3> <node : 1112 <= 590 => 1120 : glue spaceskip>
+3> <node : nil <= 1112 => 590 : glyph 32768>
+4> <node : nil <= 1112 => 590 : glyph 32768>
+4> <node : 590 <= 1120 => 849 : glyph 32768>
+4> <node : 849 <= 1128 => 880 : glyph 32768>
+4> <node : 880 <= 1136 => 1020 : glyph 32768>
+4> <node : 1020 <= 1144 => nil : glyph 32768>
+5> <node : nil <= 1112 => 590 : glyph 32768>
+6> <node : 1020 <= 1144 => nil : glyph 32768>
+6> <node : 880 <= 1136 => 1020 : glyph 32768>
+6> <node : 849 <= 1128 => 880 : glyph 32768>
+6> <node : 590 <= 1120 => 849 : glyph 32768>
+6> <node : nil <= 1112 => 590 : glyph 32768>
+\stoptyping
+
+\stopsubsection
+
\startsubsubsection[title={\type {find_node}}]
\libindex {find_node}
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex.tex b/doc/context/sources/general/manuals/luametatex/luametatex.tex
index 77cf98019..b2de45ae2 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex.tex
@@ -41,6 +41,9 @@
% 20201204 : 260 pages
% mingw all in: 10.0
+% 20201204 : 262 pages
+% mingw all in: 9.9
+
% 20200720 : 258 pages / all in
%
% mingw : 10.6 (sometimes less)
@@ -68,6 +71,8 @@
% Thanks to sebastian.miele@gmail.com for close reading the manual and sending
% fixes.
+% \listcallbackmode0
+
\pushoverloadmode \unprotect
% test code
\protect \popoverloadmode