From 1c70e70ac8c9e1d08dcf78819f3af3c48c2ed323 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 29 Mar 2013 18:22:50 +0100 Subject: version bump; minor fixes --- COPYING | 2 +- doc/context/third/enigma/enigma_manual.tex | 2 +- .../enigma/examples/enigma-example-context.tex | 8 +++-- scripts/context/lua/third/enigma/mtx-t-enigma.lua | 12 ++++---- tex/context/third/enigma/enigma.lua | 34 +++++++++++++++------- tex/context/third/enigma/t-enigma.mkvi | 6 ++-- tex/latex/enigma/enigma.sty | 2 +- 7 files changed, 42 insertions(+), 24 deletions(-) diff --git a/COPYING b/COPYING index 3e802a1..dad85d0 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright 2011 Philipp Gesang. All rights reserved. +Copyright 2011-2013 Philipp Gesang. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/doc/context/third/enigma/enigma_manual.tex b/doc/context/third/enigma/enigma_manual.tex index 49dac4b..b511b94 100644 --- a/doc/context/third/enigma/enigma_manual.tex +++ b/doc/context/third/enigma/enigma_manual.tex @@ -425,7 +425,7 @@ Encryption equals decryption. \startdocchapter[title=Metadata] \startdocsection[title=License,reference=license] -© 2012 \emph{Philipp Gesang}. All rights reserved. +© 2012--2013 \emph{Philipp Gesang}. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following diff --git a/doc/context/third/enigma/examples/enigma-example-context.tex b/doc/context/third/enigma/examples/enigma-example-context.tex index 11e1386..051e719 100644 --- a/doc/context/third/enigma/examples/enigma-example-context.tex +++ b/doc/context/third/enigma/examples/enigma-example-context.tex @@ -1,6 +1,10 @@ \usemodule [enigma] -\usetypescript [iwona] -\setupbodyfont [iwona,20pt] +%\usetypescript [computer-modern-unicode] +%\setupbodyfont [computer-modern-unicode,20pt] +%\usetypescript [iwona] +%\setupbodyfont [iwona,20pt] +\usetypescript [modern] +\setupbodyfont [modern,20pt] \defineenigma [nilsettings] \setupenigma [nilsettings] [ %% a machine with vanilla settings diff --git a/scripts/context/lua/third/enigma/mtx-t-enigma.lua b/scripts/context/lua/third/enigma/mtx-t-enigma.lua index 818138e..1b093af 100644 --- a/scripts/context/lua/third/enigma/mtx-t-enigma.lua +++ b/scripts/context/lua/third/enigma/mtx-t-enigma.lua @@ -5,16 +5,18 @@ -- DESCRIPTION: context script interface for the Enigma module -- REQUIREMENTS: latest ConTeXt MkIV -- AUTHOR: Philipp Gesang (Phg), --- CREATED: 2012-02-25 10:45:39+0100 +-- CREATED: 2013-03-28 02:14:05+0100 -------------------------------------------------------------------------------- -- environment.loadluafile("enigma") +local iowrite = io.write + local helpinfo = [[ =============================================================== The Enigma module, command line interface. - © 2012 Philipp Gesang. License: 2-clause BSD. + © 2012--2013 Philipp Gesang. License: 2-clause BSD. Home: =============================================================== @@ -34,7 +36,7 @@ USAGE: local application = logs.application { name = "mtx-t-enigma", - banner = "The Enigma for ConTeXt, hg-rev 9+", + banner = "The Enigma for ConTeXt, hg-rev 37+", helpinfo = helpinfo, } @@ -44,7 +46,7 @@ local setup, text = ea"setup" or ea"s", ea"text" or ea"t" local verbose = ea"verbose" or ea"v" local out = function (str) - io.write(str) + iowrite(str) end local machine_id = "external" @@ -52,7 +54,7 @@ if setup and text then local args = enigma.parse_args(setup) if not args then application.help() - io.write"\n\n[Error] Could not process enigma setup!\n\n" + iowrite"\n\n[Error] Could not process enigma setup!\n\n" end enigma.save_raw_args(args, machine_id) --local machine = enigma.new_machine(enigma.parse_args(setup)) diff --git a/tex/context/third/enigma/enigma.lua b/tex/context/third/enigma/enigma.lua index 942e9b6..7ae66f1 100644 --- a/tex/context/third/enigma/enigma.lua +++ b/tex/context/third/enigma/enigma.lua @@ -4,9 +4,9 @@ -- USAGE: Call via interface from within a TeX session. -- DESCRIPTION: Enigma logic. -- REQUIREMENTS: LuaTeX capable format (Luaplain, ConTeXt). --- AUTHOR: Philipp Gesang (Phg), --- VERSION: hg tip --- CREATED: 2012-02-19 21:44:22+0100 +-- AUTHOR: Philipp Gesang (Phg), +-- VERSION: release +-- CREATED: 2013-03-28 02:12:03+0100 ----------------------------------------------------------------------- -- @@ -41,9 +41,9 @@ if packagedata then -- latex or plain packagedata.enigma = enigma elseif thirddata then -- context format_is_context = true - thirddata.enigma = enigma + thirddata.enigma = enigma else -- external call, mtx-script or whatever - _G.enigma = enigma + _ENV.enigma = enigma end --[[ichd-- \stopdocsection @@ -97,6 +97,7 @@ local stringsub = string.sub local stringupper = string.upper local tableconcat = table.concat local tonumber = tonumber +local type = type local utf8byte = unicode.utf8.byte local utf8char = unicode.utf8.char local utf8len = unicode.utf8.len @@ -1392,7 +1393,7 @@ callback in order to get an appropriate space glue. \stopparagraph --ichd]]-- -local generate_space = function () +local generate_space = function ( ) local current_fontparms = font.getfont(font.current()).parameters local space_node = nodenew(GLUE_NODE) space_node.spec = nodenew(GLUE_SPEC_NODE) @@ -1416,9 +1417,10 @@ answer to \from[khaled_hosny_texsx]. local new_callback = function (machine, name) enigma.machines [name] = machine - local space_node + local current_space_node local mod_5 = 0 local insert_encoded + --- First we need to choose an insertion method. If autospacing is --- requested, a space will have to be inserted every five --- characters. The rationale behind using differend functions to @@ -1435,7 +1437,7 @@ local new_callback = function (machine, name) mod_5 = mod_5 + 1 if mod_5 > 5 then mod_5 = 1 - nodeinsert_before(head, insertion, nodecopy(space_node)) + nodeinsert_before(head, insertion, nodecopy(current_space_node)) end noderemove(head, n) return insertion -- so we know where to insert @@ -1451,11 +1453,16 @@ local new_callback = function (machine, name) return insertion end end + local format_is_context = format_is_context --- The callback proper starts here. local cbk = function (a, _, c) - space_node = generate_space () - local head = format_is_context and c or a + current_space_node = generate_space () + if format_is_context == true then + head = c + else + head = a + end mod_5 = 0 for n in nodetraverse(head) do local nid = n.id @@ -1511,7 +1518,8 @@ local new_callback = function (machine, name) end nodeslide(head) return head - end + end -- callback + if format_is_context then local cbk_id = "enigma_" .. name enigma.callbacks[name] = nodesinstallattributehandler{ @@ -1522,6 +1530,7 @@ local new_callback = function (machine, name) local cbk_location = "thirddata.enigma.callbacks." .. name nodestasksappendaction("processors", --"characters", + --"finalizers", --- this one is tagged “for users” --- (cf. node-tsk.lua) "before", @@ -1546,6 +1555,7 @@ details on the machine derivation mechanism see \stopparagraph --ichd]]-- local configurations = { } + local save_raw_args = function (conf, name) local current = configurations[name] or { } for k, v in next, conf do @@ -1553,10 +1563,12 @@ local save_raw_args = function (conf, name) end configurations[name] = current end + local retrieve_raw_args = function (name) local cn = configurations[name] return cn and tablecopy(cn) or { } end + enigma.save_raw_args = save_raw_args enigma.retrieve_raw_args = retrieve_raw_args diff --git a/tex/context/third/enigma/t-enigma.mkvi b/tex/context/third/enigma/t-enigma.mkvi index ffade50..b5fea29 100644 --- a/tex/context/third/enigma/t-enigma.mkvi +++ b/tex/context/third/enigma/t-enigma.mkvi @@ -1,13 +1,13 @@ %D \module -%D [ file=t-enigma, -%D version=2012-02-21 10:59:43+0100, +%D [ file=t-enigma.mkvi, +%D version=2013-03-28 02:15:37+0100, %D title=\CONTEXT\ User Module, %D subtitle=Enigma, %D author=Philipp Gesang, %D date=\currentdate, %D copyright=Philipp Gesang, %D license=2-clause BSD, -%D email={gesang at stud dot uni-heidelberg dot de}] +%D email={phg42 dot 2a at gmail dot com}] %C This module is licensed under the conditions of the BSD license with %C two clauses. There is a copy in a file named "COPYING" in the %C t-enigma source tree. diff --git a/tex/latex/enigma/enigma.sty b/tex/latex/enigma/enigma.sty index 80b8b26..07bb8e7 100644 --- a/tex/latex/enigma/enigma.sty +++ b/tex/latex/enigma/enigma.sty @@ -1,6 +1,6 @@ \ProvidesPackage {enigma} - [2012/06/06 Enigma Document Encryption] + [2013/03/28 Enigma Document Encryption] \RequirePackage{luatexbase} \input{enigma} \endinput -- cgit v1.2.3