diff options
-rw-r--r-- | metapost/context/base/mp-tool.mp | 2 | ||||
-rw-r--r-- | scripts/context/ruby/base/state.rb | 2 | ||||
-rw-r--r-- | scripts/context/ruby/base/tex.rb | 27 | ||||
-rw-r--r-- | scripts/context/ruby/ctxtools.rb | 112 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/core-mis.tex | 2 | ||||
-rw-r--r-- | tex/context/base/core-ver.tex | 37 | ||||
-rw-r--r-- | tex/context/base/math-tex.tex | 2 | ||||
-rw-r--r-- | tex/context/base/supp-mat.tex | 2 | ||||
-rw-r--r-- | tex/context/base/supp-vis.tex | 14 | ||||
-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-it.xml | 2 | ||||
-rw-r--r-- | tex/context/interface/keys-nl.xml | 2 | ||||
-rw-r--r-- | tex/context/interface/keys-ro.xml | 2 |
16 files changed, 154 insertions, 60 deletions
diff --git a/metapost/context/base/mp-tool.mp b/metapost/context/base/mp-tool.mp index 925b9ca44..ab98fbd23 100644 --- a/metapost/context/base/mp-tool.mp +++ b/metapost/context/base/mp-tool.mp @@ -994,6 +994,7 @@ enddef ; vardef arrowheadonpath (expr p, s) = save autoarrows ; boolean autoarrows ; autoarrows := true ; + set_ahlength(scaled ahfactor) ; % added arrowhead p if s<1 : cutafter (point (s*arclength(p)+.5ahlength) on p) fi enddef ; @@ -1204,7 +1205,6 @@ enddef ; vardef pointarrow (expr pat, loc, len, off) = save l, r, s, t ; path l, r ; numeric s ; pair t ; t := if pair loc : loc else : point loc along pat fi ; -% draw t withpen pencircle scaled 10 withcolor .5white ; s := len/2 - off ; if s<=0 : s := 0 elseif s>len : s := len fi ; r := pat cutbefore t ; r := (r cutafter point (arctime s of r) of r) ; diff --git a/scripts/context/ruby/base/state.rb b/scripts/context/ruby/base/state.rb index f57231592..4b2088128 100644 --- a/scripts/context/ruby/base/state.rb +++ b/scripts/context/ruby/base/state.rb @@ -56,7 +56,7 @@ class FileState sum = '' begin if FileTest.file?(filename) && (data = IO.read(filename)) then - data.gsub!(/\n.*?(#{[omit].flatten.join('|')}).*?\n/ms,"\n") if omit + data.gsub!(/\n.*?(#{[omit].flatten.join('|')}).*?\n/) do "\n" end if omit sum = MD5.new(data).hexdigest.upcase end rescue diff --git a/scripts/context/ruby/base/tex.rb b/scripts/context/ruby/base/tex.rb index 2654c4732..a8a200b72 100644 --- a/scripts/context/ruby/base/tex.rb +++ b/scripts/context/ruby/base/tex.rb @@ -771,7 +771,7 @@ class TEX end def makestubfile(rawname,forcexml=false) - if tmp = File.open(File.suffixed(rawname,'run'),'w') then + if tmp = openedfile(File.suffixed(rawname,'run')) then tmp << "\\starttext\n" if forcexml then if FileTest.file?(rawname) && (xml = File.open(rawname)) then @@ -1361,13 +1361,15 @@ class TEX mpdata.gsub!(/^\#.*\n/o,'') File.silentrename(mpfile,mpcopy) texfound = mergebe || mpdata =~ /btex .*? etex/o - if mp = File.silentopen(mpfile,'w') then + if mp = openedfile(mpfile) then mpdata.gsub!(/(btex.*?)\;(.*?etex)/o) do "#{$1}@@@#{$2}" end - mpdata.gsub!(/(\".*?)\;(.*?\")/o) do "#{$1}@@@#{$2}" end + # mpdata.gsub!(/(\".*?)\;(.*?\")/o) do "#{$1}@@@#{$2}" end + mpdata.gsub!(/(\".*?\")/o) do "#{$1.gsub(/\;/o,'@@@')}" end mpdata.gsub!(/\;/o, "\;\n") - mpdata.gsub!(/\n+/o, "\n") - mpdata.gsub!(/(btex.*?)@@@(.*?etex)/o) do "#{$1}\;#{$2}" end - mpdata.gsub!(/(\".*?)@@@(.*?\")/o) do "#{$1};#{$2}" end + # mpdata.gsub!(/\n+/o, "\n") + # mpdata.gsub!(/(btex.*?)\@\@\@(.*?etex)/o) do "#{$1}\;#{$2}" end + # mpdata.gsub!(/(\".*?)\@\@\@(.*?\")/mo) do "#{$1};#{$2}" end + mpdata.gsub!(/\@\@\@/o) do ";" end if mergebe then mpdata.gsub!(/beginfig\s*\((\d+)\)\s*\;(.*?)endfig\s*\;/o) do n, str = $1, $2 @@ -1451,12 +1453,12 @@ class TEX mponame = File.suffixed(mpname,'mpo') mpyname = File.suffixed(mpname,'mpy') return false unless File.atleast?(mponame,32) - mpochecksum = State.new.checksum(mponame) + mpochecksum = FileState.new.checksum(mponame) return false if mpochecksum.empty? # where does the checksum get into the file? # maybe let texexec do it? # solution: add one if not present or update when different - if f = File.open(mpyname) then + if f = File.silentopen(mpyname) then str = f.gets.chomp f.close if str =~ /^\%\s*mpochecksum\s*\:\s*(\d+)/o then @@ -1469,15 +1471,12 @@ class TEX def checkmplabels(mpname) mpname = File.suffixed(mpname,'mpt') - if File.atleast?(mpname,10) && (mp = File.open(mpname)) then + if File.atleast?(mpname,10) && (mp = File.silentopen(mpname)) then labels = Hash.new while str = mp.gets do - if str =~ /%\s*setup\s*:\s*(.*)/o then - t = $1 - else - t = '' - end + t = if str =~ /%\s*setup\s*:\s*(.*)/o then $1 else '' end if str =~ /%\s*figure\s*(\d+)\s*:\s*(.*)/o then + labels[$1] = labels[$1] || '' unless t.empty? then labels[$1] += "#{t}\n" t = '' diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index 41489a13d..7e1b6fa7a 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -17,7 +17,7 @@ # # todo: move kpse call to kpse class/module -banner = ['CtxTools', 'version 1.2.2', '2004/2005', 'PRAGMA ADE/POD'] +banner = ['CtxTools', 'version 1.3.0', '2004/2005', 'PRAGMA ADE/POD'] unless defined? ownpath ownpath = $0.sub(/[\\\/][a-z0-9\-]*?\.rb/i,'') @@ -1322,6 +1322,114 @@ class Commands end +class Array + + def add_shebang(filename,program) + unless self[0] =~ /^\#!/ then + self.insert(0,"\#!/usr/env #{program}") + end + unless self[2] =~ /^\#.*?copyright\=/ then + self.insert(1,"\#") + self.insert(2,"\# copyright=pragma-ade readme=readme.pdf licence=cc-gpl") + self.insert(3,"") unless self[3].chomp.strip.empty? + self[2].gsub!(/ +/, ' ') + return true + else + return false + end + end + + def add_directive(filename,program) + unless self[0] =~ /^\%/ then + self.insert(0,"\% content=#{program}") + end + unless self[2] =~ /^\%.*?copyright\=/ then + self.insert(1,"\%") + if File.expand_path(filename) =~ /[\\\/](doc|manuals)[\\\/]/ then + self.insert(2,"\% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa") + else + self.insert(2,"\% copyright=pragma-ade readme=readme.pdf licence=cc-gpl") + end + self.insert(3,"") unless self[3].chomp.strip.empty? + self[0].gsub!(/ +/, ' ') + return true + else + return false + end + end + + def add_comment(filename) + if self[0] =~ /<\?xml.*?\?>/ && self[2] !~ /^<\!\-\-.*?copyright\=.*?\-\->/ then + self.insert(1,"") + if File.expand_path(filename) =~ /[\\\/](doc|manuals)[\\\/]/ then + self.insert(2,"<!-- copyright='pragma-ade' readme='readme.pdf' licence='cc-by-nc-sa' -->") + else + self.insert(2,"<!-- copyright='pragma-ade' readme='readme.pdf' licence='cc-gpl' -->") + end + self.insert(3,"") unless self[3].chomp.strip.empty? + return true + else + return false + end + end + +end + +class Commands + + include CommandBase + + def brandfiles + + force = @commandline.option("force") + files = @commandline.arguments # Dir.glob("**/*.*") + done = false + + files.each do |filename| + ok = false + begin + data = IO.readlines(filename) + case filename + when /\.rb$/ then + ok = data.add_shebang(filename,'ruby') + when /\.pl$/ then + ok = data.add_shebang(filename,'perl') + when /\.py$/ then + ok = data.add_shebang(filename,'python') + when /\.lua$/ then + ok = data.add_shebang(filename,'lua') + when /\.tex$/ then + ok = data.add_directive(filename,'tex') + when /\.mp$/ then + ok = data.add_directive(filename,'metapost') + when /\.mf$/ then + ok = data.add_directive(filename,'metafont') + when /\.(xml|xsl|fo|fx|rlx|rng|exa)$/ then + ok = data.add_comment(filename) + end + rescue + report("fatal error in processing #{filename}") # maybe this catches the mac problem taco reported + else + if ok then + report() + report(filename) + report() + for i in 0..4 do + report(' ' + data[i].chomp) + end + if force && f = File.open(filename,'w') then + f.puts data + f.close + end + done = true + end + end + end + report() if done + end + +end + class Commands include CommandBase @@ -1393,6 +1501,8 @@ commandline.registeraction('patternfiles', 'generate pattern files [--all --xml commandline.registeraction('dpxmapfiles', 'convert pdftex mapfiles to dvipdfmx [--force] [texmfroot]') commandline.registeraction('listentities', 'create doctype entity definition from enco-uc.tex') +commandline.registeraction('brandfiles', 'add context copyright notice [--force]') + commandline.registervalue('type','') commandline.registerflag('recurse') diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 45df4fdac..346c8c13e 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -31,7 +31,7 @@ %D 2004.8.30 the low level interface is english. Watch out and adapt %D your styles an modules. -\def\contextversion{2005.11.15} +\def\contextversion{2005.11.16} %D For those who want to use this: diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex index acd84554e..998c7eae6 100644 --- a/tex/context/base/core-mis.tex +++ b/tex/context/base/core-mis.tex @@ -1936,7 +1936,7 @@ \let\next\vbox \ExpandFirstAfter\processallactionsinset [\combinationparameter\c!location] - [ \v!top=>\let\next\depthonlybox, % \tbox, + [ \v!top=>\let\next\depthonlybox, % \tbox, \v!middle=>\let\next\halfwaybox]% \next{\copy0}% % we need to save the caption for a next alignment line diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex index 6c734cbb1..acb9ab40c 100644 --- a/tex/context/base/core-ver.tex +++ b/tex/context/base/core-ver.tex @@ -328,35 +328,12 @@ \ifx\scantokens\undefined\ascii\else\everyeof{\hskip-\spaceskip}\scantokens\expandafter{\ascii}\fi \egroup} -% bugged -% -% \bgroup -% \catcode`\[=\@@begingroup -% \catcode`\]=\@@endgroup -% \catcode`\{=\@@active -% \catcode`\}=\@@active -% \gdef\initializetypegrouping% -% [\catcode`\{=\@@active -% \catcode`\}=\@@endgroup % otherwise things go wrong ... -% \def\activerightargument% -% [\rightargument -% \egroup]% -% \def\activeleftargument% -% [\bgroup -% \leftargument %% this way TeXEdit can check: { -% \catcode`\}=\@@active % ... in alignments (tables) -% \let}=\activerightargument]% -% \let{=\activeleftargument]% %% this way TeXEdit can check: } -% \egroup -% -% ok: - \bgroup \catcode`\[=\@@begingroup \catcode`\]=\@@endgroup \catcode`\{=\@@active \catcode`\}=\@@active -\gdef\initializetypegrouping% +\gdef\initializetypegrouping [\ifnum\catcode`\{=\@@active \let\normalactivebgroup{% \let\normalactiveegroup}% @@ -366,17 +343,17 @@ \let\normalactivebgroup\leftargument \let\normalactiveegroup\rightargument \fi - \def\activeleftargument% + \def\activeleftargument [\bgroup + \catcode`\}=\@@active \let}\activerightargument - \normalactivebgroup - ]% - \def\activerightargument% + \normalactivebgroup]% + \def\activerightargument [\normalactiveegroup \egroup]% \let{=\activeleftargument - \let}=\egroup - ] + % not \let}=\egroup, otherwise things go wrong in alignments (???) + \catcode`\}=\@@endgroup] \egroup \bgroup diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex index 8b547d000..d2516bc62 100644 --- a/tex/context/base/math-tex.tex +++ b/tex/context/base/math-tex.tex @@ -466,7 +466,7 @@ \def\notsosqrt[#1]{\root#1\of} -\def\sqrt{\doifnextcharelse[\notsosqrt\normalsqrt} +\unexpanded\def\sqrt{\doifnextcharelse[\notsosqrt\normalsqrt} \def\PLAINbig {\@@dobig{0.85}} \def\PLAINBig {\@@dobig{1.15}} diff --git a/tex/context/base/supp-mat.tex b/tex/context/base/supp-mat.tex index 15ae7fdd8..54ff34f01 100644 --- a/tex/context/base/supp-mat.tex +++ b/tex/context/base/supp-mat.tex @@ -46,6 +46,8 @@ %D Which is implemented as: \def\mathematics#1{\relax\ifmmode#1\else$#1$\fi} % lookahead bug reported by brooks +\def\displaymath#1{\relax\ifmmode#1\else$$#1$$\fi} +\def\inlinemath #1{\relax\ifmmode#1\else$#1$\fi} \def\startmathmode {\ifmmode diff --git a/tex/context/base/supp-vis.tex b/tex/context/base/supp-vis.tex index 384bcd440..95cee5176 100644 --- a/tex/context/base/supp-vis.tex +++ b/tex/context/base/supp-vis.tex @@ -1742,8 +1742,11 @@ %D For those who want to manipulate the visual cues in detail, %D we have grouped them. +\newif\ifshowingcomposition % see later why we need this + \def\showfils - {\let\hss \ruledhss + {\showingcompositiontrue + \let\hss \ruledhss \let\hfil \ruledhfil \let\hfill \ruledhfill \let\hfilneg \ruledhfilneg @@ -1767,7 +1770,8 @@ \let\vfillneg \normalvfillneg} \def\showboxes - {\baselineruletrue + {\showingcompositiontrue + \baselineruletrue \let\hbox \ruledhbox \let\vbox \ruledvbox \let\vtop \ruledvtop @@ -1780,7 +1784,8 @@ \let\vcenter \normalvcenter} \def\showskips - {\let\hskip \ruledhskip + {\showingcompositiontrue + \let\hskip \ruledhskip \let\vskip \ruledvskip \let\kern \ruledkern \let\mskip \ruledmskip @@ -1798,7 +1803,8 @@ \let\vglue \normalvglue} \def\showpenalties - {\let\penalty \ruledpenalty} + {\showingcompositiontrue + \let\penalty \ruledpenalty} \def\dontshowpenalties {\let\penalty \normalpenalty} diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml index 12d7ebd82..3e86fa600 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="2005.11.15"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2005.11.16"> <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 a3833ce00..e81dc46f4 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="2005.11.15"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2005.11.16"> <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 9dcfe5b04..2965e0ef7 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="2005.11.15"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2005.11.16"> <cd:variables> <cd:variable name="one" value="one"/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 5c0fd2204..d89fec084 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="2005.11.15"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2005.11.16"> <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 5c32973b1..6350dc92d 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="2005.11.15"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2005.11.16"> <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 d92729fab..11482fae3 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="2005.11.15"> +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2005.11.16"> <cd:variables> <cd:variable name="one" value="unu"/> |