diff options
author | Marius <mariausol@gmail.com> | 2012-09-17 00:40:23 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-09-17 00:40:23 +0300 |
commit | aef5e141d1336f02563e3ad2b54dfe414d4c8049 (patch) | |
tree | 0f5074f5819482cd81c13583a0e2aa694200f9b6 /tex | |
parent | 0f82c3f6ef101a553b3f28d9f9d8cb905106eec2 (diff) | |
download | context-aef5e141d1336f02563e3ad2b54dfe414d4c8049.tar.gz |
beta 2012.09.16 23:18
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4142 -> 4141 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 106519 -> 106457 bytes | |||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/lang-def.mkiv | 34 | ||||
-rw-r--r-- | tex/context/base/lang-txt.lua | 178 | ||||
-rw-r--r-- | tex/context/base/lxml-tab.lua | 12 | ||||
-rw-r--r-- | tex/context/base/pack-mrl.mkiv | 34 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24585 -> 24570 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 195020 -> 195041 bytes | |||
-rw-r--r-- | tex/context/base/strc-num.mkiv | 4 | ||||
-rw-r--r-- | tex/context/base/supp-mat.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/trac-lmx.lua | 22 | ||||
-rw-r--r-- | tex/context/base/util-deb.lua | 1 | ||||
-rw-r--r-- | tex/context/base/util-sql.lua | 73 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
18 files changed, 274 insertions, 96 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index ec95eb332..2e90a2dc9 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.09.11 20:36} +\newcontextversion{2012.09.16 23:18} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index cfe4e9cc6..cc6342b05 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.09.11 20:36} +\newcontextversion{2012.09.16 23:18} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex d5b6b48d6..7db72b855 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex df3ece839..98253d101 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index a1bd203d9..2582f1f9f 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.09.11 20:36} +\edef\contextversion{2012.09.16 23:18} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 5e1f7c680..52c4d897e 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.09.11 20:36} +\edef\contextversion{2012.09.16 23:18} %D For those who want to use this: diff --git a/tex/context/base/lang-def.mkiv b/tex/context/base/lang-def.mkiv index e838f60e1..d4e40dad1 100644 --- a/tex/context/base/lang-def.mkiv +++ b/tex/context/base/lang-def.mkiv @@ -211,28 +211,34 @@ \installlanguage [\s!cs] [\c!spacing=\v!packed, - \c!leftsentence={\thickglue\endash\thickglue\penalty-20\relax}, - \c!rightsentence={\thickglue\endash\thickglue\penalty-20\relax}, - \c!leftsubsentence={\nobreakspace\emdash\nobreakspace\penalty-20\relax}, - \c!rightsubsentence={\nobreakspace\emdash\nobreakspace\penalty-20\relax}, + \c!leftsentence={\nobreakspace\endash\thickglue\penalty\zerocount\relax}, + \c!rightsentence=\c!leftsentence, + \c!leftsubsentence=\c!leftsentence, + \c!rightsubsentence=\c!rightsentence, \c!leftquote=\lowerleftsingleninequote, \c!rightquote=\upperrightsinglesixquote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!day,{.\thinspace},\v!month,\space,\v!year}] + \c!date={\v!day,\fourperemspace,\v!month,\space,\v!year} + \s!lefthyphenmin=2, + \s!righthyphenmin=3 +] \installlanguage [\s!sk] [\c!spacing=\v!packed, - \c!leftsentence=\emdash, - \c!rightsentence=\emdash, - \c!leftsubsentence=\emdash, - \c!rightsubsentence=\emdash, - \c!leftquote=\upperleftsinglesixquote, - \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, - \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,{.\thinspace},\v!month,\space,\v!year}] + \c!leftsentence={\nobreakspace\endash\thickglue\penalty\zerocount\relax}, + \c!rightsentence=\c!leftsentence, + \c!leftsubsentence=\c!leftsentence, + \c!rightsubsentence=\c!rightsentence, + \c!leftquote=\lowerleftsingleninequote, + \c!rightquote=\upperrightsinglesixquote, + \c!leftquotation=\lowerleftdoubleninequote, + \c!rightquotation=\upperrightdoublesixquote, + \c!date={\v!day,\fourperemspace,\v!month,\space,\v!year} + \s!lefthyphenmin=2, + \s!righthyphenmin=3 +] \installlanguage [\s!hr] diff --git a/tex/context/base/lang-txt.lua b/tex/context/base/lang-txt.lua index cda3bc9e9..7b0e046fe 100644 --- a/tex/context/base/lang-txt.lua +++ b/tex/context/base/lang-txt.lua @@ -66,229 +66,311 @@ data.labels={ functions={ Pr={ labels={ + cz="P", en="Pr", + sk="P", }, }, arccos={ labels={ + cz="arccos", en="arccos", hr="arc\\sixperemspace cos", pl="arc\\sixperemspace cos", + sk="arccos", }, }, arcctg={ labels={ + cz="arccotg", en="arccot", hr="arc\\sixperemspace ctg", pl="arc\\sixperemspace ctg", + sk="arccotg", }, }, arcsin={ labels={ + cz="arcsin", en="arcsin", hr="arc\\sixperemspace sin", pl="arc\\sixperemspace sin", + sk="arcsin", }, }, arctan={ labels={ + cz="arctg", en="arctan", hr="arc\\sixperemspace tg", pl="arc\\sixperemspace tg", + sk="arctg", }, }, arctg={ labels={ + cz="arctg", en="arctan", hr="arc\\sixperemspace tg", pl="arc\\sixperemspace tg", + sk="arctg", }, }, arg={ labels={ + cz="arg", en="arg", + sk="arg", }, }, cos={ labels={ + cz="cos", en="cos", + sk="cos", }, }, cosh={ labels={ + cz="cosh", en="cosh", + sk="cosh", }, }, cot={ labels={ + cz="cotg", en="cot", hr="ctg", pl="ctg", + sk="cotg", }, }, coth={ labels={ + cz="cotgh", en="coth", + sk="cotgh", }, }, csc={ labels={ + cz="cosec", en="csc", + sk="cosec", }, }, ctg={ labels={ + cz="cotg", en="cot", hr="ctg", pl="ctg", + sk="cotg", }, }, deg={ labels={ + cz="deg", en="deg", + sk="deg", }, }, det={ labels={ + cz="det", en="det", + sk="det", }, }, dim={ labels={ + cz="dim", en="dim", + sk="dim", }, }, exp={ labels={ + cz="exp", en="exp", + sk="exp", }, }, gcd={ labels={ + cz="NSD", en="gcd", hr="nzd", nl="ggd", + sk="NSD", }, }, hom={ labels={ + cz="Hom", en="hom", + sk="Hom", }, }, inf={ labels={ + cz="inf", en="inf", + sk="inf", }, }, injlim={ labels={ + cz="inj\\sixperemspace lim", en="inj\\sixperemspace lim", + sk="inj\\sixperemspace lim", }, }, ker={ labels={ + cz="ker", en="ker", + sk="ker", }, }, lcm={ labels={ + cz="NSN", en="lcm", hr="nzv", nl="kgv", + sk="NSN", }, }, lg={ labels={ + cz="log", en="lg", + sk="log", }, }, lim={ labels={ + cz="lim", en="lim", + sk="lim", }, }, liminf={ labels={ + cz="lim\\sixperemspace inf", en="lim\\sixperemspace inf", + sk="lim\\sixperemspace inf", }, }, limsup={ labels={ + cz="lim\\sixperemspace sup", en="lim\\sixperemspace sup", + sk="lim\\sixperemspace sup", }, }, ln={ labels={ + cz="ln", en="ln", + sk="ln", }, }, log={ labels={ + cz="log", en="log", + sk="log", }, }, max={ labels={ + cz="max", en="max", + sk="max", }, }, median={ labels={ + cz="\\tilde", en="median", + sk="\\tilde", }, }, min={ labels={ + cz="min", en="min", + sk="min", }, }, mod={ labels={ + cz="mod", en="mod", + sk="mod", }, }, projlim={ labels={ + cz="proj\\sixperemspace lim", en="proj\\sixperemspace lim", + sk="proj\\sixperemspace lim", }, }, sec={ labels={ + cz="sec", en="sec", + sk="sec", }, }, sin={ labels={ + cz="sin", en="sin", + sk="sin", }, }, sinh={ labels={ + cz="sinh", en="sinh", + sk="sinh", }, }, sup={ labels={ + cz="sup", en="sup", + sk="sup", }, }, tan={ labels={ + cz="tg", en="tan", hr="tg", pl="tg", + sk="tg", }, }, tanh={ labels={ + cz="tgh", en="tanh", + sk="tgh", }, }, tg={ labels={ + cz="tg", en="tan", hr="tg", pl="tg", + sk="tg", }, }, }, @@ -297,7 +379,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="a", da="", de="und", en="and", @@ -317,7 +399,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="a", sl="", sv="", tk="", @@ -404,10 +486,10 @@ data.labels={ }, }, ["april:mnem"]={ - labels={ + labels={ af="", ca="", - cs="", + cs="dub.", da="", de="", en="apr", @@ -427,7 +509,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="apr.", sl="", sv="", tk="", @@ -461,7 +543,7 @@ data.labels={ pt="", ro="", ru="на странице ", - sk="", + sk="na strane ", sl="na strani ", sv="på sida ", tk="", @@ -514,7 +596,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="srp.", da="", de="", en="aug", @@ -534,7 +616,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="aug.", sl="", sv="", tk="", @@ -585,7 +667,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs=" (pokračování)", da="", de="", en=" (continued)", @@ -605,7 +687,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk=" (pokračovanie)", sl="", sv="", tk="", @@ -657,7 +739,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="pros.", da="", de="", en="dec", @@ -677,7 +759,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="dec.", sl="", sv="", tk="", @@ -729,7 +811,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="ún.", da="", de="", en="feb", @@ -749,7 +831,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="feb.", sl="", sv="", tk="", @@ -823,7 +905,7 @@ data.labels={ pt="sexta-feira", ro="vineri", ru="пятница", - sk="", + sk="piatok", sl="petek", sv="fredag", tk="bäşinji gün", @@ -894,7 +976,7 @@ data.labels={ pt="", ro="", ru="см. выше", - sk="", + sk="pozri hore", sl="glej zgoraj", sv="se ovan", tk="", @@ -928,7 +1010,7 @@ data.labels={ pt="", ro="", ru="см. ниже", - sk="", + sk="pozri ďalej", sl="glej spodaj", sv="se nedan", tk="", @@ -1017,7 +1099,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="led.", da="", de="", en="jan", @@ -1037,7 +1119,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="jan.", sl="", sv="", tk="", @@ -1090,7 +1172,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="čce", da="", de="", en="jul", @@ -1110,7 +1192,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="júla", sl="", sv="", tk="", @@ -1162,7 +1244,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="čer.", da="", de="", en="jun", @@ -1182,7 +1264,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="júna", sl="", sv="", tk="", @@ -1307,7 +1389,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="břez.", da="", de="", en="mar", @@ -1327,7 +1409,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="mar.", sl="", sv="", tk="", @@ -1380,7 +1462,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="květ.", da="", de="", en="may", @@ -1400,7 +1482,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="mája", sl="", sv="", tk="", @@ -1437,7 +1519,7 @@ data.labels={ pt="segunda-feira", ro="luni", ru="понедельник", - sk="", + sk="pondelok", sl="ponedeljek", sv="måndag", tk="birinji gün", @@ -1489,7 +1571,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="list.", da="", de="", en="nov", @@ -1509,7 +1591,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="nov.", sl="", sv="", tk="", @@ -1560,7 +1642,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="říj.", da="", de="", en="oct", @@ -1580,7 +1662,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="okt.", sl="", sv="", tk="", @@ -1615,7 +1697,7 @@ data.labels={ pt="", ro="", ru="страница ", - sk="", + sk="strana ", sl="stran ", sv="Sida ", tk="", @@ -1689,7 +1771,7 @@ data.labels={ pt="sábado", ro="sâmbătă", ru="суббота", - sk="", + sk="sobota", sl="sobota", sv="lördag", tk="altynjy gün", @@ -1762,7 +1844,7 @@ data.labels={ pt="", ro="", ru="см. ", - sk="", + sk="pozri ", sl="glej ", sv="se ", tk="", @@ -1814,7 +1896,7 @@ data.labels={ labels={ af="", ca="", - cs="", + cs="září", da="", de="", en="sep", @@ -1834,7 +1916,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="sept.", sl="", sv="", tk="", @@ -1982,7 +2064,7 @@ data.labels={ pt="domingo", ro="duminică", ru="воскресенье", - sk="", + sk="nedeľa", sl="nedelja", sv="söndag", tk="dynç gün", @@ -2056,7 +2138,7 @@ data.labels={ pt="quinta-feira", ro="joi", ru="четверг", - sk="", + sk="štvrtok", sl="četrtek", sv="torsdag", tk="dördünji gün", @@ -2093,7 +2175,7 @@ data.labels={ pt="terça-feira", ro="marți", ru="вторник", - sk="", + sk="utorok", sl="torek", sv="tisdag", tk="ikinji gün", @@ -2130,7 +2212,7 @@ data.labels={ pt="quarta-feira", ro="miercuri", ru="среда", - sk="", + sk="streda", sl="sreda", sv="onsdag", tk="üçünji", @@ -2221,7 +2303,7 @@ data.labels={ ar="الأشكال", ca="Figures", cn="图形", - cs="Obrázky", + cs="Seznam obrázků", da="Figurer", de="Abbildungen", en="Figures", @@ -2243,7 +2325,7 @@ data.labels={ pt="Figuras", ro="Figuri", ru="Список иллюстраций", - sk="Obrázkov", + sk="Zoznam obrázkov", sl="Slike", sv="Figurer", tk="Suratlar", @@ -2258,7 +2340,7 @@ data.labels={ ar="الرسوم", ca="Gràfiques", cn="图", - cs="Grafy", + cs="Seznam grafů", da="Grafik", de="Graphiken", en="Graphics", @@ -2280,7 +2362,7 @@ data.labels={ pt="Gráficos", ro="Grafice", ru="Список графиков", - sk="Graf", + sk="Zoznam grafov", sl="Slike", sv="Grafik", tk="Grafikler", @@ -2424,7 +2506,7 @@ data.labels={ pt="", ro="", ru="", - sk="", + sk="Literatúra", sl="Literatura", sv="", tk="", @@ -2439,7 +2521,7 @@ data.labels={ ar="الجداول", ca="Taules", cn="表格", - cs="Tabulky", + cs="Seznam tabulek", da="Tabeller", de="Tabellen", en="Tables", @@ -2461,7 +2543,7 @@ data.labels={ pt="Tabelas", ro="Tabele", ru="Список таблиц", - sk="Tabuliek", + sk="Zoznam tabuliek", sl="Tabele", sv="Tabeller", tk="Tablisalar", diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua index 4ef019075..6b23953cc 100644 --- a/tex/context/base/lxml-tab.lua +++ b/tex/context/base/lxml-tab.lua @@ -832,10 +832,14 @@ function xml.load(filename,settings) elseif filename then -- filehandle data = filename:read("*all") end - settings.currentresource = filename - local result = xmlconvert(data,settings) - settings.currentresource = nil - return result + if settings then + settings.currentresource = filename + local result = xmlconvert(data,settings) + settings.currentresource = nil + return result + else + return xmlconvert(data,{ currentresource = filename }) + end end --[[ldx-- diff --git a/tex/context/base/pack-mrl.mkiv b/tex/context/base/pack-mrl.mkiv index 1fc774ade..ec214d4f3 100644 --- a/tex/context/base/pack-mrl.mkiv +++ b/tex/context/base/pack-mrl.mkiv @@ -491,6 +491,7 @@ \c!color=, \c!rulecolor=, \c!bodyfont=, + \c!depthcorrection=\v!on, \c!rulethickness=\linewidth, \c!distance=.5\emwidth] @@ -589,21 +590,30 @@ \noindent\box\scratchbox \egroup} -% \def\pack_textrule_correct_depth -% {\ifhmode -% \endgraf -% \fi -% \vskip\dimexpr \strutdp +.5\exheight -% \ifdim\prevdepth>\strutdp\else % was <\strutdp -% \ifdim\prevdepth>\zeropoint -% -\prevdepth -% \fi -% \fi -% \relax} +\def\pack_textrule_correct_depth_yes + {\vskip\dimexpr + \strutdp +.5\exheight + \ifdim\prevdepth>\strutdp\else + \ifdim\prevdepth>\zeropoint + -\prevdepth + \fi + \fi + \relax + \relax} + +\def\pack_textrule_correct_depth_nop + {\vskip\dimexpr + \strutdp +.5\exheight + \relax + \relax} \def\pack_textrule_following#1% {\doifelsenothing{#1} - {\nointerlineskip + {\ifhmode + \endgraf + \fi + \doifelse{\directtextrulesparameter\c!depthcorrection}\v!on\pack_textrule_correct_depth_yes\pack_textrule_correct_depth_nop + \nointerlineskip \dontleavehmode\vbox {\color[\directtextrulesparameter\c!rulecolor] {\hrule\s!depth\directtextrulesparameter\c!rulethickness\s!height\zeropoint\s!width\availablehsize}}} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 28a1d8093..c31ba403b 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 49957706f..8ad2ea57b 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index 2209540ac..d8815d423 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -643,7 +643,7 @@ \def\strc_counter_setup_using_parameter#1#2% name \someparameter {\edef\p_start{#2\c!start}% - \setupcounter + \normalexpanded{\setupcounter [#1] [ \c!start=\ifx\p_start\empty0\else\number\p_start\fi, \c!state=#2\c!state, % beware, "" == start @@ -665,7 +665,7 @@ \c!numberconversionset=#2\c!numberconversionset, \c!numberstarter=#2\c!numberstarter, \c!numberstopper=#2\c!numberstopper, - \c!numbersegments=#2\c!numbersegments]} + \c!numbersegments=#2\c!numbersegments]}} \def\strc_counter_preset_using_parameter#1#2% \setupcommand \someparameter {#1% diff --git a/tex/context/base/supp-mat.mkiv b/tex/context/base/supp-mat.mkiv index d07560d9c..f77ee3454 100644 --- a/tex/context/base/supp-mat.mkiv +++ b/tex/context/base/supp-mat.mkiv @@ -51,7 +51,7 @@ \let\normalstartimath \Ustartmath \let\normalstopimath \Ustopmath \let\normalstartdmath \Ustartdisplaymath -\let\normalstopdmath \Ustopmath +\let\normalstopdmath \Ustopdisplaymath \def\normalmathaligntab{&} % \let\normalmathaligntab\aligntab does to work well in a let to & (a def works ok) diff --git a/tex/context/base/trac-lmx.lua b/tex/context/base/trac-lmx.lua index b39c8ca54..97938fb77 100644 --- a/tex/context/base/trac-lmx.lua +++ b/tex/context/base/trac-lmx.lua @@ -343,7 +343,8 @@ local function getdefinition(definitions,tag) return definitions[tag] or "" end -local whitespace = lpeg.patterns.whitespace^0 +local whitespace = lpeg.patterns.whitespace +local optionalspaces = whitespace^0 local begincomment = P("<!--") local endcomment = P("-->") @@ -354,7 +355,7 @@ local endembedxml = P("?>") local beginembedcss = P("/*") local endembedcss = P("*/") -local gobbledend = (whitespace * endembedxml) / "" +local gobbledend = (optionalspaces * endembedxml) / "" local argument = (1-gobbledend)^0 local comment = (begincomment * (1-endcomment)^0 * endcomment) / "" @@ -375,15 +376,15 @@ local luacodecss = beginluacss local othercode = (1-beginluaxml-beginluacss)^1 / " p[==[%0]==] " -local include = ((beginembedxml * P("lmx-include") * whitespace) / "") +local include = ((beginembedxml * P("lmx-include") * optionalspaces) / "") * (argument / lmx.include) * gobbledend -local define_b = ((beginembedxml * P("lmx-define-begin") * whitespace) / "") +local define_b = ((beginembedxml * P("lmx-define-begin") * optionalspaces) / "") * argument * gobbledend -local define_e = ((beginembedxml * P("lmx-define-end") * whitespace) / "") +local define_e = ((beginembedxml * P("lmx-define-end") * optionalspaces) / "") * argument * gobbledend @@ -391,7 +392,7 @@ local define_c = C((1-define_e)^0) local define = (Carg(1) * C(define_b) * define_c * define_e) / savedefinition -local resolve = ((beginembedxml * P("lmx-resolve") * whitespace) / "") +local resolve = ((beginembedxml * P("lmx-resolve") * optionalspaces) / "") * ((Carg(1) * C(argument)) / getdefinition) * gobbledend @@ -513,6 +514,15 @@ lmx.convert = lmxconvert -- helpers +local nocomment = (beginembedcss * (1 - endembedcss)^1 * endembedcss) / "" +local nowhitespace = whitespace^1 / " " -- "" +local semistripped = whitespace^1 / "" * P(";") +local stripper = Cs((nocomment + semistripped + nowhitespace + 1)^1) + +function lmx.stripcss(str) + return lpegmatch(stripper,str) +end + function lmx.color(r,g,b,a) if r > 1 then r = 1 diff --git a/tex/context/base/util-deb.lua b/tex/context/base/util-deb.lua index 6285e05f3..33d43b25f 100644 --- a/tex/context/base/util-deb.lua +++ b/tex/context/base/util-deb.lua @@ -122,6 +122,7 @@ function inspect(i) -- global function else print(tostring(i)) end + return i -- so that we can inline the inspect end -- from the lua book: diff --git a/tex/context/base/util-sql.lua b/tex/context/base/util-sql.lua index bcd82c210..f86607377 100644 --- a/tex/context/base/util-sql.lua +++ b/tex/context/base/util-sql.lua @@ -19,6 +19,60 @@ if not modules then modules = { } end modules ['util-sql'] = { -- context in a regular tds tree (the standard distribution) it makes sense to put shared -- code in the context distribution. That way we don't need to reinvent wheels every time. +-- For some reason the sql lib partially fails in luatex when creating hashed row. So far +-- we couldn't figure it out (some issue with adapting the table that is passes as first +-- argument in the fetch routine. Apart from this it looks like the mysql binding has some +-- efficiency issues (like creating a keys and types table for each row) but that could be +-- optimized. Anyhow, fecthing results can be done as follows: + +-- local function collect_1(r) +-- local t = { } +-- for i=1,r:numrows() do +-- t[#t+1] = r:fetch({},"a") +-- end +-- return t +-- end +-- +-- local function collect_2(r) +-- local keys = r:getcolnames() +-- local n = #keys +-- local t = { } +-- for i=1,r:numrows() do +-- local v = { r:fetch() } +-- local r = { } +-- for i=1,n do +-- r[keys[i]] = v[i] +-- end +-- t[#t+1] = r +-- end +-- return t +-- end +-- +-- local function collect_3(r) +-- local keys = r:getcolnames() +-- local n = #keys +-- local t = { } +-- for i=1,r:numrows() do +-- local v = r:fetch({},"n") +-- local r = { } +-- for i=1,n do +-- r[keys[i]] = v[i] +-- end +-- t[#t+1] = r +-- end +-- return t +-- end +-- +-- On a large table with some 8 columns (mixed text and numbers) we get the following +-- timings (the 'a' alternative is already using the more efficient variant in the +-- binding). +-- +-- collect_1 : 1.31 +-- collect_2 : 1.39 +-- collect_3 : 1.75 +-- +-- Some, as a workaround for this 'bug' the second alternative can be used. + local format, match = string.format, string.match local random = math.random local rawset, setmetatable, loadstring, type = rawset, setmetatable, loadstring, type @@ -378,6 +432,7 @@ local function connect(session,specification) end local whitespace = patterns.whitespace^0 +local eol = patterns.eol local separator = P(";") local escaped = patterns.escaped local dquote = patterns.dquote @@ -386,8 +441,9 @@ local dsquote = squote * squote ---- quoted = patterns.quoted local quoted = dquote * (escaped + (1-dquote))^0 * dquote + squote * (escaped + dsquote + (1-squote))^0 * squote +local comment = P("--") * (1-eol) / "" local query = whitespace - * Cs((quoted + 1 - separator)^1 * Cc(";")) + * Cs((quoted + comment + 1 - separator)^1 * Cc(";")) * whitespace local splitter = Ct(query * (separator * query)^0) @@ -446,12 +502,21 @@ local function datafetched(specification,query) local n = result:numrows() or 0 if n == 0 then data = { } - elseif n == 1 then - data = { result:fetch({},"a") } + -- elseif n == 1 then + -- -- data = { result:fetch({},"a") } else data = { } + -- for i=1,n do + -- data[i] = result:fetch({},"a") + -- end + local k = #keys for i=1,n do - data[i] = result:fetch({},"a") + local v = { result:fetch() } + local d = { } + for i=1,k do + d[keys[i]] = v[i] + end + data[#data+1] = d end end end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index fb6fe9348..b40cb3eae 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/11/12 20:36:54 +-- merge date : 09/16/12 23:18:22 do -- begin closure to overcome local limits and interference |