From c48242fd919c898a02597a2dc4f6ffaf6e7a319b Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 15 Jun 2012 13:10:36 +0200 Subject: [doc] documented the encoding handler --- tex/context/third/enigma/enigma.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tex/context/third/enigma/enigma.lua b/tex/context/third/enigma/enigma.lua index 3a97a24..c5772bd 100644 --- a/tex/context/third/enigma/enigma.lua +++ b/tex/context/third/enigma/enigma.lua @@ -103,7 +103,7 @@ local utfcharacters = string.utfcharacters local tablecopy if format_is_context_p then tablecopy = table.copy -else +else -- could use lualibs instead but not worth the overhead tablecopy = function (t) -- ignores tables as keys local result = { } for k, v in next, t do @@ -1041,6 +1041,21 @@ consists of three elements: local decode_char = encode_char -- hooray for involutory ciphers +--[[ichd-- +\startparagraph +The function \luafunction{encode_general} is an intermediate step for +the actual single-character encoding / decoding routine +\luafunction{enchode_char}. +Its purpose is to ensure encodability of a given character before +passing it along. +Characters are first checked against the replacement table +\identifier{pp_substitutions} (see \at{page}[listing:preproc]). +For single-character replacements the function returns the encoded +character (string). +However, should the replacement turn out to consist of more than one +character, each one will be encoded successively, yielding a list. +\stopparagraph +--ichd]]-- local encode_general = function (machine, chr) local chr = stringlower(chr) local replacement = pp_substitutions[chr] or valid_char_p[chr] and chr -- cgit v1.2.3