diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-05-17 19:31:15 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-05-17 19:31:15 +0200 |
commit | 2017d30b4ca772c8eeac4fc0eb9b54e547a9a1d8 (patch) | |
tree | d96df31f305a095c078ea5fb9f639ca34ac36c12 /tex/context/modules/mkiv/x-xfdf.mkiv | |
parent | 53ff76b73cd1f373ecdfb0f7f17df6f352621d6e (diff) | |
download | context-2017d30b4ca772c8eeac4fc0eb9b54e547a9a1d8.tar.gz |
2016-05-17 19:25:00
Diffstat (limited to 'tex/context/modules/mkiv/x-xfdf.mkiv')
-rw-r--r-- | tex/context/modules/mkiv/x-xfdf.mkiv | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tex/context/modules/mkiv/x-xfdf.mkiv b/tex/context/modules/mkiv/x-xfdf.mkiv new file mode 100644 index 000000000..460220ed9 --- /dev/null +++ b/tex/context/modules/mkiv/x-xfdf.mkiv @@ -0,0 +1,72 @@ +%D \module +%D [ file=x-xfdf, +%D version=2011.09.07, +%D title=\CONTEXT\ XML Modules, +%D subtitle=\XFDF, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is a revival of using \XFDF, but now in a more \MKIV-ish way. We +%D supported it long ago already in \MKII\ but never used it at a large +%D scale (not that much user interest anyway). + +\startmodule[xfdf] + +% see xfdf-001.xfdf and xfdf-001.tex + +% %D Possible speedup but hardly worth the trouble. +% +% \startluacode +% +% local hashes = { } table.setmetatableindex(hashes,function(t,k) local v = { } t[k] = v return v end) +% +% function xml.functions.xfdf_collect_values(root) +% local hash = hashes[root] +% for c in xml.collected(root,"/xfdf/fields/field/value") do +% hash[xml.parent(c).at.name] = c +% end +% end +% +% function xml.functions.xfdf_get_values(root,name) +% return hashes[root][name] +% end +% +% function lxml.xfdf_get_values(root,name) +% xml.sprint(hashes[lxml.id(root)][name]) +% end +% +% \stopluacode +% +% \def\xfdfvalue#1#2% +% {\ctxlua{lxml.xfdf_get_values("#1","#2")}} + +\startxmlsetups xfdf:define + \xmlsetsetup{#1}{*}{xfdf:*} + % \xmlfilter {#1}{./function(xfdf_collect_values)} +\stopxmlsetups + +\xmlregisterns{xfdf}{http://ns.adobe.com/xfdf/} + +\xmlregisterdocumentsetup{xfdf}{xfdf:define} + +\startxmlsetups xfdf:value + \xmlflush{#1} +\stopxmlsetups + +\def\xfdfload #1#2{\xmlloadonly{#1}{#2}{xfdf}} +\def\xfdfvalue#1#2{\xmlfirst{#1}{/xfdf/fields/field[@name='#2']/value}} +\def\xfdftext #1#2{\xmlfirst{#1}{/xfdf/fields/field[@name='#2']/value/paragraphs()}} + +% \startxmlsetups xfdf:b +% \bold{\xmlflush{#1}} +% \stopxmlsetups + +% \xfdfload {whatever}{xfdf-001.xfdf} +% \xfdfvalue{whatever}{somefield} + +\stopmodule |