diff options
-rw-r--r-- | scripts/context/ruby/xmltools.rb | 72 | ||||
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/core-mat.tex | 6 | ||||
-rw-r--r-- | tex/context/base/core-mis.tex | 95 | ||||
-rw-r--r-- | tex/context/base/core-ntb.tex | 25 | ||||
-rw-r--r-- | tex/context/base/enco-pfr.tex | 1 | ||||
-rw-r--r-- | tex/context/base/enco-uc.tex | 21 | ||||
-rw-r--r-- | tex/context/interface/keys-cz.xml | 2 | ||||
-rw-r--r-- | tex/context/interface/keys-de.xml | 2 | ||||
-rw-r--r-- | tex/context/interface/keys-en.xml | 2 | ||||
-rw-r--r-- | tex/context/interface/keys-fr.xml | 2 | ||||
-rw-r--r-- | tex/context/interface/keys-it.xml | 2 | ||||
-rw-r--r-- | tex/context/interface/keys-nl.xml | 2 | ||||
-rw-r--r-- | tex/context/interface/keys-ro.xml | 2 |
15 files changed, 216 insertions, 22 deletions
diff --git a/scripts/context/ruby/xmltools.rb b/scripts/context/ruby/xmltools.rb index c3e76b23a..5b4a112b8 100644 --- a/scripts/context/ruby/xmltools.rb +++ b/scripts/context/ruby/xmltools.rb @@ -400,10 +400,63 @@ class Commands end end + def filter + + require "rexml/document" + + element = @commandline.option('element') + files = @commandline.arguments + result = "xmltools.xlg" + + if element.empty? then + report("provide element using --element") + elsif files.length == 0 then + report("provide filename(s)") + else + begin + File.open(result,'w') do |f| + f << "<?xml version='1.0'?>\n\n" + f << "<xlg:document>\n\n" + total = 0 + files.sort.each do |file| + begin + report("loading: #{file}") + data = REXML::Document.new(IO.read(file)) + rescue + report("error: invalid xml") + else + found = 0 + report("filtering: #{element}") + REXML::XPath.each(data,"//#{element}") do |table| + str = table.to_s + if str.length > 0 then + total += 1 + found += 1 + report("found: #{total} / #{found} / #{str.length} bytes") + f << "<xlg:file name='#{file}'>\n\n" unless found > 1 + f << "<xlg:filtered n='#{total}' m='#{found}'>" + f << "#{str.gsub(/^\s*/m,'').gsub(/\s*$/m,'')}" + f << "</xlg:filtered>\n\n" + end + end + f << "</xlg:file>\n\n" if found > 0 + end + end + f << "</xlg:document>\n" + end + report("result: #{result}") + rescue + report("error in opening #{result}") + end + end + + end + def enhance oldname = @commandline.argument('first') newname = @commandline.argument('second') verbose = @commandline.option('verbose') + # todo: options, maybe a config file if ! newname || newname.empty? then newname = oldname + ".prep" end @@ -417,15 +470,30 @@ class Commands preamble = $1 $2 end + # hide elements data.gsub!(/<(.*?)>/mois) do elements << $1 "<#{elements.length}>" end + # abc[-/]def data.gsub!(/([a-z]{3,})([\/\-])([a-z]{3,})/mois) do done = true report("compound: #{$1}#{$2}#{$3}") if verbose "#{$1}<compound token='#{$2}'/>#{$3}" end + # (abcd + data.gsub!(/(\()([a-z]{4,})/mois) do + done = true + report("compound: #{$1}#{$2}") if verbose + "<compound token='#{$1}'/>#{$2}" + end + # abcd) + data.gsub!(/(\()([a-z]{4,})/mois) do + done = true + report("compound: #{$1}#{$2}") if verbose + "#{$2}<compound token='#{$2}'/>" + end + # roll back elements data.gsub!(/<(\d+)>/mois) do "<#{elements.shift}>" end @@ -553,7 +621,8 @@ commandline.registeraction('dir', 'generate directory listing') commandline.registeraction('mmlpages','generate graphic from mathml') commandline.registeraction('analyze', 'report entities and elements [--utf --process]') commandline.registeraction('cleanup', 'cleanup xml file [--force]') -commandline.registeraction('enhance', 'enhance xml file') +commandline.registeraction('enhance', 'enhance xml file (partial)') +commandline.registeraction('filter', 'filter elements from xml file [element=]') # commandline.registeraction('dir', 'filename --pattern= --output= [--recurse --stripname --longname --url --root]') # commandline.registeraction('mmlpages','filename [--eps --jpg --png --style= --mode=]') @@ -569,6 +638,7 @@ commandline.registerflag('recurse') commandline.registerflag('verbose') commandline.registervalue('pattern') +commandline.registervalue('element') commandline.registervalue('url') commandline.registervalue('output') commandline.registervalue('root') diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 48a96415a..a730ab928 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -13,7 +13,7 @@ % it's about time to clean up this file ... -\newcontextversion{2006.12.17 17:41} +\newcontextversion{2006.12.20 23:52} %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/context.tex b/tex/context/base/context.tex index 46b2af47c..70c21e5bd 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -42,7 +42,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2006.12.17 17:41} +\edef\contextversion{2006.12.20 23:52} %D For those who want to use this: diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex index d6e1153f7..b4ee91730 100644 --- a/tex/context/base/core-mat.tex +++ b/tex/context/base/core-mat.tex @@ -648,7 +648,8 @@ \ifx\next\bgroup \egroup \@EA\moreplaceformula % [ref]{} \else - \def\nextnext{$}% +% \def\nextnext{$}% + \let\nextnext$% \ifx\next\nextnext \egroup \@EAEAEA\dispplaceformula % [ref]$$ \else @@ -660,7 +661,8 @@ \long\def\moreplaceformula[#1]#2#3#4% #2 dummy #4 gobbles spaces {\def\redoplaceformula {\bgroup - \def\nextnext{$}% +% \def\nextnext{$}% + \let\nextnext$% \ifx\next\nextnext \egroup \@EA\dispplaceformula % [ref]$$ \else diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex index 1444d0d89..5cec47f64 100644 --- a/tex/context/base/core-mis.tex +++ b/tex/context/base/core-mis.tex @@ -1060,7 +1060,7 @@ \def\dorepeatdelimitedtext {\relax\ifcase\delimitedtextparameter\c!level\else - \dohandledelimitedtext\c!middle + \dohandledelimitedtext\c!middle % maybe better \dohandleleftdelimitedtext \fi} \let\dohandlerepeatdelimitedtext\relax @@ -1109,15 +1109,26 @@ \doifsomething{\delimitedtextparameter\c!spaceafter} {\blank[\delimitedtextparameter\c!spaceafter]}} +% \def\dostartdelimitedtexttxt +% {\let\dostopdelimitedtext\dostopdelimitedtexttxt +% \dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color\empty +% \dohandledelimitedtext\c!left +% \ignorespaces} + \def\dostartdelimitedtexttxt {\let\dostopdelimitedtext\dostopdelimitedtexttxt \dostartattributes{\??ci\currentdelimitedtext}\c!style\c!color\empty - \dohandledelimitedtext\c!left + \dohandleleftdelimitedtext\c!left \ignorespaces} +% \def\dostopdelimitedtexttxt +% {\removeunwantedspaces +% \dohandledelimitedtext\c!right +% \dostopattributes} + \def\dostopdelimitedtexttxt {\removeunwantedspaces - \dohandledelimitedtext\c!right + \dohandlerightdelimitedtext\c!right \dostopattributes} \def\stopdelimitedtext @@ -1157,6 +1168,8 @@ {\hsmash{\delimitedtextparameter\c!right}} % \starttext +% \hyphenatedword{groepsvrijstellingsverordeningen}\par +% \hyphenatedword{\quote{groepsvrijstellingsverordeningen}}\par % \dorecurse{100}{\hskip300pt\hskip\recurselevel pt test \quote{xxx xxxx}.\par} % \page \setuppapersize[A5][A4] % \quotation {overly beautiful pusillanimous sesquipedalian @@ -1190,28 +1203,96 @@ \fi \endgroup} +\def\dohandleleftdelimitedtext#1#2% + {\begingroup + \setbox\scratchbox\hbox{\delimitedtextparameter#1}% + \ifdim\wd\scratchbox>\zeropoint + \ifdim\lastkern=\delimitedtextsignal + \unkern + \hskip\hspaceamount\currentlanguage{interquotation}% + \else\ifdim\lastskip=\delimitedtextsignal + \unskip + \hskip\hspaceamount\currentlanguage{interquotation}% + \else + #2% + \fi\fi + \strut % new, needed below + \ifhmode % else funny pagebeaks + \penalty\!!tenthousand + \hskip\zeropoint % == \prewordbreak + \fi + \strut % new, needed below + \delimitedtextparameter#1% unhbox\scratchbox + \hskip\delimitedtextsignal % +- \prewordbreak + \fi + \endgroup} + +\def\dohandlerightdelimitedtext#1#2% + {\begingroup + \setbox\scratchbox\hbox{\delimitedtextparameter#1}% + \ifdim\wd\scratchbox>\zeropoint + \ifdim\lastkern=\delimitedtextsignal + \unkern + \hskip\hspaceamount\currentlanguage{interquotation}% + \else\ifdim\lastskip=\delimitedtextsignal + \unskip + \hskip\hspaceamount\currentlanguage{interquotation}% + \else + #2% + \fi\fi + \ifhmode % else funny pagebeaks + \penalty\!!tenthousand + \hskip\zeropoint % == \prewordbreak + \fi + \strut % new, needed below + \delimitedtextparameter#1% unhbox\scratchbox + \kern\delimitedtextsignal % +- \prewordbreak + \fi + \endgroup} + \def\ignoredelimitedtext#1% {\delimitedtextparameter#1} \def\handledelimitedtext#1% {\dohandledelimitedtext{#1}\relax} +\def\handleleftdelimitedtext#1% + {\dohandleleftdelimitedtext{#1}\relax} + +\def\handlerightdelimitedtext#1% + {\dohandlerightdelimitedtext{#1}\relax} + +% \unexpanded\def\dodelimitedtextpar +% {\dohandledelimitedtext\c!left\relax +% \groupedcommand +% \donothing +% {\dohandledelimitedtext\c!right\removelastskip +% \popdelimitedtext}} + \unexpanded\def\dodelimitedtextpar - {\dohandledelimitedtext\c!left\relax + {\dohandleleftdelimitedtext\c!left\relax \groupedcommand \donothing - {\dohandledelimitedtext\c!right\removelastskip + {\dohandlerightdelimitedtext\c!right\removelastskip \popdelimitedtext}} \unexpanded\def\dodelimitedtexttxt {\doifelse{\delimitedtextparameter\c!style}\v!normal \doquoteddelimited\doattributeddelimited} +% \def\doquoteddelimited +% {\dohandledelimitedtext\c!left\relax +% \groupedcommand +% \donothing +% {\dohandledelimitedtext\c!right +% \removelastskip +% \popdelimitedtext}} + \def\doquoteddelimited - {\dohandledelimitedtext\c!left\relax + {\dohandleleftdelimitedtext\c!left\relax \groupedcommand \donothing - {\dohandledelimitedtext\c!right + {\dohandlerightdelimitedtext\c!right \removelastskip \popdelimitedtext}} diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex index 75c3b5540..9e6eadb9a 100644 --- a/tex/context/base/core-ntb.tex +++ b/tex/context/base/core-ntb.tex @@ -255,16 +255,16 @@ \let\setupTBLsection\relax -% \setupTABLE [y] [first][background=color,backgroundcolor=blue,frame=off,bottomframe=on,topframe=on,framecolor=white] +% % \setupTABLE [y] [first][background=color,backgroundcolor=blue,frame=off,bottomframe=on,topframe=on,framecolor=white] % \setupTABLE [first][first][backgroundcorner=2,corner=10,frame=on] % \setupTABLE [last] [first][backgroundcorner=4,corner=12,frame=on] - +% % \setupTABLE [row] [each] [background=color,backgroundcolor=blue,frame=on,framecolor=white] % \setupTABLE [first][2] [corner=8] % \setupTABLE [last] [2] [corner=5] % \setupTABLE [first][last] [corner=7] % \setupTABLE [last] [last] [corner=6] - +% % \startTEXpage % \bTABLE[frame=off,align=middle] % \bTR \bTD one \eTD \bTD two \eTD \bTD three \eTD \eTR @@ -272,6 +272,16 @@ % \bTR \bTD alpha \eTD \bTD beta \eTD \bTD gamma \eTD \eTR % \eTABLE % \stopTEXpage +% +% \setupTABLE [first] [two][corner=2] % special case +% \setupTABLE [last] [two][corner=4] % special case +% +% \startTEXpage +% \bTABLE[frame=off,align=middle] +% \bTR \bTD one \eTD \bTD two \eTD \bTD three \eTD \eTR +% \bTR \bTD first \eTD \bTD second \eTD \bTD third \eTD \eTR +% \eTABLE +% \stopTEXpage \def\setupTBLcell#1#2% cell over col over row {\setupTBLsection % already forgotten @@ -325,6 +335,15 @@ \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\plusone \csname\@@tblprefix\c!x\v!first\c!y\v!last\endcsname \fi\fi + % special case: two rows and last row : two&first and two&last (round corners) + \ifnum\maximumrow=\plustwo\relax + \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\plusone + \csname\@@tblprefix\c!x\v!first\c!y\v!two\endcsname + \fi\fi + \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\maximumcol\relax + \csname\@@tblprefix\c!x\v!last\c!y\v!two\endcsname + \fi\fi + \fi % header things \ifnum#1>\noftblhdnxlines\else \executeifdefined{\@@tblprefix\v!header\v!each }\donothing diff --git a/tex/context/base/enco-pfr.tex b/tex/context/base/enco-pfr.tex index 52069bfe9..199d48fd3 100644 --- a/tex/context/base/enco-pfr.tex +++ b/tex/context/base/enco-pfr.tex @@ -212,6 +212,7 @@ \edef\currentencoding{#1}% \doifvaluesomething\pdffontfileresource {\startreadingfile + \ignorelines % just in case \par is redefined; this thing can get called anywhere \readsysfile{pdfr-\getvalue\pdffontfileresource}\donothing\donothing \stopreadingfile \letgvalue\pdffontfileresource\empty}% diff --git a/tex/context/base/enco-uc.tex b/tex/context/base/enco-uc.tex index fb709c82d..981eb6ae4 100644 --- a/tex/context/base/enco-uc.tex +++ b/tex/context/base/enco-uc.tex @@ -303,6 +303,27 @@ \stopencoding +%D Mojca's and Taco's additions: + +\startencoding[uc] + +\definecharacter textasciicircum {\uchar{0}{94}} % 5e +\definecharacter textgrave {\uchar{0}{96}} % 60 +\definecharacter textdiaeresis {\uchar{0}{168}} % a8 +%definecharacter textmacron {\uchar{0}{175}} % af +%definecharacter textacute {\uchar{0}{180}} % b4 +%definecharacter textcedilla {\uchar{0}{184}} % b8 +\definecharacter textcircumflex {\uchar{2}{198}} % c6 +\definecharacter textcaron {\uchar{2}{199}} % c7 +\definecharacter textbreve {\uchar{2}{216}} % d8 +\definecharacter textdotaccent {\uchar{2}{217}} % d9 +\definecharacter textring {\uchar{2}{218}} % da +\definecharacter textogonek {\uchar{2}{219}} % db +\definecharacter texttilde {\uchar{2}{220}} % dc +\definecharacter texthungarumlaut {\uchar{2}{221}} % dd + +\stopencoding + %D Vietnamese: \startencoding[uc] diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml index 76921ca29..8d8e2d891 100644 --- a/tex/context/interface/keys-cz.xml +++ b/tex/context/interface/keys-cz.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.12.17 17:41"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.12.20 23:52"> <cd:variables> <cd:variable name="one" value="jedna"/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 87c6b7502..150127d86 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.12.17 17:41"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.12.20 23:52"> <cd:variables> <cd:variable name="one" value="eins"/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 73261669a..124fcfac0 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.12.17 17:41"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.12.20 23:52"> <cd:variables> <cd:variable name="one" value="one"/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index c73b9cf0f..056b2481e 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.12.17 17:41"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.12.20 23:52"> <cd:variables> <cd:variable name="one" value="un"/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 1da846dca..f7f399d46 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.12.17 17:41"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.12.20 23:52"> <cd:variables> <cd:variable name="one" value="uno"/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 57218ce99..7bbd6244b 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.12.17 17:41"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.12.20 23:52"> <cd:variables> <cd:variable name="one" value="een"/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index a2073c157..4f0be3252 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.12.17 17:41"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.12.20 23:52"> <cd:variables> <cd:variable name="one" value="unu"/> |