diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-05-08 18:28:14 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-05-08 18:28:14 +0200 |
commit | e5703477ae326ba910515aeab93000828516954a (patch) | |
tree | 3dcb2ed17154ae4da1418ea250865a9de1cf2eab | |
parent | a224df6e63d610abc259a79507bc9b2af3657bde (diff) | |
download | context-e5703477ae326ba910515aeab93000828516954a.tar.gz |
2016-05-08 17:35:00
19 files changed, 250 insertions, 99 deletions
diff --git a/doc/context/sources/general/manuals/luatex/luatex-lua.tex b/doc/context/sources/general/manuals/luatex/luatex-lua.tex index 8a9c26789..0960f8032 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-lua.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-lua.tex @@ -558,7 +558,7 @@ be done in two ways. When Universal Time is needed, you can pass the flag \type {utc} to the engine. This property also works when the date and time are set by \LUATEX\ itself. It has a -complementary entry \type {use_utf_time} in the \type {texconfig} table. +complementary entry \type {use_utc_time} in the \type {texconfig} table. {\em To some extend a cleaner solution would be to have a flag that disables all variable data in one go (like filenames and so) but we just follow the method diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 26d7e008b..a5f01cebc 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -708,9 +708,10 @@ function scripts.context.run(ctxdata,filename) scripts.context.make(formatname) end -- - local oldhash = multipass_hashfiles(jobname) - local newhash = { } - local maxnofruns = once and 1 or multipass_nofruns + local oldhash = multipass_hashfiles(jobname) + local newhash = { } + local maxnofruns = once and 1 or multipass_nofruns + local fulljobname = validstring(filename) -- local c_flags = { directives = directives, -- gets passed via mtxrun @@ -719,7 +720,7 @@ function scripts.context.run(ctxdata,filename) -- result = validstring(resultname), input = validstring(getargument("input") or filename), -- alternative input - fulljobname = validstring(filename), + fulljobname = fulljobname, files = concat(files,","), ctx = validstring(ctxname), export = a_export and true or nil, @@ -850,9 +851,9 @@ function scripts.context.run(ctxdata,filename) end -- if a_purge then - scripts.context.purge_job(jobname) + scripts.context.purge_job(jobname,false,false,fulljobname) elseif a_purgeall then - scripts.context.purge_job(jobname,true) + scripts.context.purge_job(jobname,true,false,fulljobname) end -- if resultname then @@ -866,11 +867,13 @@ function scripts.context.run(ctxdata,filename) report("result renamed to: %s",newbase) end -- - if purge then - scripts.context.purge_job(resultname) - elseif purgeall then - scripts.context.purge_job(resultname,true) - end + -- -- needs checking + -- + -- if a_purge then + -- scripts.context.purge_job(resultname) + -- elseif a_purgeall then + -- scripts.context.purge_job(resultname,true) + -- end -- local pdfview = getargument("autopdf") if pdfview then @@ -1245,6 +1248,9 @@ local temporary_runfiles = { "aux", "blg", -- bibtex } +local temporary_suffixes = { + "prep", -- context preprocessed +} local synctex_runfiles = { "synctex", "synctex.gz", -- synctex } @@ -1273,7 +1279,7 @@ local function purge_file(dfile,cfile) end end -function scripts.context.purge_job(jobname,all,mkiitoo) +function scripts.context.purge_job(jobname,all,mkiitoo,fulljobname) if jobname and jobname ~= "" then jobname = filebasename(jobname) local filebase = removesuffix(jobname) @@ -1287,6 +1293,11 @@ function scripts.context.purge_job(jobname,all,mkiitoo) for i=1,#temporary_runfiles do deleted[#deleted+1] = purge_file(fileaddsuffix(filebase,temporary_runfiles[i])) end + if fulljobname and fulljobname ~= jobname then + for i=1,#temporary_suffixes do + deleted[#deleted+1] = purge_file(fileaddsuffix(fulljobname,temporary_suffixes[i],true)) + end + end if not environment.argument("synctex") then -- special case: not deleted when --synctex is given, but what if given in preamble for i=1,#synctex_runfiles do diff --git a/scripts/context/lua/mtx-modules.lua b/scripts/context/lua/mtx-modules.lua index f4003c1db..572e6a304 100644 --- a/scripts/context/lua/mtx-modules.lua +++ b/scripts/context/lua/mtx-modules.lua @@ -58,7 +58,7 @@ local report = application.report -- \stoptypen -- -- Macro definitions specific to the documentation are not surrounded by --- start-stop commands. The suffix specificaction can be overruled at runtime, +-- start-stop commands. The suffix specification can be overruled at runtime, -- but defaults to the file extension. This specification can be used for language -- depended verbatim typesetting. -- diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 008962ea3..fbb5c71c9 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index fbd7ca6a1..1b0ec7432 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.05.08 01:35} +\newcontextversion{2016.05.08 17:30} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index ab87e4ef7..c66b2856a 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.05.08 01:35} +\edef\contextversion{2016.05.08 17:30} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/core-con.mkiv b/tex/context/base/mkiv/core-con.mkiv index 1f6dc54d5..8565a3096 100644 --- a/tex/context/base/mkiv/core-con.mkiv +++ b/tex/context/base/mkiv/core-con.mkiv @@ -250,8 +250,8 @@ \newcount\normalweekday - \def\dayoftheweek #1#2#3{\clf_weekdayname\numexpr#1\relax\numexpr#2\relax,\numexpr#3\relax} % name -\unexpanded\def\getdayoftheweek#1#2#3{\normalweekday\clf_weekday\numexpr#1\relax\numexpr#2\relax,\numexpr#3\relax\relax} % number + \def\dayoftheweek #1#2#3{\clf_weekdayname\numexpr#1\relax\numexpr#2\relax\numexpr#3\relax} % name +\unexpanded\def\getdayoftheweek#1#2#3{\normalweekday\clf_weekday\numexpr#1\relax\numexpr#2\relax\numexpr#3\relax\relax} % number %D Using this macro in %D diff --git a/tex/context/base/mkiv/core-ctx.lua b/tex/context/base/mkiv/core-ctx.lua index c20691cd7..1f22402e6 100644 --- a/tex/context/base/mkiv/core-ctx.lua +++ b/tex/context/base/mkiv/core-ctx.lua @@ -37,6 +37,7 @@ local gsub, find, match, validstring = string.gsub, string.find, string.match, s local concat = table.concat local xmltext = xml.text +local report_jobfile = logs.reporter("system","jobfile") local report_prepfiles = logs.reporter("system","prepfiles") local commands = commands @@ -94,6 +95,8 @@ end function ctxrunner.load(ctxname) + report_jobfile("processing %a",ctxname) + local xmldata = xml.load(ctxname) local jobname = tex.jobname -- todo @@ -138,7 +141,7 @@ function ctxrunner.load(ctxname) end for e in xml.collected(xmldata,"ctx:message") do - report_prepfiles("ctx comment: %s", xmltext(e)) + report_jobfile("ctx comment: %s", xmltext(e)) end for r, d, k in xml.elements(xmldata,"ctx:value[@name='job']") do @@ -192,17 +195,21 @@ function ctxrunner.load(ctxname) pattern =justtext(xml.tostring(pattern)) if preprocessor and preprocessor ~= "" and pattern and pattern ~= "" then local noftreatments = #treatments + 1 - local findpattern = string.topattern(pattern) + local findpattern = string.topattern(pattern) local preprocessors = utilities.parsers.settings_to_array(preprocessor) treatments[noftreatments] = { pattern = findpattern, preprocessors = preprocessors, } - report_prepfiles("step %s, pattern %a, preprocessor: %a",noftreatments,findpattern,preprocessors) + report_jobfile("step %s, pattern %a, preprocessor: %a",noftreatments,findpattern,preprocessors) end end end + if #treatments == 0 then + report_jobfile("no treatments needed") + end + local function needstreatment(oldfile) for i=1,#treatments do local treatment = treatments[i] @@ -215,6 +222,8 @@ function ctxrunner.load(ctxname) local preparefile = #treatments > 0 and function(prepfiles,filename) + filename = file.collapsepath(filename) + local treatment = needstreatment(filename) local oldfile = filename local newfile = false @@ -244,9 +253,12 @@ function ctxrunner.load(ctxname) end end end + oldname = file.collapsepath(oldname) + newname = file.collapsepath(newname) if not newfile then newfile = filename - elseif file.needsupdating(filename,newfile) then + report_prepfiles("%a is not converted to %a",filename,newfile) + elseif not lfs.isfile(newfile) or file.needsupdating(filename,newfile) then for i=1,#runners do report_prepfiles("step %i: %s",i,runners[i]) end @@ -258,6 +270,8 @@ function ctxrunner.load(ctxname) -- if result > 0 then -- report_prepfiles("error, return code: %s",result) -- end + logs.newline() + logs.newline() end if lfs.isfile(newfile) then file.syncmtimes(filename,newfile) @@ -268,6 +282,8 @@ function ctxrunner.load(ctxname) end elseif lfs.isfile(newfile) then report_prepfiles("%a is already converted to %a",filename,newfile) + else + report_prepfiles("unknown error when converting %a to %a",filename,newfile) end else newfile = filename diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 51e0d32dc..6ea8ed23f 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 0cdfbf5f3..cb96b7185 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/fonts/mkiv/type-imp-lato.mkiv b/tex/context/fonts/mkiv/type-imp-lato.mkiv index 11a386b3f..4a0dbeb36 100644 --- a/tex/context/fonts/mkiv/type-imp-lato.mkiv +++ b/tex/context/fonts/mkiv/type-imp-lato.mkiv @@ -1,6 +1,6 @@ %D \module %D [ file=type-imp-lato, -%D version=2014.05.02, +%D version=2016.05.07, %D title=\CONTEXT\ Typescript Macros, %D subtitle=Lato fonts, %D author=Hans Hagen, @@ -11,11 +11,24 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% hai : hair / lta : italic -% lig : light / lta : italic -% reg : regular / lta : italic -% bol : bold / lta : italic -% bla : black / lta : italic +% Lato-Black.ttf +% Lato-BlackItalic.ttf +% Lato-Bold.ttf +% Lato-BoldItalic.ttf +% Lato-Hairline.ttf +% Lato-HairlineItalic.ttf +% Lato-Heavy.ttf +% Lato-HeavyItalic.ttf +% Lato-Italic.ttf +% Lato-Light.ttf +% Lato-LightItalic.ttf +% Lato-Medium.ttf +% Lato-MediumItalic.ttf +% Lato-Regular.ttf +% Lato-Semibold.ttf +% Lato-SemiboldItalic.ttf +% Lato-Thin.ttf +% Lato-ThinItalic.ttf \loadtypescriptfile[dejavu] \loadtypescriptfile[xits] @@ -24,29 +37,68 @@ \starttypescript [\s!sans] [lato] [\s!name] \setups[\s!font:\s!fallback:\s!sans] - \definefontsynonym [\s!Sans] [\s!file:lato-reg] [\s!features=\s!default] - \definefontsynonym [\s!SansBold] [\s!file:lato-bol] [\s!features=\s!default] - \definefontsynonym [\s!SansItalic] [\s!file:lato-regita] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-bollta] [\s!features=\s!default] + \definefontsynonym [\s!Sans] [\s!file:lato-regular] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:lato-bold] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:lato-italic] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-bolditalic] [\s!features=\s!default] \stoptypescript \starttypescript [\s!sans] [lato-light] [\s!name] \setups[\s!font:\s!fallback:\s!sans] - \definefontsynonym [\s!Sans] [\s!file:lato-lig] [\s!features=\s!default] - \definefontsynonym [\s!SansBold] [\s!file:lato-reg] [\s!features=\s!default] - \definefontsynonym [\s!SansItalic] [\s!file:lato-liglta] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-regita] [\s!features=\s!default] + \definefontsynonym [\s!Sans] [\s!file:lato-light] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:lato-regular] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:lato-lightitalic] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-italic] [\s!features=\s!default] \stoptypescript \starttypescript [\s!sans] [lato-dark] [\s!name] \setups[\s!font:\s!fallback:\s!sans] - \definefontsynonym [\s!Sans] [\s!file:lato-bol] [\s!features=\s!default] - \definefontsynonym [\s!SansBold] [\s!file:lato-bla] [\s!features=\s!default] - \definefontsynonym [\s!SansItalic] [\s!file:lato-bollta] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-blalta] [\s!features=\s!default] + \definefontsynonym [\s!Sans] [\s!file:lato-bold] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:lato-heavy] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:lato-bolditalic] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-heavyitalic] [\s!features=\s!default] + \stoptypescript + + \starttypescript [\s!sans] [lato-black] [\s!name] + \setups[\s!font:\s!fallback:\s!sans] + \definefontsynonym [\s!Sans] [\s!file:lato-heavy] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:lato-black] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:lato-heavyitalic] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-blackitalic] [\s!features=\s!default] \stoptypescript - \starttypescript[lato,lato-light,lato-dark] + \starttypescript [\s!sans] [lato-hairline] [\s!name] + \setups[\s!font:\s!fallback:\s!sans] + \definefontsynonym [\s!Sans] [\s!file:lato-hairline] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:lato-regular] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:lato-hairlineitalic] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-italic] [\s!features=\s!default] + \stoptypescript + + \starttypescript [\s!sans] [lato-thin] [\s!name] + \setups[\s!font:\s!fallback:\s!sans] + \definefontsynonym [\s!Sans] [\s!file:lato-thin] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:lato-regular] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:lato-thinitalic] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-italic] [\s!features=\s!default] + \stoptypescript + + \starttypescript [\s!sans] [lato-medium] [\s!name] + \setups[\s!font:\s!fallback:\s!sans] + \definefontsynonym [\s!Sans] [\s!file:lato-medium] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:lato-bold] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:lato-mediumitalic] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-bolditalic] [\s!features=\s!default] + \stoptypescript + + \starttypescript [\s!sans] [lato-semibold] [\s!name] + \setups[\s!font:\s!fallback:\s!sans] + \definefontsynonym [\s!Sans] [\s!file:lato-regular] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:lato-semibold] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:lato-italic] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [\s!file:lato-semibolditalic] [\s!features=\s!default] + \stoptypescript + \starttypescript[lato,lato-light,lato-dark,lato-black,lato-hairline,lato-thin,lato-medium,lato-semibold] \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [dejavu] [\s!default] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 192da7da1..f83e7b524 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex ef3c15a99..0c981cc83 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv index 71f31bece..e033235c3 100644 --- a/tex/context/modules/mkiv/m-scite.mkiv +++ b/tex/context/modules/mkiv/m-scite.mkiv @@ -165,8 +165,29 @@ function scite.installcommands() context(exportcolors()) end +local p = lpeg.P("\\slxS ")^1 + +local function indent(str) + local l = string.split(str,"\n") + for i=1,#l do + local s = l[i] + if #s > 0 then + local n = lpegmatch(p,s) + if n then + n = (n-1)/6 + else + n = 0 + end + l[i] = formatters["\\slxb{%s}%s\\slxe"](n,s) + end + end + return concat(l,"\n") +end + local function lexdata(data,lexname) - buffers.assign("lex",exportstyled(scite.loadedlexers[lexname],data or "")) + local styled = exportstyled(scite.loadedlexers[lexname],data or "") + styled = indent(styled) + buffers.assign("lex",styled) end scite.lexdata = lexdata @@ -187,9 +208,21 @@ end \unprotect +\unexpanded\def\buff_scite_slxb#1% + {%\begingroup + \hangindent\dimexpr\numexpr#1+1\relax\emwidth\relax + \hangafter \numexpr\numexpr#1+1\relax} + +\unexpanded\def\buff_scite_slxe + {\par + }%\endgroup} + \unexpanded\def\installscitecommands {\ctxlua{buffers.scite.installcommands()}% - \let\installscitecommands\relax} + \let\installscitecommands\relax + \def\slxS{\fixedspace\allowbreak}% + \let\slxb\buff_scite_slxb + \let\slxe\buff_scite_slxe} \unexpanded\def\startscite {\begingroup @@ -212,6 +245,7 @@ end \installscitecommands \tt \dontcomplain + \raggedright \startcontextcode \startlines \getbuffer[lex]% @@ -232,6 +266,7 @@ end \installscitecommands \tt \dontcomplain + \raggedright \setcatcodetable\ctxcatcodes % needed in xml \startlines \getbuffer[lex]% diff --git a/tex/context/modules/mkiv/s-languages-hyphenation.lua b/tex/context/modules/mkiv/s-languages-hyphenation.lua index b8de773a0..971ca3d8f 100644 --- a/tex/context/modules/mkiv/s-languages-hyphenation.lua +++ b/tex/context/modules/mkiv/s-languages-hyphenation.lua @@ -188,9 +188,12 @@ function moduledata.languages.hyphenation.startcomparepatterns(list) tags = utilities.parsers.settings_to_array(list) end noflanguages = #tags + context.begingroup() for i=1,noflanguages do langs[i] = tags[i] and languages.getnumber(tags[i]) + context.language{tags[i]} end + context.endgroup() nodes.tasks.enableaction("processors","moduledata.languages.hyphenation.showhyphens") end diff --git a/tex/context/modules/mkiv/s-mod-01.mkiv b/tex/context/modules/mkiv/s-mod-01.mkiv index 6946bef69..f1c8d4258 100644 --- a/tex/context/modules/mkiv/s-mod-01.mkiv +++ b/tex/context/modules/mkiv/s-mod-01.mkiv @@ -278,13 +278,14 @@ \setuplayout [\c!backspace=3.5cm, + \c!cutspace=2cm, \c!leftmargin=1.75cm, \c!rightmargin=0cm, \c!margindistance=.5cm, \c!leftedgedistance=.25cm, \c!rightedgedistance=.5cm, \c!edge=1.5cm, - \c!width=15.55333cm, % 13.998cm at 9pt => 15.55333 at 10pt + \c!width=middle, \c!topspace=2cm, \c!header=1.25cm, \c!footer=1.25cm, diff --git a/tex/context/modules/mkiv/x-ldx.lua b/tex/context/modules/mkiv/x-ldx.lua index 31cbebf13..e88c4c797 100644 --- a/tex/context/modules/mkiv/x-ldx.lua +++ b/tex/context/modules/mkiv/x-ldx.lua @@ -19,13 +19,13 @@ with <logo label='tex'/>. I will rewrite this using lpeg. On the other hand, we cannot expect proper <logo label='tex'/> and for educational purposed the syntax might be wrong. + +Todo: use the scite parser. --ldx]]-- --- there is a nice parser on from http://lua-users.org/wiki/LpegRecipes (by --- Patrick Donnelly) but lua crashes when I apply functions to some of the --- matches +local banner = "version 1.0.1 - 2007+ - PRAGMA ADE / CONTEXT" -banner = "version 1.0.1 - 2007+ - PRAGMA ADE / CONTEXT" +local report = logs.reporter("x-ldx") --[[ This script needs a few libraries. Instead of merging the code here @@ -226,6 +226,8 @@ and by calculating the indentation we also avoid space troubles. It also makes it possible to change the indentation afterwards. --ldx]]-- +local newmethod = true + function ldx.as_xml(data) -- ldx: not needed local t, cmode = { }, false t[#t+1] = "<?xml version='1.0' standalone='yes'?>\n" @@ -233,38 +235,44 @@ function ldx.as_xml(data) -- ldx: not needed for k=1,#data do local v = data[k] if v.code and not emptystring(v.code) then - t[#t+1] = "\n<code>\n" - local split = splitstring(v.code,"\n") - for k=1,#split do -- make this faster - local v = split[k] - local a, b = find(v,"^(%s+)") - if v then v = gsub(v,"[\n\r ]+$","") end - if a and b then - v = sub(v,b+1,#v) - if cmode then - t[#t+1] = "<line comment='yes' n='" .. b .. "'>" .. v .. "</line>\n" - else - t[#t+1] = "<line n='" .. b .. "'>" .. v .. "</line>\n" - end - elseif emptystring(v) then - if cmode then - t[#t+1] = "<line comment='yes'/>\n" + if newmethod then + t[#t+1] = "\n<luacode><![CDATA[\n" + t[#t+1] = v.code + t[#t+1] = "]]></luacode>\n" + else + t[#t+1] = "\n<code>\n" + local split = splitstring(v.code,"\n") + for k=1,#split do -- make this faster + local v = split[k] + local a, b = find(v,"^(%s+)") + if v then v = gsub(v,"[\n\r ]+$","") end + if a and b then + v = sub(v,b+1,#v) + if cmode then + t[#t+1] = "<line comment='yes' n='" .. b .. "'>" .. v .. "</line>\n" + else + t[#t+1] = "<line n='" .. b .. "'>" .. v .. "</line>\n" + end + elseif emptystring(v) then + if cmode then + t[#t+1] = "<line comment='yes'/>\n" + else + t[#t+1] = "<line/>\n" + end + elseif find(v,"^%-%-%[%[") then + t[#t+1] = "<line comment='yes'>" .. v .. "</line>\n" + cmode= true + elseif find(v,"^%]%]%-%-") then + t[#t+1] = "<line comment='yes'>" .. v .. "</line>\n" + cmode= false + elseif cmode then + t[#t+1] = "<line comment='yes'>" .. v .. "</line>\n" else - t[#t+1] = "<line/>\n" + t[#t+1] = "<line>" .. v .. "</line>\n" end - elseif find(v,"^%-%-%[%[") then - t[#t+1] = "<line comment='yes'>" .. v .. "</line>\n" - cmode= true - elseif find(v,"^%]%]%-%-") then - t[#t+1] = "<line comment='yes'>" .. v .. "</line>\n" - cmode= false - elseif cmode then - t[#t+1] = "<line comment='yes'>" .. v .. "</line>\n" - else - t[#t+1] = "<line>" .. v .. "</line>\n" end + t[#t+1] = "</code>\n" end - t[#t+1] = "</code>\n" elseif v.comment then t[#t+1] = "\n<comment>\n" .. v.comment .. "\n</comment>\n" else @@ -288,20 +296,25 @@ The next function wraps it all in one call: --ldx]]-- function ldx.convert(luaname,ldxname) - if not file.is_readable(luaname) then - luaname = luaname .. ".lua" + if not lfs.isfile(luaname) then + file.addsuffix(luaname,"lua") end - if file.is_readable(luaname) then + if lfs.isfile(luaname) then if not ldxname then ldxname = file.replacesuffix(luaname,"ldx") end + report("converting file %a to %a",luaname,ldxname) local data = ldx.load(luaname) if data then - ldx.enhance(data) +-- ldx.enhance(data) if ldxname ~= luaname then ldx.save(ldxname,data) end + else + report("invalid file %a",luaname) end + else + report("unknown file %a",luaname) end end @@ -336,6 +349,6 @@ The main conversion call is: if environment.files and environment.files[1] then ldx.convert(environment.files[1],environment.files[2]) +else + report("no file given") end - ---~ exit(1) diff --git a/tex/context/modules/mkiv/x-ldx.mkiv b/tex/context/modules/mkiv/x-ldx.mkiv index 0156f2c55..06163a594 100644 --- a/tex/context/modules/mkiv/x-ldx.mkiv +++ b/tex/context/modules/mkiv/x-ldx.mkiv @@ -93,7 +93,23 @@ \startxmlsetups ldx:code \startpacked \xmlflush{#1}\relax - \stoppacked + \scitepacked +\stopxmlsetups + +\startluacode + function xml.finalizers.tex.cdatatobuffer(c,name) + buffers.assign(name,xml.cdata(c[1])) + end +\stopluacode + +\startxmlsetups ldx:luacode + \blank + \begingroup + \switchtobodyfont[dejavu-condensed] + \xmlfilter{#1}{./cdatatobuffer('name')} + \scitebuffer[lua][name] + \endgroup + \blank \stopxmlsetups \startxmlsetups ldx:lines @@ -150,26 +166,22 @@ % code -> cd % comment -> tx (text) -\definetypeface[mainfacenormal] [ss][sans] [iwona] [default] -\definetypeface[mainfacenormal] [rm][serif][palatino] [default] -\definetypeface[mainfacenormal] [tt][mono] [modern] [default][rscale=1] % 1.1 -\definetypeface[mainfacenormal] [mm][math] [iwona] [default][encoding=default] - -\definetypeface[mainfacemedium] [ss][sans] [iwona-medium][default] -\definetypeface[mainfacenormal] [rm][serif][palatino] [default] -\definetypeface[mainfacemedium] [tt][mono] [modern] [default][rscale=1] % 1.1 -\definetypeface[mainfacemedium] [mm][math] [iwona-medium][default][encoding=default] +\usemodule[scite] -\definetypeface[mainfacenarrowtt][tt][mono] [modern-cond] [default][rscale=1] % 1.1 +\switchtobodyfont + [dejavu-condensed,10pt] % preload \setupbodyfont - [mainfacenormal,11pt] + [dejavu,10pt] % main font + +\mainlanguage + [en] \setupwhitespace [big] -\defineregister[function][functions] -\defineregister[variable][variables] +\defineregister[function] +\defineregister[variable] \definehead[source][subject] \definehead[extra] [subsubject] @@ -190,7 +202,15 @@ \setuplayout [width=middle, height=middle, - backspace=2cm, - topspace=2cm] + footer=0pt, + header=1.5cm, + backspace=1.5cm, + topspace=1.5cm] + +\doifmode {nocolor} { + + \setupcolors + [conversion=always] +} \endinput diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b0c5d4c1f..3e6f1d138 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 05/08/16 01:35:36 +-- merge date : 05/08/16 17:30:49 do -- begin closure to overcome local limits and interference |