platform:reg-dummy N ˆl–Ü4ý(T¾R( JjãBS�ÿ�þcf7ÖnP�Fû„yà?Ë „iÀÿÊa–Ãa¾”J_)â� ÆÛ¸ ©‹FÿÈ?÷ --- The nodetree package. -- -- Nodetree uses [LDoc](https://github.com/stevedonovan/ldoc) for the -- source code documentation. The supported tags are described on in -- the [wiki](https://github.com/stevedonovan/LDoc/wiki). -- -- Nodes in LuaTeX are connected. The nodetree view distinguishs -- between the `list` and `field` connections. -- -- * `list`: Nodes, which are double connected by `next` and -- `previous` fields. -- * `field`: Connections to nodes by other fields than `next` and -- `previous` fields, e. g. `head`, `pre`. -- @module nodetree -- luacheck: globals node tex luatexbase lfs callback os unicode status modules ---@class Node ---@field next Node|nil # the next node in a list, or nil ---@field id number # the node’s type (id) number ---@field subtype number # the node subtype identifier ---@alias ColorName `black` | `red` | `green` | `yellow` | `blue` | `magenta` | `cyan` | `white` ---@alias ColorMode `bright` | `dim` ---@alias ConnectionType `list` | `field` # A literal -- is a string, which can be either `list` or `field`. ---@alias ConnectionState `stop` | `continue` # A literal which can -- be either `continue` or `stop`. if not modules then modules = { } end modules ['nodetree'] = { version = '2.2.1', comment = 'nodetree', author = 'Josef Friedrich', copyright = 'Josef Friedrich', license = 'The LaTeX Project Public License Version 1.3c 2008-05-04' } local direct = node.direct local todirect = direct.todirect local getchar = direct.getchar --- Lua 5.1 does not have the utf8 library (Lua 5.1 is the default -- version in LuajitTeX). LuaJitTeX does include the slnunicode library. local utf8 = utf8 or unicode.utf8 local utfchar = utf8.char local properties = direct.get_properties_table() --- A counter for the compiled TeX examples. Some TeX code snippets -- a written into file, wrapped with some TeX boilerplate code. -- This written files are compiled. local example_counter = 0 --- The default options local default_options = { callback = 'post_linebreak_filter', channel = 'term', color = 'colored', decimalplaces = 2, unit = 'pt', verbosity = 1, } --- The current options -- They are changed very often. local options = {} for key, value in pairs(default_options) do options[key] = value end --- File descriptor local output_file --- The lua table named `tree_state` holds state values of the current -- tree item. -- -- `tree_state`: -- -- * `1` (level): -- * `list`: `continue` -- * `field`: `stop` -- * `2`: -- * `list`: `continue` -- * `field`: `stop` -- @table local tree_state = {} --- Format functions. -- -- Low level template functions. -- -- @section format local format = { ---@param input string --- ---@return string underscore = function(input) if options.channel == 'tex' then local result = input.gsub(input, '_', '\\_') return result else return input end end, ---@param input string --- ---@return string escape = function(input) if options.channel == 'tex' then local result = input.gsub(input, [[\]], [[\string\]]) return result else return input end end, ---@param input number --- ---@return number number = function(input) local mult = 10^(options.decimalplaces or 0) return math.floor(input * mult + 0.5) / mult end, ---@param count? number # how many spaces should be output --- ---@return string whitespace = function(count) local whitespace local output = '' if options.channel == 'tex' then whitespace = '\\hspace{0.5em}' else whitespace = ' ' end if not count then count = 1 end for _ = 1, count do output = output .. whitespace end return output end, ---@param code number --- ---@return string color_code = function(code) return string.char(27) .. '[' .. tostring(code) .. 'm' end,