summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <gesang@stud.uni-heidelberg.de>2012-06-15 13:10:36 +0200
committerPhilipp Gesang <gesang@stud.uni-heidelberg.de>2012-06-15 13:10:36 +0200
commitc48242fd919c898a02597a2dc4f6ffaf6e7a319b (patch)
tree226f73a9f0729d00739910dc77d137b113e423e2
parent27eafeb42b202de70ab3ea7af9ef45da210e9cf8 (diff)
downloadenigma-c48242fd919c898a02597a2dc4f6ffaf6e7a319b.tar.gz
[doc] documented the encoding handler
-rw-r--r--tex/context/third/enigma/enigma.lua17
1 files changed, 16 insertions, 1 deletions
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