summaryrefslogtreecommitdiff
path: root/tex/context/base/m-zint.mkiv
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-10-20 01:20:14 +0300
committerMarius <mariausol@gmail.com>2013-10-20 01:20:14 +0300
commit965214d981e6129b782c67adcaf3a81aedcb0bac (patch)
tree84f5945aae8efc9b6eb1898b873be5453cafe43d /tex/context/base/m-zint.mkiv
parente7d0d90a434e5452ff9e86c8abab5a4cac35e2f1 (diff)
downloadcontext-965214d981e6129b782c67adcaf3a81aedcb0bac.tar.gz
stable 2013.05.28 00:36
Diffstat (limited to 'tex/context/base/m-zint.mkiv')
-rw-r--r--tex/context/base/m-zint.mkiv33
1 files changed, 6 insertions, 27 deletions
diff --git a/tex/context/base/m-zint.mkiv b/tex/context/base/m-zint.mkiv
index 4957c8461..95b265c57 100644
--- a/tex/context/base/m-zint.mkiv
+++ b/tex/context/base/m-zint.mkiv
@@ -29,21 +29,17 @@ 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 zint = "zint" -- '"c:/program files/zint/zint.exe"'
-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 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
@@ -80,19 +76,6 @@ 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
@@ -102,10 +85,6 @@ end
\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