diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-02-16 10:59:14 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-02-16 10:59:14 +0100 |
commit | 8e11d447440b44990432ac838953a8cde4ef914f (patch) | |
tree | f30b2ff2d8a10f1aff50e1522d968618a97f067c /tex/context/modules | |
parent | 43fc66771a0c9d27cc0b7fe7a69392ea313bd0ca (diff) | |
download | context-8e11d447440b44990432ac838953a8cde4ef914f.tar.gz |
2020-02-11 16:39:00
Diffstat (limited to 'tex/context/modules')
-rw-r--r-- | tex/context/modules/common/s-abbreviations-logos.tex | 1 | ||||
-rw-r--r-- | tex/context/modules/mkiv/m-zint.mkiv | 112 |
2 files changed, 1 insertions, 112 deletions
diff --git a/tex/context/modules/common/s-abbreviations-logos.tex b/tex/context/modules/common/s-abbreviations-logos.tex index 9f1d5599e..11c5b9725 100644 --- a/tex/context/modules/common/s-abbreviations-logos.tex +++ b/tex/context/modules/common/s-abbreviations-logos.tex @@ -97,6 +97,7 @@ \logo [DVIWINDO] {dviwindo} \logo [EBCDIC] {ebcdic} \logo [EC] {ec} +\logo [ECMASCRIPT] {ecmascript} \logo [EIFFEL] {Eiffel} \logo [EMACS] {emacs} \logo [EMTEX] {em\TeXsuffix} diff --git a/tex/context/modules/mkiv/m-zint.mkiv b/tex/context/modules/mkiv/m-zint.mkiv deleted file mode 100644 index 4957c8461..000000000 --- a/tex/context/modules/mkiv/m-zint.mkiv +++ /dev/null @@ -1,112 +0,0 @@ -%D \module -%D [ file=m-zint, -%D version=2010.12.07, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=Zint Barcode Generator, -%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 Using \type {zint} seems to be the easiest way to generate -%D (PDF417) barcodes so therefore we now have this module. There -%D are proper (also windows) binaries at: -%D -%D \starttyping -%D http://www.zint.org.uk -%D \stoptyping -%D -%D There is a bit more code than needed as we want to be able to -%D feed names. - -\startluacode - -moduledata.zint = { } - -local format, lower, gsub = string.format, string.lower, string.gsub -local patterns = lpeg.patterns - -local zint = "zint" -- '"c:/program files/zint/zint.exe"' -local defaultcode = "PDF417" - -local whitespace = patterns.whitespace -local spaces = whitespace^0 -local key = (spaces / "") * patterns.digit^0 * (patterns.colon * spaces / "") -local value = (whitespace / "" + (1 - key))^1 -local pattern = lpeg.Cf(lpeg.Ct("") * (lpeg.Cg((lpeg.Cs(key) / tonumber) * (lpeg.Cs(value) / lower)) + patterns.anything)^0,rawset) - -local reverse - -local function cleancode(code) - if not code or code == "" then - code = defaultcode - end - return lower(gsub(code," ","")) -end - -local function numberofcode(code) - if not reverse then - local types = os.resultof(format("%s --types",zint)) or "" - local formats = lpeg.match(pattern,types) - if not formats or not next(formats) then - return code - end - reverse = table.swapped(formats) or { } - end - code = cleancode(code) - return reverse[code] or code -end - -function moduledata.zint.generate(code,data,suffix,options) - if not data or data == "" then - data = "unset" - end - local code = cleancode(code) - local base = format("zint-%s-%s",code,md5.hex(data)) - local name = file.addsuffix(base,suffix or "eps") - if not lfs.isfile(name) then - local temp = file.addsuffix(base,"tmp") - local code = numberofcode(code) - logs.simple("using 'zint' to generate '%s'",base) - io.savedata(temp,data) - os.execute(format('%s --barcode=%s --output="%s" --input="%s" %s',zint,code,name,temp,options or "")) - os.remove(temp) - end - return name -end - -\stopluacode - -\unprotect - -\unexpanded\def\barcode[#1]% [alternative=,text=] - {\bgroup - \getdummyparameters - [\c!alternative=,\c!text=,#1]% - \externalfigure - [\cldcontext{moduledata.zint.generate("\dummyparameter\c!alternative",\!!bs\dummyparameter\c!text\!!es)}]% - [#1,\c!alternative=,\c!text=]% - \egroup} - -\protect - -\continueifinputfile{m-zint.mkiv} - -\starttext - - \externalfigure[\cldcontext{moduledata.zint.generate("PDF417",[[Hans Hagen]])}] - \blank - \externalfigure[\cldcontext{moduledata.zint.generate("PDF417","Ton Otten")}] - \blank - \externalfigure[\cldcontext{moduledata.zint.generate("ISBN","9789490688011")}] - \blank - \barcode[text=Does It Work?,width=\textwidth] - \blank - \barcode[alternative=isbn,text=9789490688011,width=3cm] - -\stoptext - - |