summaryrefslogtreecommitdiff
path: root/tex/context/modules
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/modules')
-rw-r--r--tex/context/modules/common/s-abbreviations-extras.tex56
-rw-r--r--tex/context/modules/common/s-abbreviations-logos.tex (renamed from tex/context/modules/common/s-abr-01.tex)224
-rw-r--r--tex/context/modules/common/s-abbreviations-mixed.mkiv (renamed from tex/context/modules/common/s-abr-04.tex)20
-rw-r--r--tex/context/modules/common/s-abbreviations-pseudocaps.mkiv30
-rw-r--r--tex/context/modules/common/s-abbreviations-smallcaps.mkiv31
-rw-r--r--tex/context/modules/common/s-abbreviations-words.mkiv (renamed from tex/context/modules/common/s-abr-03.tex)18
-rw-r--r--tex/context/modules/common/s-mod.ctx2
-rw-r--r--tex/context/modules/mkii/m-streams.mkii2
-rw-r--r--tex/context/modules/mkii/s-abr-01.mkii (renamed from tex/context/modules/mkiv/s-mod-00.mkiv)22
-rw-r--r--tex/context/modules/mkii/s-abr-02.mkii (renamed from tex/context/modules/common/s-abr-02.tex)19
-rw-r--r--tex/context/modules/mkiv/m-barcodes.mkiv11
-rw-r--r--tex/context/modules/mkiv/m-chart.lua662
-rw-r--r--tex/context/modules/mkiv/m-chart.mkvi212
-rw-r--r--tex/context/modules/mkiv/m-compatible.mkiv63
-rw-r--r--tex/context/modules/mkiv/m-cweb.mkiv1210
-rw-r--r--tex/context/modules/mkiv/m-database.mkiv2
-rw-r--r--tex/context/modules/mkiv/m-escrito.mkiv2
-rw-r--r--tex/context/modules/mkiv/m-markdown.mkiv2
-rw-r--r--tex/context/modules/mkiv/m-matrix.mkiv400
-rw-r--r--tex/context/modules/mkiv/m-media.mkiv30
-rw-r--r--tex/context/modules/mkiv/m-nodechart.mkvi2
-rw-r--r--tex/context/modules/mkiv/m-punk.mkiv5
-rw-r--r--tex/context/modules/mkiv/m-scite.mkiv270
-rw-r--r--tex/context/modules/mkiv/m-spreadsheet.mkiv2
-rw-r--r--tex/context/modules/mkiv/m-subsub.mkiv76
-rw-r--r--tex/context/modules/mkiv/m-three.mkiv72
-rw-r--r--tex/context/modules/mkiv/m-timing.mkiv2
-rw-r--r--tex/context/modules/mkiv/m-typesetting.mkiv191
-rw-r--r--tex/context/modules/mkiv/s-abbreviations-mixed.mkiv28
-rw-r--r--tex/context/modules/mkiv/s-abbreviations-pseudocaps.mkiv30
-rw-r--r--tex/context/modules/mkiv/s-abbreviations-smallcaps.mkiv31
-rw-r--r--tex/context/modules/mkiv/s-abbreviations-words.mkiv (renamed from tex/context/modules/mkiv/s-mod-02.mkiv)20
-rw-r--r--tex/context/modules/mkiv/s-article-basic.mkiv (renamed from tex/context/modules/mkiv/s-art-01.mkiv)17
-rw-r--r--tex/context/modules/mkiv/s-def-01.mkiv10
-rw-r--r--tex/context/modules/mkiv/s-domotica-settings.lua2
-rw-r--r--tex/context/modules/mkiv/s-evohome.mkiv295
-rw-r--r--tex/context/modules/mkiv/s-fnt-10.mkiv169
-rw-r--r--tex/context/modules/mkiv/s-fnt-21.mkiv64
-rw-r--r--tex/context/modules/mkiv/s-fonts-cjk.mkiv (renamed from tex/context/modules/mkiv/s-fnt-24.mkiv)10
-rw-r--r--tex/context/modules/mkiv/s-fonts-complete.mkiv160
-rw-r--r--tex/context/modules/mkiv/s-fonts-coverage.lua52
-rw-r--r--tex/context/modules/mkiv/s-fonts-coverage.mkiv1
-rw-r--r--tex/context/modules/mkiv/s-fonts-engines.mkiv196
-rw-r--r--tex/context/modules/mkiv/s-fonts-kerns.mkiv215
-rw-r--r--tex/context/modules/mkiv/s-fonts-ligatures.mkiv4
-rw-r--r--tex/context/modules/mkiv/s-fonts-steps.mkiv (renamed from tex/context/modules/mkiv/s-fnt-20.mkiv)65
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.mkiv27
-rw-r--r--tex/context/modules/mkiv/s-magazine-basic.mkiv (renamed from tex/context/modules/mkiv/s-mag-01.mkiv)2
-rw-r--r--tex/context/modules/mkiv/s-maps.mkiv (renamed from tex/context/modules/mkiv/s-map-10.mkiv)0
-rw-r--r--tex/context/modules/mkiv/s-math-characters.lua9
-rw-r--r--tex/context/modules/mkiv/s-math-ligatures.lua72
-rw-r--r--tex/context/modules/mkiv/s-math-ligatures.mkiv50
-rw-r--r--tex/context/modules/mkiv/s-math-repertoire.mkiv4
-rw-r--r--tex/context/modules/mkiv/s-module-basic.mkiv (renamed from tex/context/modules/mkiv/s-mod-01.mkiv)66
-rw-r--r--tex/context/modules/mkiv/s-pages-statistics.mkiv8
-rw-r--r--tex/context/modules/mkiv/s-pre-30.mkiv257
-rw-r--r--tex/context/modules/mkiv/s-present-lines.mkiv172
-rw-r--r--tex/context/modules/mkiv/s-present-original.mkiv2
-rw-r--r--tex/context/modules/mkiv/s-present-weird.mkiv (renamed from tex/context/modules/mkiv/s-pre-17.mkiv)138
-rw-r--r--tex/context/modules/mkiv/s-reg-01.mkiv60
-rw-r--r--tex/context/modules/mkiv/s-regimes-list.mkiv74
-rw-r--r--tex/context/modules/mkiv/s-setups-macros.mkiv203
-rw-r--r--tex/context/modules/mkiv/s-tugboat.mkiv681
-rw-r--r--tex/context/modules/mkiv/s-youless.mkiv228
-rw-r--r--tex/context/modules/mkiv/x-asciimath.lua50
-rw-r--r--tex/context/modules/mkiv/x-asciimath.mkiv1
-rw-r--r--tex/context/modules/mkiv/x-calcmath.lua1
-rw-r--r--tex/context/modules/mkiv/x-cals.lua4
-rw-r--r--tex/context/modules/mkiv/x-ct.lua2
-rw-r--r--tex/context/modules/mkiv/x-html.mkiv2
-rw-r--r--tex/context/modules/mkiv/x-ldx.lua2
-rw-r--r--tex/context/modules/mkiv/x-lmx-demo.mkiv143
-rw-r--r--tex/context/modules/mkiv/x-lmx-html.mkiv122
-rw-r--r--tex/context/modules/mkiv/x-mathml.lua4
-rw-r--r--tex/context/modules/mkiv/x-mathml.mkiv37
-rw-r--r--tex/context/modules/mkiv/x-setups-basics.mkiv249
-rw-r--r--tex/context/modules/mkiv/x-setups-overview.mkiv67
77 files changed, 5173 insertions, 2571 deletions
diff --git a/tex/context/modules/common/s-abbreviations-extras.tex b/tex/context/modules/common/s-abbreviations-extras.tex
new file mode 100644
index 000000000..7ee6e1553
--- /dev/null
+++ b/tex/context/modules/common/s-abbreviations-extras.tex
@@ -0,0 +1,56 @@
+%D \module
+%D [ file=s-abbrevations-extras.tex, % was: s-abr-01
+%D version=1996.01.01,
+%D title=\CONTEXT\ Style File,
+%D subtitle=General Abbreviated Extras,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[abbreviations-extras]
+
+\def\SystemSpecialA#1{$\langle\it#1\rangle$}
+\def\SystemSpecialB#1{{\tttf<#1>}}
+
+\unexpanded\def\CATCODE {\SystemSpecialA{catcode}}
+\unexpanded\def\CATCODES {\SystemSpecialA{catcodes}}
+\unexpanded\def\DIMENSION {\SystemSpecialA{dimension}}
+\unexpanded\def\DIMENSIONS {\SystemSpecialA{dimensions}}
+\unexpanded\def\COUNTER {\SystemSpecialA{counter}}
+\unexpanded\def\COUNTERS {\SystemSpecialA{counters}}
+\unexpanded\def\HBOX {\SystemSpecialA{hbox}}
+\unexpanded\def\HBOXES {\SystemSpecialA{hboxes}}
+\unexpanded\def\VBOX {\SystemSpecialA{vbox}}
+\unexpanded\def\VBOXES {\SystemSpecialA{vboxes}}
+\unexpanded\def\BOX {\SystemSpecialA{box}}
+\unexpanded\def\BOXES {\SystemSpecialA{boxes}}
+\unexpanded\def\TOKENLIST {\SystemSpecialA{token list}}
+\unexpanded\def\TOKENLISTS {\SystemSpecialA{token lists}}
+\unexpanded\def\NEWLINE {\SystemSpecialA{newline}}
+\unexpanded\def\SKIP {\SystemSpecialA{skip}}
+\unexpanded\def\SKIPS {\SystemSpecialA{skips}}
+\unexpanded\def\MUSKIP {\SystemSpecialA{muskip}}
+\unexpanded\def\MUSKIPS {\SystemSpecialA{muskips}}
+\unexpanded\def\MARK {\SystemSpecialA{mark}}
+\unexpanded\def\MARKS {\SystemSpecialA{marks}}
+
+\unexpanded\def\SPACE {\SystemSpecialB{space}}
+\unexpanded\def\EOF {\SystemSpecialB{eof}}
+\unexpanded\def\TAB {\SystemSpecialB{tab}}
+\unexpanded\def\NEWPAGE {\SystemSpecialB{newpage}}
+\unexpanded\def\NEWLINE {\SystemSpecialB{newline}}
+
+\unexpanded\def\LUWATEEKH {لُواتيخ} % kh ī t ā w [u] l
+\unexpanded\def\luwateekh {luwātīkh}
+
+\doifmodeelse {mkiv} {
+ \unexpanded\def\THANH{H\agrave n Th\ecircumflexacute\ Th\agrave nh}
+} {
+ \unexpanded\def\THANH{H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh}
+}
+
+\stopmodule
diff --git a/tex/context/modules/common/s-abr-01.tex b/tex/context/modules/common/s-abbreviations-logos.tex
index fd6c66419..f1966f544 100644
--- a/tex/context/modules/common/s-abr-01.tex
+++ b/tex/context/modules/common/s-abbreviations-logos.tex
@@ -1,8 +1,8 @@
%D \module
-%D [ file=s-abr-01,
+%D [ file=s-abbrevations-logos.tex, % was: s-abr-01
%D version=1996.01.01,
%D title=\CONTEXT\ Style File,
-%D subtitle=General Abbreviations 1,
+%D subtitle=General Abbreviated Logos,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
@@ -11,13 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\unprotect
-
-\setupsorting[logo][\c!style=\v!capital]
-
-\setupcapitals[\c!title=\v!no]
-
-\protect
+\startmodule[abbreviations-logos]
\logo [MKI] {MkI} % joke
\logo [MKII] {MkII}
@@ -31,52 +25,53 @@
\logo [MPII] {MpII}
\logo [MPIV] {MpIV}
-%logo [FGA] {fga}
-%logo [FGBBS] {fgbbs}
\logo [ACROBAT] {Acro\-bat}
-\logo [APA] {apa}
\logo [AFM] {afm}
-\logo [API] {api}
+\logo [AI] {ai}
\logo [ALEPH] {Aleph} % {\mathematics{\aleph}}
\logo [ALGOL] {ALGOL}
\logo [AMS] {ams}
\logo [AMSLATEX] {\AmSLaTeX}
\logo [AMSTEX] {\AmSTeX}
\logo [ANSI] {ansi}
-\logo [ARABTEX] {Arab\TeX}
+\logo [APA] {apa}
+\logo [API] {api}
+\logo [ARABTEX] {Arab\TeXsuffix}
\logo [ASCII] {ascii}
-\logo [ASCIITEX] {ascii\TeX}
\logo [ASCIIMATH] {AsciiMath}
-\logo [BACHOTEX] {Bacho\TeX}
-\logo [BIBTEX] {bib\TeX}
-\logo [MLBIBTEX] {MLbib\TeX}
+\logo [ASCIITEX] {ascii\TeXsuffix}
+\logo [BACHOTEX] {Bacho\TeXsuffix}
+\logo [BIBTEX] {bib\TeXsuffix}
\logo [BLUESKY] {BlueSky}
\logo [BMP] {bmp}
\logo [BSD] {bsd}
-\logo [CCODE] {C}
-\logo [CPLUSPLUS] {C\high{++}}
\logo [CALCMATH] {CalcMath}
-\logo [CLD] {cld}
+\logo [CCODE] {C}
\logo [CD] {cd}
-\logo [CPU] {cpu}
\logo [CDROM] {cdrom}
\logo [CID] {cid}
\logo [CJK] {cjk}
-\logo [CMR] {cmr}
\logo [CLD] {cld}
+\logo [CLD] {cld}
+\logo [CMR] {cmr}
\logo [CMYK] {cmyk}
+\logo [CNC] {cnc}
\logo [CODHOST] {CodHost}
\logo [CONTEXT] {\ConTeXt}
-\logo [CONTEXTWIKI] {\ConTeXt\ Wiki}
\logo [CONTEXTGROUP] {\ConTeXt\ Group}
+\logo [CONTEXTWIKI] {\ConTeXt\ Wiki}
+\logo [CPLUSPLUS] {C\high{++}}
+\logo [CPU] {cpu}
\logo [CSS] {css}
\logo [CTAN] {ctan}
\logo [CTXTOOLS] {ctxtools}
\logo [CWEB] {cweb}
-\logo [CSTUG] {cstug}
-\logo [DANTE] {Dante}
+\logo [DAC] {dac}
+\logo [DECTEN] {dec-10}
\logo [DISTILLER] {distiller}
-\logo [DRATEX] {Dra\TeX}
+\logo [DNA] {dna}
+\logo [DPI] {dpi}
+\logo [DRATEX] {Dra\TeXsuffix}
\logo [DSC] {dsc}
\logo [DTD] {dtd}
\logo [DTK] {dtk}
@@ -94,15 +89,15 @@
\logo [EC] {ec}
\logo [EIFFEL] {Eiffel}
\logo [EMACS] {emacs}
-\logo [EMTEX] {em\TeX}
+\logo [EMTEX] {em\TeXsuffix}
\logo [ENCODING] {enc}
-\logo [ENCTEX] {enc\TeX}
-\logo [EPUB] {ePub}
+\logo [ENCTEX] {enc\TeXsuffix}
\logo [EPS] {eps}
+\logo [EPUB] {ePub}
\logo [ETEX] {\eTeX}
-\logo [EUROBACHOTEX] {EuroBacho\TeX}
+\logo [EUROBACHOTEX] {EuroBacho\TeXsuffix}
\logo [EUROMATH] {EuroMath}
-\logo [EUROTEX] {Euro\TeX}
+\logo [EUROTEX] {Euro\TeXsuffix}
\logo [EXAMPLE] {eXaMpLe}
\logo [EXAMPLED] {exampled}
\logo [EXAMPLEQ] {exampleq}
@@ -110,14 +105,18 @@
\logo [EXAMPLET] {examplet}
\logo [EXAMPLEX] {examplex}
\logo [EXIMPLE] {eXiMpLe}
-\logo [FLAC] {flac}
\logo [FAQ] {faq}
\logo [FDF] {fdf}
+\logo [FFI] {ffi}
+%logo [FGA] {fga}
+%logo [FGBBS] {fgbbs}
+\logo [FLAC] {flac}
\logo [FONTFORGE] {FontForge}
\logo [FOXET] {foXet}
-\logo [FPTEX] {fp\TeX}
+\logo [FPTEX] {fp\TeXsuffix}
\logo [FREEBSD] {FreeBSD}
\logo [FTP] {ftp}
+\logo [GCC] {gcc}
\logo [GHOSTSCRIPT] {Ghost\-script}
\logo [GHOSTVIEW] {Ghost\-view}
\logo [GIF] {gif}
@@ -125,31 +124,30 @@
\logo [GNUPLOT] {gnuplot}
\logo [GS] {Ghost\-Script}
\logo [GUST] {Gust}
-\logo [GCC] {gcc}
-\logo [GWTEX] {gw\TeX}
+\logo [GWTEX] {gw\TeXsuffix}
\logo [HSB] {hsb} % ?
\logo [HSV] {hsv}
\logo [HTML] {html}
\logo [HTTP] {http}
+\logo [HTTPS] {https}
\logo [HZ] {hz}
\logo [IBM] {ibm}
\logo [IMAGEMAGICK] {ImageMagick}
-\logo [INITEX] {ini\TeX}
-\logo [INRSTEX] {inrs\TeX}
+\logo [INITEX] {ini\TeXsuffix}
+\logo [INRSTEX] {inrs\TeXsuffix}
\logo [IO] {io}
\logo [IRCNET] {IRCnet}
\logo [ISO] {iso}
\logo [JAVA] {Java}
\logo [JAVASCRIPT] {Java\-Script}
+\logo [JBIG] {jbig}
\logo [JPEG] {jpeg}
\logo [JPG] {jpg}
-\logo [JBIG] {jbig}
+\logo [JSON] {json}
\logo [KPATHSEA] {kpathsea}
\logo [KPSE] {kpse}
-\logo [KVM] {kvm}
\logo [KPSEWHICH] {kpsewhich}
-\logo [MKTEXLSR] {mktexlsr}
-\logo [MYSQL] {MySQL}
+\logo [KVM] {kvm}
\logo [LAMSTEX] {\LamSTeX}
\logo [LATEX] {\LaTeX}
\logo [LATEXTE] {\LaTeX2e}
@@ -157,61 +155,67 @@
\logo [LCD] {lcd}
\logo [LINUX] {linux}
\logo [LISP] {Lisp}
+\logo [LMX] {lmx}
\logo [LPEG] {lpeg}
\logo [LUA] {Lua}
\logo [LUAJIT] {LuaJIT}
-\logo [LUAJITTEX] {Luajit\TeX}
-\logo [LUATEX] {Lua\TeX}
+\logo [LUAJITTEX] {Luajit\TeXsuffix}
+\logo [LUATEX] {Lua\TeXsuffix}
\logo [LUATOOLS] {luatools}
-\logo [LMX] {lmx}
\logo [MACOSX] {MacOSX}
-\logo [MACROTEX] {Macro\TeX}
+\logo [MACROTEX] {Macro\TeXsuffix}
\logo [MAKEMPY] {MakeMPY}
\logo [MAPPING] {map}
\logo [MAPS] {Maps}
\logo [MATHML] {MathML}
\logo [METAFONT] {\MetaFont}
+\logo [METAFUN] {\MetaFun}
\logo [METAPOST] {\MetaPost}
-\logo [METATEX] {Meta\TeX}
-\logo [MIKTEX] {Mik\TeX}
-\logo [MINGW] {MingW}
-\logo [MLTEX] {ml\TeX}
+\logo [METATEX] {Meta\TeXsuffix}
\logo [METATYPE] {MetaType1}
+\logo [MICROSOFT] {Microsoft}
+\logo [MIKTEX] {Mik\TeXsuffix}
+\logo [MINGW] {MingW}
+\logo [MKTEXLSR] {mktexlsr}
+\logo [MLBIBTEX] {MLbib\TeXsuffix}
+\logo [MLTEX] {ml\TeXsuffix}
\logo [MODULA] {Modula}
\logo [MOV] {mov}
\logo [MPEG] {mpeg}
+\logo [MPLIB] {mplib}
\logo [MPS] {mps}
\logo [MPTOPDF] {mptopdf}
-\logo [MPLIB] {mplib}
\logo [MSDOS] {msdos}
-\logo [MICROSOFT] {Microsoft}
\logo [MSWINDOWS] {MS~Windows}
\logo [MSWORD] {MS~Word}
+\logo [MSEXCEL] {MS~Excel}
\logo [MTXRUN] {mtxrun}
\logo [MTXTOOLS] {mtxtools}
+\logo [MYSQL] {MySQL}
\logo [NETPBM] {NetPBM}
\logo [NTG] {ntg}
\logo [NTS] {nts}
+\logo [NGINX] {nginx}
\logo [OFM] {ofm}
\logo [OMEGA] {Omega}
\logo [OPENMATH] {OpenMath}
\logo [OPENTYPE] {OpenType}
\logo [OPI] {opi}
-\logo [OTEX] {Oriental \TeX}
+\logo [OTEX] {Oriental \TeXsuffix}
\logo [OTF] {otf}
\logo [OTP] {otp}
\logo [OVF] {ovf}
\logo [PASCAL] {Pascal}
-\logo [PCTEX] {pc\TeX}
-\logo [PFA] {pfa}
-\logo [PFB] {pfb}
+\logo [PCTEX] {pc\TeXsuffix}
\logo [PDF] {pdf}
-\logo [PDFETEX] {pdfe\TeX}
-\logo [PDFTEX] {pdf\TeX}
+\logo [PDFETEX] {pdfe\TeXsuffix}
+\logo [PDFTEX] {pdf\TeXsuffix}
\logo [PDFTOOLS] {pdftools}
\logo [PDFTOPS] {pdftops}
\logo [PERL] {Perl}
\logo [PERLTK] {Perl/Tk}
+\logo [PFA] {pfa}
+\logo [PFB] {pfb}
\logo [PICTEX] {\PiCTeX}
\logo [PK] {pk}
\logo [PLAIN] {Plain}
@@ -228,50 +232,56 @@
\logo [PSTOPAGE] {pstopage}
\logo [PSTOPDF] {pstopdf}
\logo [PSTRICKS] {pstricks}
+\logo [RAID] {raid}
\logo [RAM] {ram}
+\logo [RCA] {RCA}
\logo [READER] {Acro\-bat Reader}
\logo [RELAXNG] {Relax\kern.125emNG}
\logo [RGB] {rgb}
\logo [RLXTOOLS] {rlxtools}
\logo [RUBY] {Ruby}
+\logo [RSYNC] {Rsync}
\logo [SCITE] {SciTE}
\logo [SGML] {sgml}
\logo [SI] {si}
\logo [SQL] {sql}
\logo [SSD] {ssd}
-\logo [SVG] {svg}
\logo [STIX] {Stix}
\logo [SUMATRAPDF] {SumatraPDF}
+\logo [SVG] {svg}
+\logo [SVN] {svn}
\logo [SWIG] {swig}
\logo [SWIGLIB] {SwigLib}
+\logo [SYNCTEX] {Sync\TeX}
\logo [TABLE] {\TaBlE}
\logo [TCPIP] {tcp/ip}
-\logo [TDS] {tds} % no sc te
-\logo [TEI] {tei} % no sc te
-\logo [TETEX] {te\TeX} % no sc te
+\logo [TDS] {tds} % no sc te
+\logo [TEI] {tei} % no sc te
+\logo [TETEX] {te\TeXsuffix} % no sc te
\logo [TEX] {\TeX}
-\logo [TEXADRES] {\TeX adress}
-\logo [TEXBASE] {\TeX base}
-\logo [TEXEDIT] {\TeX edit}
-\logo [TEXEXEC] {\TeX exec}
-\logo [TEXFONT] {\TeX font}
-\logo [TEXFORM] {\TeX form}
-\logo [TEXLIVE] {\TeX Live}
-\logo [TEXLUA] {\TeX Lua}
+\logo [TEXADRES] {\TeXprefix adress}
+\logo [TEXBASE] {\TeXprefix base}
+\logo [TEXEDIT] {\TeXprefix edit}
+\logo [TEXEXEC] {\TeXprefix exec}
+\logo [TEXFONT] {\TeXprefix font}
+\logo [TEXFORM] {\TeXprefix form}
+\logo [TEXGYRE] {\TeX\ Gyre}
+\logo [TEXLIVE] {\TeXprefix Live}
+\logo [TEXLUA] {\TeXprefix Lua}
\logo [TEXMF] {texmf}
\logo [TEXMFSTART] {texmfstart}
\logo [TEXNL] {tex-nl}
-\logo [TEXSHOW] {\TeX show}
-\logo [TEXSPELL] {\TeX spell}
-\logo [TEXGYRE] {\TeX\ Gyre}
+\logo [TEXSHOW] {\TeXprefix show}
+\logo [TEXSPELL] {\TeXprefix spell}
\logo [TEXSYNC] {texsync}
\logo [TEXTMATE] {TextMate}
-\logo [TEXTOOLS] {\TeX tools}
-\logo [TEXUTIL] {\TeX util}
-\logo [TEXWORK] {\TeX work}
-\logo [TEXWORKS] {\TeX works}
-\logo [TEXXET] {\TeX\XeT} \def\XeT{XeT}
+\logo [TEXTOOLS] {\TeXprefix tools}
+\logo [TEXUTIL] {\TeXprefix util}
+\logo [TEXWORK] {\TeXprefix work}
+\logo [TEXWORKS] {\TeXprefix works}
+\logo [TEXXET] {\TeX\XeT} \def\XeT{XeT}
\logo [TFM] {tfm}
+\logo [THREED] {3D}
\logo [TIF] {tif}
\logo [TIFF] {tiff}
\logo [TIFFINFO] {tiffinfo}
@@ -292,10 +302,12 @@
\logo [URI] {uri}
\logo [URL] {url}
\logo [USA] {usa}
+\logo [USB] {usb}
\logo [USENET] {usenet}
\logo [UTF] {utf}
-\logo [USB] {usb}
+\logo [VAX] {vax}
\logo [VF] {vf}
+\logo [VMWARE] {VMWare}
\logo [WDT] {wdt}
\logo [WEB] {web}
\logo [WEBC] {web2c}
@@ -303,8 +315,8 @@
\logo [WINDOWS] {Windows}
\logo [WINNT] {WinNT}
\logo [WINNX] {Win9x}
-\logo [WWW] {www}
\logo [WTHREEC] {W3C}
+\logo [WWW] {www}
\logo [WYSIWYG] {wysiwyg}
\logo [XDVI] {Xdvi}
\logo [XETEX] {\XeTeX}
@@ -313,60 +325,16 @@
\logo [XINDY] {Xindy}
\logo [XITS] {Xits}
\logo [XML] {xml}
-\logo [XPATH] {xpath}
\logo [XMLTOOLS] {xmltools}
-\logo [XPDFETEX] {xpdfe\TeX}
+\logo [XPATH] {xpath}
+\logo [XPDFETEX] {xpdfe\TeXsuffix}
\logo [XSL] {xsl}
\logo [XSLFO] {xsl-fo}
\logo [XSLT] {xslt}
\logo [XSLTPROC] {xsltproc}
\logo [XYPIC] {XYPIC} % wrong logo
-\logo [VMWARE] {VMWare}
\logo [YandY] {y\&y}
+\logo [YOUTUBE] {YouTube}
\logo [ZIP] {zip}
-\def\METAFUN {\MetaFun}
-
-\logo [METAFUN] {\MetaFun}
-
-\def\SystemSpecialA#1{$\langle\it#1\rangle$}
-\def\SystemSpecialB#1{{\tttf<#1>}}
-
-\unexpanded\def\CATCODE {\SystemSpecialA{catcode}}
-\unexpanded\def\CATCODES {\SystemSpecialA{catcodes}}
-\unexpanded\def\DIMENSION {\SystemSpecialA{dimension}}
-\unexpanded\def\DIMENSIONS {\SystemSpecialA{dimensions}}
-\unexpanded\def\COUNTER {\SystemSpecialA{counter}}
-\unexpanded\def\COUNTERS {\SystemSpecialA{counters}}
-\unexpanded\def\HBOX {\SystemSpecialA{hbox}}
-\unexpanded\def\HBOXES {\SystemSpecialA{hboxes}}
-\unexpanded\def\VBOX {\SystemSpecialA{vbox}}
-\unexpanded\def\VBOXES {\SystemSpecialA{vboxes}}
-\unexpanded\def\BOX {\SystemSpecialA{box}}
-\unexpanded\def\BOXES {\SystemSpecialA{boxes}}
-\unexpanded\def\TOKENLIST {\SystemSpecialA{token list}}
-\unexpanded\def\TOKENLISTS {\SystemSpecialA{token lists}}
-\unexpanded\def\NEWLINE {\SystemSpecialA{newline}}
-\unexpanded\def\SKIP {\SystemSpecialA{skip}}
-\unexpanded\def\SKIPS {\SystemSpecialA{skips}}
-\unexpanded\def\MUSKIP {\SystemSpecialA{muskip}}
-\unexpanded\def\MUSKIPS {\SystemSpecialA{muskips}}
-\unexpanded\def\MARK {\SystemSpecialA{mark}}
-\unexpanded\def\MARKS {\SystemSpecialA{marks}}
-
-\unexpanded\def\SPACE {\SystemSpecialB{space}}
-\unexpanded\def\EOF {\SystemSpecialB{eof}}
-\unexpanded\def\TAB {\SystemSpecialB{tab}}
-\unexpanded\def\NEWPAGE {\SystemSpecialB{newpage}}
-\unexpanded\def\NEWLINE {\SystemSpecialB{newline}}
-
-\unexpanded\def\LUWATEEKH {لُواتيخ} % kh ī t ā w [u] l
-\unexpanded\def\luwateekh {luwātīkh}
-
-\doifmodeelse {mkiv} {
- \unexpanded\def\THANH{H\agrave n Th\ecircumflexacute\ Th\agrave nh}
-} {
- \unexpanded\def\THANH{H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh}
-}
-
-\endinput
+\stopmodule
diff --git a/tex/context/modules/common/s-abr-04.tex b/tex/context/modules/common/s-abbreviations-mixed.mkiv
index 23940b526..f7b2121d0 100644
--- a/tex/context/modules/common/s-abr-04.tex
+++ b/tex/context/modules/common/s-abbreviations-mixed.mkiv
@@ -1,8 +1,8 @@
%D \module
-%D [ file=s-abr-04,
+%D [ file= s-abbreviations-mixed, % was: s-abr-04
%D version=1996.01.01,
%D title=\CONTEXT\ Style File,
-%D subtitle=General Abbreviations 2,
+%D subtitle=General Abbreviations Mixed,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
@@ -11,14 +11,18 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\usemodule[abr-01]
-
\unprotect
-% \definealternativestyle [\v!mixed] [\font_style_pseudoMixedCapped] [\font_style_pseudoMixedCapped]
+\setupsorting
+ [logo]
+ [\c!style=\font_style_pseudoMixedCapped]
+
+\protect
+
+\startmodule[abbreviations-mixed]
-\setupsorting[logo][\c!style=\font_style_pseudoMixedCapped]
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
-% \setupcapitals[\c!title=\v!no]
+\stopmodule
-\protect \endinput
diff --git a/tex/context/modules/common/s-abbreviations-pseudocaps.mkiv b/tex/context/modules/common/s-abbreviations-pseudocaps.mkiv
new file mode 100644
index 000000000..fa8606a7b
--- /dev/null
+++ b/tex/context/modules/common/s-abbreviations-pseudocaps.mkiv
@@ -0,0 +1,30 @@
+%D \module
+%D [ file= s-abbreviations-pseudocaps, % was: s-abr-01
+%D version=1996.01.01,
+%D title=\CONTEXT\ Style File,
+%D subtitle=General Abbreviations Pseudocaps,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\setupsorting
+ [logo]
+ [\c!style=\v!capital]
+
+\setupcapitals
+ [\c!title=\v!no]
+
+\protect
+
+\startmodule[abbreviations-pseudocaps]
+
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
+
+\stopmodule
diff --git a/tex/context/modules/common/s-abbreviations-smallcaps.mkiv b/tex/context/modules/common/s-abbreviations-smallcaps.mkiv
new file mode 100644
index 000000000..2ce86ca33
--- /dev/null
+++ b/tex/context/modules/common/s-abbreviations-smallcaps.mkiv
@@ -0,0 +1,31 @@
+%D \module
+%D [ file= s-abbreviations-smallcaps, % was: s-abr-02
+%D version=1996.01.01,
+%D title=\CONTEXT\ Style File,
+%D subtitle=General Abbreviations Smallcaps,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\setupsorting
+ [logo]
+ [\c!style=\v!smallcaps]
+
+\setupcapitals
+ [\c!title=\v!no]
+
+\protect
+
+\startmodule[abbreviations-smallcaps]
+
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
+
+\stopmodule
+
diff --git a/tex/context/modules/common/s-abr-03.tex b/tex/context/modules/common/s-abbreviations-words.mkiv
index 8247b68a9..2b7d7cedc 100644
--- a/tex/context/modules/common/s-abr-03.tex
+++ b/tex/context/modules/common/s-abbreviations-words.mkiv
@@ -1,8 +1,8 @@
%D \module
-%D [ file=s-abr-03,
+%D [ file= s-abbreviations-words, % was: s-abr-32
%D version=1998.08.10,
%D title=\CONTEXT\ Style File,
-%D subtitle=General Abbreviations 3,
+%D subtitle=General Abbreviations Words,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
@@ -11,12 +11,18 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\usemodule[abr-01]
-
\unprotect
-\setupsorting[logo][\c!style=\v!WORD]
+\setupsorting
+ [logo]
+ [\c!style=\v!WORD]
\protect
-\endinput
+\startmodule[abbreviations-words]
+
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
+
+\stopmodule
+
diff --git a/tex/context/modules/common/s-mod.ctx b/tex/context/modules/common/s-mod.ctx
index 09ecf714c..0560c6cfb 100644
--- a/tex/context/modules/common/s-mod.ctx
+++ b/tex/context/modules/common/s-mod.ctx
@@ -17,7 +17,7 @@
</ctx:flags>
<ctx:process>
<ctx:resources>
- <ctx:module>mod-01</ctx:module>
+ <ctx:module>module-basic</ctx:module>
</ctx:resources>
</ctx:process>
</ctx:job>
diff --git a/tex/context/modules/mkii/m-streams.mkii b/tex/context/modules/mkii/m-streams.mkii
index a8589a89c..67ece4f66 100644
--- a/tex/context/modules/mkii/m-streams.mkii
+++ b/tex/context/modules/mkii/m-streams.mkii
@@ -1,3 +1,5 @@
+% engine=pdftex
+
%D \module
%D [ file=m-streams,
%D version=2006.03.21,
diff --git a/tex/context/modules/mkiv/s-mod-00.mkiv b/tex/context/modules/mkii/s-abr-01.mkii
index 7af56dc2d..6e147a701 100644
--- a/tex/context/modules/mkiv/s-mod-00.mkiv
+++ b/tex/context/modules/mkii/s-abr-01.mkii
@@ -1,8 +1,8 @@
%D \module
-%D [ file=s-mod-00,
-%D version=very-old,
+%D [ file=s-abr-01,
+%D version=1996.01.01,
%D title=\CONTEXT\ Style File,
-%D subtitle=Documentation Base Environment,
+%D subtitle=General Abbreviations 1,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
@@ -13,12 +13,18 @@
\unprotect
-\startmode[nocode]
+\setupsorting
+ [logo]
+ [\c!style=\v!capital]
- % \definieerbuffer[definition] % ignore
+\setupcapitals
+ [\c!title=\v!no]
- \def\startdefinition#1\stopdefinition{}
+\protect
-\stopmode
+\startmodule[abr-01]
-\protect \endinput
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
+
+\stopmodule
diff --git a/tex/context/modules/common/s-abr-02.tex b/tex/context/modules/mkii/s-abr-02.mkii
index 8bb6a2898..bf3265073 100644
--- a/tex/context/modules/common/s-abr-02.tex
+++ b/tex/context/modules/mkii/s-abr-02.mkii
@@ -11,12 +11,21 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\usemodule[abr-01]
-
\unprotect
-\setupsorting[logo][\c!style=\v!smallcaps]
+\setupsorting
+ [logo]
+ [\c!style=\v!smallcaps]
+
+\setupcapitals
+ [\c!title=\v!no]
+
+\protect
+
+\startmodule[abr-02]
+
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
-\setupcapitals[\c!title=\v!no]
+\stopmodule
-\protect \endinput
diff --git a/tex/context/modules/mkiv/m-barcodes.mkiv b/tex/context/modules/mkiv/m-barcodes.mkiv
index e4c43b376..84f093c56 100644
--- a/tex/context/modules/mkiv/m-barcodes.mkiv
+++ b/tex/context/modules/mkiv/m-barcodes.mkiv
@@ -13,6 +13,15 @@
\writestatus{barcodes}{the 'zint' module is a better choice}
+\usemodule[zint]
+
+\let\normalbarcode\barcode
+
+\unexpanded\def\barcode[#1]%
+ {\normalbarcode[\c!text=\dummyparameter\c!code,\c!alternative=\dummyparameter\c!type,#1]}
+
+\iffalse
+
% \startTEXpage
% \startPSTRICKS
% \pspicture(-4mm,-1mm)(38mm,26mm)
@@ -112,6 +121,8 @@ end
\directsetup{barcode:\getvariable{barcode}{type}}%
\egroup}
+\fi
+
\continueifinputfile{m-barcodes.mkiv}
\starttext
diff --git a/tex/context/modules/mkiv/m-chart.lua b/tex/context/modules/mkiv/m-chart.lua
index 5a9311387..bcf80bdfc 100644
--- a/tex/context/modules/mkiv/m-chart.lua
+++ b/tex/context/modules/mkiv/m-chart.lua
@@ -16,14 +16,22 @@ local type, tonumber, rawget, next = type, tonumber, rawget, next
local gsub, find, lower = string.gsub, string.find, string.lower
local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match
+local context = context
+
+local ctx_startgraphic = metapost.startgraphic
+local ctx_stopgraphic = metapost.stopgraphic
+local ctx_tographic = metapost.tographic
+
local formatters = string.formatters
local setmetatableindex = table.setmetatableindex
+local settings_to_hash = utilities.parsers.settings_to_hash
moduledata.charts = moduledata.charts or { }
local report_chart = logs.reporter("chart")
local variables = interfaces.variables
+local implement = interfaces.implement
local v_yes = variables.yes
local v_no = variables.no
@@ -171,22 +179,29 @@ local charts = { }
local data, hash, temp, last_x, last_y, name
-function commands.flow_start_chart(chartname)
- data = { }
- hash = { }
- last_x, last_y = 0, 0
- name = chartname
-end
+implement {
+ name = "flow_start_chart",
+ arguments = "string",
+ actions = function(chartname)
+ data = { }
+ hash = { }
+ last_x, last_y = 0, 0
+ name = chartname
+ end
+}
-function commands.flow_stop_chart()
- charts[name] = {
- data = data,
- hash = hash,
- last_x = last_x,
- last_y = last_y,
- }
- data, hash, temp = nil, nil, nil
-end
+implement {
+ name = "flow_stop_chart",
+ actions = function()
+ charts[name] = {
+ data = data,
+ hash = hash,
+ last_x = last_x,
+ last_y = last_y,
+ }
+ data, hash, temp = nil, nil, nil
+ end
+}
-- function commands.flow_set(chartname,chartdata)
-- local hash = { }
@@ -214,103 +229,187 @@ end
-- end
-- end
-function commands.flow_reset(chartname)
- charts[name] = nil
-end
+implement {
+ name = "flow_reset",
+ actions = function()
+ charts[name] = nil
+ end
+}
-function commands.flow_set_current_cell(n)
- temp = data[tonumber(n)] or { }
-end
+implement {
+ name = "flow_set_current_cell",
+ arguments = "integer",
+ actions = function(n)
+ temp = data[n] or { }
+ end
+}
-function commands.flow_start_cell(settings)
- temp = {
- texts = { },
- labels = { },
- exits = { },
- connections = { },
- settings = settings,
- x = 1,
- y = 1,
- realx = 1,
- realy = 1,
- name = "",
- }
-end
+implement {
+ name = "flow_start_cell",
+ arguments = {
+ {
+ { "shape", {
+ { "rulethickness", "dimension" },
+ { "default" },
+ { "framecolor" },
+ { "backgroundcolor" },
+ },
+ },
+ { "focus", {
+ { "rulethickness", "dimension" },
+ { "framecolor" },
+ { "backgroundcolor" },
+ },
+ },
+ { "line", {
+ { "rulethickness", "dimension" },
+ { "radius", "dimension" },
+ { "color" },
+ { "corner" },
+ { "dash" },
+ { "arrow" },
+ { "offset", "dimension" },
+ },
+ },
+ },
+ },
+ actions = function(settings)
+ temp = {
+ texts = { },
+ labels = { },
+ exits = { },
+ connections = { },
+ settings = settings,
+ x = 1,
+ y = 1,
+ realx = 1,
+ realy = 1,
+ name = "",
+ }
+ end
+}
-function commands.flow_stop_cell()
- data[#data+1] = temp
- hash[temp.name or #data] = temp
-end
+implement {
+ name = "flow_stop_cell",
+ actions = function()
+ data[#data+1] = temp
+ hash[temp.name or #data] = temp
+ end
+}
-function commands.flow_set_name(str)
- temp.name = str
-end
+implement {
+ name = "flow_set_name",
+ arguments = "string",
+ actions = function(str)
+ temp.name = str
+ end
+}
-function commands.flow_set_shape(str)
- temp.shape = str
-end
+implement {
+ name = "flow_set_shape",
+ arguments = "string",
+ actions = function(str)
+ temp.shape = str
+ end
+}
-function commands.flow_set_destination(str)
- temp.destination = str
-end
+implement {
+ name = "flow_set_destination",
+ arguments = "string",
+ actions = function(str)
+ temp.destination = str
+ end
+}
-function commands.flow_set_text(align,str)
- temp.texts[#temp.texts+1] = {
- align = align,
- text = str,
- }
-end
+implement {
+ name = "flow_set_text",
+ arguments = { "string", "string" },
+ actions = function(align,str)
+ temp.texts[#temp.texts+1] = {
+ align = align,
+ text = str,
+ }
+ end
+}
-function commands.flow_set_overlay(str)
- temp.overlay = str
-end
+implement {
+ name = "flow_set_overlay",
+ arguments = "string",
+ actions = function(str)
+ temp.overlay = str
+ end
+}
-function commands.flow_set_focus(str)
- temp.focus = str
-end
+implement {
+ name = "flow_set_focus",
+ arguments = "string",
+ actions = function(str)
+ temp.focus = str
+ end
+}
-function commands.flow_set_figure(str)
- temp.figure = str
-end
+implement {
+ name = "flow_set_figure",
+ arguments = "string",
+ actions = function(str)
+ temp.figure = str
+ end
+}
-function commands.flow_set_label(location,text)
- temp.labels[#temp.labels+1] = {
- location = location,
- text = text,
- }
-end
+implement {
+ name = "flow_set_label",
+ arguments = { "string", "string" },
+ actions = function(location,text)
+ temp.labels[#temp.labels+1] = {
+ location = location,
+ text = text,
+ }
+ end
+}
-function commands.flow_set_comment(location,text)
- local connections = temp.connections
- if connections then
- local connection = connections[#connections]
- if connection then
- local comments = connection.comments
- if comments then
- comments[#comments+1] = {
- location = location,
- text = text,
- }
+implement {
+ name = "flow_set_comment",
+ arguments = { "string", "string" },
+ actions = function(location,text)
+ local connections = temp.connections
+ if connections then
+ local connection = connections[#connections]
+ if connection then
+ local comments = connection.comments
+ if comments then
+ comments[#comments+1] = {
+ location = location,
+ text = text,
+ }
+ end
end
end
end
-end
+}
-function commands.flow_set_exit(location,text)
- temp.exits[#temp.exits+1] = {
- location = location,
- text = text,
- }
-end
+implement {
+ name = "flow_set_exit",
+ arguments = { "string", "string" },
+ actions = function(location,text)
+ temp.exits[#temp.exits+1] = {
+ location = location,
+ text = text,
+ }
+ end
+}
-function commands.flow_set_include(name,x,y,settings)
- data[#data+1] = {
- include = name,
- x = x,
- y = y,
- -- settings = settings,
- }
-end
+implement {
+ name = "flow_set_include",
+ arguments = { "string", "integer", "integer", "string" },
+ actions = function(name,x,y,settings)
+ data[#data+1] = {
+ include = name,
+ x = x,
+ y = y,
+ -- settings = settings,
+ }
+ end
+}
local function inject(includedata,data,hash)
local subchart = charts[includedata.include]
@@ -429,66 +528,74 @@ end
local splitter = lpeg.splitat(",")
-function commands.flow_set_location(x,y)
- if type(x) == "string" and not y then
- x, y = lpegmatch(splitter,x)
- end
- local oldx, oldy = x, y
- if not x or x == "" then
- x = last_x
- elseif type(x) == "number" then
- -- ok
- elseif x == "+" then
- x = last_x + 1
- elseif x == "-" then
- x = last_x - 1
- elseif find(x,"^[%+%-]") then
- x = last_x + (tonumber(x) or 0)
- else
- x = tonumber(x)
- end
- if not y or y == "" then
- y = last_y
- elseif type(y) == "number" then
- -- ok
- elseif y == "+" then
- y = last_y + 1
- elseif x == "-" then
- y = last_y - 1
- elseif find(y,"^[%+%-]") then
- y = last_y + (tonumber(y) or 0)
- else
- y = tonumber(y)
- end
- if x < 1 or y < 1 then
- report_chart("the cell (%s,%s) ends up at (%s,%s) and gets relocated to (1,1)",oldx or"?", oldy or "?", x,y)
- if x < 1 then
- x = 1
+implement {
+ name = "flow_set_location",
+ arguments = "string",
+ actions = function(x,y)
+ if type(x) == "string" and not y then
+ x, y = lpegmatch(splitter,x)
+ end
+ local oldx, oldy = x, y
+ if not x or x == "" then
+ x = last_x
+ elseif type(x) == "number" then
+ -- ok
+ elseif x == "+" then
+ x = last_x + 1
+ elseif x == "-" then
+ x = last_x - 1
+ elseif find(x,"^[%+%-]") then
+ x = last_x + (tonumber(x) or 0)
+ else
+ x = tonumber(x)
end
- if y < 1 then
- y = 1
+ if not y or y == "" then
+ y = last_y
+ elseif type(y) == "number" then
+ -- ok
+ elseif y == "+" then
+ y = last_y + 1
+ elseif x == "-" then
+ y = last_y - 1
+ elseif find(y,"^[%+%-]") then
+ y = last_y + (tonumber(y) or 0)
+ else
+ y = tonumber(y)
+ end
+ if x < 1 or y < 1 then
+ report_chart("the cell (%s,%s) ends up at (%s,%s) and gets relocated to (1,1)",oldx or"?", oldy or "?", x,y)
+ if x < 1 then
+ x = 1
+ end
+ if y < 1 then
+ y = 1
+ end
end
+ temp.x = x or 1
+ temp.y = y or 1
+ temp.realx = x or 1
+ temp.realy = y or 1
+ last_x = x or last_x
+ last_y = y or last_y
end
- temp.x = x or 1
- temp.y = y or 1
- temp.realx = x or 1
- temp.realy = y or 1
- last_x = x or last_x
- last_y = y or last_y
-end
+}
-function commands.flow_set_connection(location,displacement,name)
- local dx, dy = lpegmatch(splitter,displacement)
- dx = tonumber(dx)
- dy = tonumber(dy)
- temp.connections[#temp.connections+1] = {
- location = location,
- dx = dx or 0,
- dy = dy or 0,
- name = name,
- comments = { },
- }
-end
+implement {
+ name = "flow_set_connection",
+ arguments = { "string", "string", "string" },
+ actions = function(location,displacement,name)
+ local dx, dy = lpegmatch(splitter,displacement)
+ dx = tonumber(dx)
+ dy = tonumber(dy)
+ temp.connections[#temp.connections+1] = {
+ location = location,
+ dx = dx or 0,
+ dy = dy or 0,
+ name = name,
+ comments = { },
+ }
+ end
+}
local function visible(chart,cell)
local x, y = cell.x, cell.y
@@ -497,12 +604,12 @@ local function visible(chart,cell)
y >= chart.from_y and y <= chart.to_y and cell
end
-local function process_cells(chart,xoffset,yoffset)
+local function process_cells(g,chart,xoffset,yoffset)
local data = chart.data
if not data then
return
end
- local focus = utilities.parsers.settings_to_hash(chart.settings.chart.focus or "")
+ local focus = settings_to_hash(chart.settings.chart.focus or "")
for i=1,#data do
local cell = visible(chart,data[i])
if cell then
@@ -514,26 +621,26 @@ local function process_cells(chart,xoffset,yoffset)
end
if shape ~= v_none then
local shapedata = validshapes[shape]
- context("flow_begin_sub_chart ;") -- when is this needed
+ ctx_tographic(g,"flow_begin_sub_chart ;") -- when is this needed
if shapedata.kind == "line" then
local linesettings = settings.line
- context("flow_shape_line_color := \\MPcolor{%s} ;", linesettings.color)
- context("flow_shape_fill_color := black ;")
- context("flow_shape_line_width := %p ; ", linesettings.rulethickness)
+ ctx_tographic(g,"flow_shape_line_color := %q ;", linesettings.color)
+ ctx_tographic(g,"flow_shape_fill_color := %q ;","black")
+ ctx_tographic(g,"flow_shape_line_width := %p ; ",linesettings.rulethickness)
elseif focus[cell.focus] or focus[cell.name] then
local focussettings = settings.focus
- context("flow_shape_line_color := \\MPcolor{%s} ;", focussettings.framecolor)
- context("flow_shape_fill_color := \\MPcolor{%s} ;", focussettings.backgroundcolor)
- context("flow_shape_line_width := %p ; ", focussettings.rulethickness)
+ ctx_tographic(g,"flow_shape_line_color := %q ;", focussettings.framecolor)
+ ctx_tographic(g,"flow_shape_fill_color := %q ;", focussettings.backgroundcolor)
+ ctx_tographic(g,"flow_shape_line_width := %p ; ",focussettings.rulethickness)
else
local shapesettings = settings.shape
- context("flow_shape_line_color := \\MPcolor{%s} ;", shapesettings.framecolor)
- context("flow_shape_fill_color := \\MPcolor{%s} ;", shapesettings.backgroundcolor)
- context("flow_shape_line_width := %p ; " , shapesettings.rulethickness)
+ ctx_tographic(g,"flow_shape_line_color := %q ;", shapesettings.framecolor)
+ ctx_tographic(g,"flow_shape_fill_color := %q ;", shapesettings.backgroundcolor)
+ ctx_tographic(g,"flow_shape_line_width := %p ; ",shapesettings.rulethickness)
end
- context("flow_peepshape := false ;") -- todo
- context("flow_new_shape(%s,%s,%s) ;",cell.x+xoffset,cell.y+yoffset,shapedata.number)
- context("flow_end_sub_chart ;")
+ ctx_tographic(g,"flow_peepshape := false ;") -- todo
+ ctx_tographic(g,"flow_new_shape(%s,%s,%s) ;",cell.x+xoffset,cell.y+yoffset,shapedata.number)
+ ctx_tographic(g,"flow_end_sub_chart ;")
end
end
end
@@ -572,7 +679,7 @@ local what = space
-- print(lpegmatch(what,"+l"))
-- print(lpegmatch(what,"+ left+r "))
-local function process_connections(chart,xoffset,yoffset)
+local function process_connections(g,chart,xoffset,yoffset)
local data = chart.data
local hash = chart.hash
if not data then
@@ -581,7 +688,6 @@ local function process_connections(chart,xoffset,yoffset)
local settings = chart.settings
for i=1,#data do
local cell = visible(chart,data[i])
--- local cell = data[i]
if cell then
local connections = cell.connections
for j=1,#connections do
@@ -595,15 +701,15 @@ local function process_connections(chart,xoffset,yoffset)
local what_cell, where_cell, what_other, where_other = lpegmatch(what,location)
if what_cell and where_cell and what_other and where_other then
local linesettings = settings.line
- context("flow_smooth := %s ;", linesettings.corner == v_round and "true" or "false")
- context("flow_dashline := %s ;", linesettings.dash == v_yes and "true" or "false")
- context("flow_arrowtip := %s ;", linesettings.arrow == v_yes and "true" or "false")
- context("flow_touchshape := %s ;", linesettings.offset == v_none and "true" or "false")
- context("flow_dsp_x := %s ; flow_dsp_y := %s ;",connection.dx or 0, connection.dy or 0)
- context("flow_connection_line_color := \\MPcolor{%s} ;",linesettings.color)
- context("flow_connection_line_width := %p ;",linesettings.rulethickness)
- context("flow_connect_%s_%s (%s) (%s,%s,%s) (%s,%s,%s) ;",where_cell,where_other,j,cellx,celly,what_cell,otherx,othery,what_other)
- context("flow_dsp_x := 0 ; flow_dsp_y := 0 ;")
+ ctx_tographic(g,"flow_smooth := %s ;", linesettings.corner == v_round and "true" or "false")
+ ctx_tographic(g,"flow_dashline := %s ;", linesettings.dash == v_yes and "true" or "false")
+ ctx_tographic(g,"flow_arrowtip := %s ;", linesettings.arrow == v_yes and "true" or "false")
+ ctx_tographic(g,"flow_touchshape := %s ;", linesettings.offset == v_none and "true" or "false")
+ ctx_tographic(g,"flow_dsp_x := %s ; flow_dsp_y := %s ;",connection.dx or 0, connection.dy or 0)
+ ctx_tographic(g,"flow_connection_line_color := %q ;",linesettings.color)
+ ctx_tographic(g,"flow_connection_line_width := %p ;",linesettings.rulethickness)
+ ctx_tographic(g,"flow_connect_%s_%s (%s) (%s,%s,%s) (%s,%s,%s) ;",where_cell,where_other,j,cellx,celly,what_cell,otherx,othery,what_other)
+ ctx_tographic(g,"flow_dsp_x := 0 ; flow_dsp_y := 0 ;")
end
end
end
@@ -618,13 +724,17 @@ local f_texttemplate_l = formatters["\\doFLOWlabel{%i}{%i}{%i}"]
local splitter = lpeg.splitat(":")
local charttexts = { } -- permits " etc in mp
-function commands.flow_get_text(n)
- if n > 0 then
- context(charttexts[n])
+implement {
+ name = "flow_get_text",
+ arguments = "integer",
+ actions = function(n)
+ if n > 0 then
+ context(charttexts[n])
+ end
end
-end
+}
-local function process_texts(chart,xoffset,yoffset)
+local function process_texts(g,chart,xoffset,yoffset)
local data = chart.data
local hash = chart.hash
if not data then
@@ -648,7 +758,7 @@ local function process_texts(chart,xoffset,yoffset)
local align = text.align or ""
local align = validlabellocations[align] or align
charttexts[#charttexts+1] = data
- context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,#charttexts,align,figure,overlay,destination))
+ ctx_tographic(g,'flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,#charttexts,align,figure,overlay,destination))
if i == 1 then
figure = ""
overlay = ""
@@ -656,7 +766,7 @@ local function process_texts(chart,xoffset,yoffset)
end
end
elseif figure ~= "" or overlay ~= "" or destination ~= "" then
- context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,0,"",figure,overlay,destination))
+ ctx_tographic(g,'flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,0,"",figure,overlay,destination))
end
local labels = cell.labels
for i=1,#labels do
@@ -666,7 +776,7 @@ local function process_texts(chart,xoffset,yoffset)
local location = validlabellocations[location] or location
if text and text ~= "" then
charttexts[#charttexts+1] = text
- context('flow_chart_draw_label(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts))
+ ctx_tographic(g,'flow_chart_draw_label(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts))
end
end
local exits = cell.exits
@@ -682,7 +792,7 @@ local function process_texts(chart,xoffset,yoffset)
location == "t" and y == chart.to_y - 1 or
location == "b" and y == chart.from_y + 1 then
charttexts[#charttexts+1] = text
- context('flow_chart_draw_exit(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts))
+ ctx_tographic(g,'flow_chart_draw_exit(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts))
end
end
end
@@ -711,7 +821,7 @@ local function process_texts(chart,xoffset,yoffset)
end
if text and text ~= "" then
charttexts[#charttexts+1] = text
- context('flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("%s")) ;',x,y,i,location,length,f_texttemplate_l(x,y,#charttexts))
+ ctx_tographic(g,'flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("%s")) ;',x,y,i,location,length,f_texttemplate_l(x,y,#charttexts))
end
end
end
@@ -738,7 +848,7 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny)
local chartsettings = chart.settings.chart
local autofocus = chart.settings.chart.autofocus
if autofocus then
- autofocus = utilities.parsers.settings_to_hash(autofocus)
+ autofocus = settings_to_hash(autofocus)
if not next(autofocus) then
autofocus = false
end
@@ -762,17 +872,15 @@ local function getchart(settings,forced_x,forced_y,forced_nx,forced_ny)
if miny == 0 or y > maxy then maxy = y end
end
end
--- optional:
-if x + nx > maxx then
- nx = maxx - x + 1
-end
-if y + ny > maxy then
- ny = maxy - y + 1
-end
+ -- optional:
+ if x + nx > maxx then
+ nx = maxx - x + 1
+ end
+ if y + ny > maxy then
+ ny = maxy - y + 1
+ end
--
- -- print("1>",x,y,nx,ny)
- -- print("2>",minx, miny, maxx, maxy)
- -- check of window should be larger (maybe autofocus + nx/ny?)
+ -- check if window should be larger (maybe autofocus + nx/ny?)
if autofocus then
-- x and y are ignored
if nx and nx > 0 then
@@ -825,21 +933,27 @@ local function makechart(chart)
context.begingroup()
context.forgetall()
--
- context.startMPcode()
- context("if unknown context_flow : input mp-char.mpiv ; fi ;")
- context("flow_begin_chart(0,%s,%s);",chart.nx,chart.ny)
+ local g = ctx_startgraphic {
+ instance = "metafun",
+ format = "metafun",
+ method = "scaled",
+ definitions = "",
+ }
+ --
+ ctx_tographic(g,"if unknown context_flow : input mp-char.mpiv ; fi ;")
+ ctx_tographic(g,"flow_begin_chart(0,%s,%s);",chart.nx,chart.ny)
--
if chartsettings.option == v_test or chartsettings.dot == v_yes then
- context("flow_show_con_points := true ;")
- context("flow_show_mid_points := true ;")
- context("flow_show_all_points := true ;")
+ ctx_tographic(g,"flow_show_con_points := true ;")
+ ctx_tographic(g,"flow_show_mid_points := true ;")
+ ctx_tographic(g,"flow_show_all_points := true ;")
elseif chartsettings.dot ~= "" then -- no checking done, private option
- context("flow_show_%s_points := true ;",chartsettings.dot)
+ ctx_tographic(g,"flow_show_%s_points := true ;",chartsettings.dot)
end
--
local backgroundcolor = chartsettings.backgroundcolor
if backgroundcolor and backgroundcolor ~= "" then
- context("flow_chart_background_color := \\MPcolor{%s} ;",backgroundcolor)
+ ctx_tographic(g,"flow_chart_background_color := %q ;",backgroundcolor)
end
--
local shapewidth = chartsettings.width
@@ -850,14 +964,14 @@ local function makechart(chart)
local labeloffset = chartsettings.labeloffset
local exitoffset = chartsettings.exitoffset
local commentoffset = chartsettings.commentoffset
- context("flow_grid_width := %p ;", gridwidth)
- context("flow_grid_height := %p ;", gridheight)
- context("flow_shape_width := %p ;", shapewidth)
- context("flow_shape_height := %p ;", shapeheight)
- context("flow_chart_offset := %p ;", chartoffset)
- context("flow_label_offset := %p ;", labeloffset)
- context("flow_exit_offset := %p ;", exitoffset)
- context("flow_comment_offset := %p ;", commentoffset)
+ ctx_tographic(g,"flow_grid_width := %p ;", gridwidth)
+ ctx_tographic(g,"flow_grid_height := %p ;", gridheight)
+ ctx_tographic(g,"flow_shape_width := %p ;", shapewidth)
+ ctx_tographic(g,"flow_shape_height := %p ;", shapeheight)
+ ctx_tographic(g,"flow_chart_offset := %p ;", chartoffset)
+ ctx_tographic(g,"flow_label_offset := %p ;", labeloffset)
+ ctx_tographic(g,"flow_exit_offset := %p ;", exitoffset)
+ ctx_tographic(g,"flow_comment_offset := %p ;", commentoffset)
--
local radius = settings.line.radius
local rulethickness = settings.line.rulethickness
@@ -872,10 +986,10 @@ local function makechart(chart)
radius = dy
end
end
- context("flow_connection_line_width := %p ;", rulethickness)
- context("flow_connection_smooth_size := %p ;", radius)
- context("flow_connection_arrow_size := %p ;", radius)
- context("flow_connection_dash_size := %p ;", radius)
+ ctx_tographic(g,"flow_connection_line_width := %p ;", rulethickness)
+ ctx_tographic(g,"flow_connection_smooth_size := %p ;", radius)
+ ctx_tographic(g,"flow_connection_arrow_size := %p ;", radius)
+ ctx_tographic(g,"flow_connection_dash_size := %p ;", radius)
--
local offset = chartsettings.offset -- todo: pass string
if offset == v_none or offset == v_overlay or offset == "" then
@@ -883,18 +997,21 @@ local function makechart(chart)
elseif offset == v_standard then
offset = radius -- or rulethickness?
end
- context("flow_chart_offset := %p ;",offset)
+ ctx_tographic(g,"flow_chart_offset := %p ;",offset)
--
- context("flow_reverse_y := true ;")
+ ctx_tographic(g,"flow_reverse_y := true ;")
if chartsettings.option == v_test then
- context("flow_draw_test_shapes ;")
- end
- process_cells(chart,0,0)
- process_connections(chart,0,0)
- process_texts(chart,0,0)
- -- context("clip_chart(%s,%s,%s,%s) ;",x,y,nx,ny) -- todo: draw lines but not shapes
- context("flow_end_chart ;")
- context.stopMPcode()
+ ctx_tographic(g,"flow_draw_test_shapes ;")
+ end
+ --
+ process_cells(g,chart,0,0)
+ process_connections(g,chart,0,0)
+ process_texts(g,chart,0,0)
+ --
+ -- ctx_tographic(g,"clip_chart(%s,%s,%s,%s) ;",x,y,nx,ny) -- todo: draw lines but not shapes
+ ctx_tographic(g,"flow_end_chart ;")
+ ctx_stopgraphic(g)
+ --
context.endgroup()
end
@@ -979,19 +1096,86 @@ local function splitchart(chart)
end
end
-function commands.flow_make_chart(settings)
- local chart = getchart(settings)
- if chart then
- local settings = chart.settings
- if settings then
- local chartsettings = settings.chart
- if chartsettings and chartsettings.split == v_yes then
- splitchart(chart)
+implement {
+ name = "flow_make_chart",
+ arguments = {
+ {
+ { "chart", {
+ { "name" },
+ { "option" },
+ { "backgroundcolor" },
+ { "width", "dimension" },
+ { "height", "dimension" },
+ { "dx", "dimension" },
+ { "dy", "dimension" },
+ { "offset", "dimension" },
+ -- { "bodyfont" },
+ { "dot" },
+ { "hcompact" },
+ { "vcompact" },
+ { "focus" },
+ { "autofocus" },
+ { "nx", "integer" },
+ { "ny", "integer" },
+ { "x", "integer" },
+ { "y", "integer" },
+ { "labeloffset", "dimension" },
+ { "commentoffset", "dimension" },
+ { "exitoffset", "dimension" },
+ { "split" },
+ },
+ },
+ { "shape", {
+ { "rulethickness", "dimension" },
+ { "default" },
+ { "framecolor" },
+ { "backgroundcolor" },
+ },
+ },
+ { "focus", {
+ { "rulethickness", "dimension" },
+ { "framecolor" },
+ { "backgroundcolor" },
+ },
+ },
+ { "line", {
+ { "rulethickness", "dimension" },
+ { "radius", "dimension" },
+ { "color" },
+ { "corner" },
+ { "dash" },
+ { "arrow" },
+ { "offset" },
+ },
+ },
+ { "split", {
+ { "nx", "integer" },
+ { "ny", "integer" },
+ { "dx", "integer" },
+ { "dy", "integer" },
+ { "command" },
+ { "marking" },
+ { "before" },
+ { "after" },
+ },
+ },
+ -- { "set" },
+ }
+ },
+ actions = function(settings)
+ local chart = getchart(settings)
+ if chart then
+ local settings = chart.settings
+ if settings then
+ local chartsettings = settings.chart
+ if chartsettings and chartsettings.split == v_yes then
+ splitchart(chart)
+ else
+ makechart(chart)
+ end
else
makechart(chart)
end
- else
- makechart(chart)
end
end
-end
+}
diff --git a/tex/context/modules/mkiv/m-chart.mkvi b/tex/context/modules/mkiv/m-chart.mkvi
index 69d90f47b..0463e4acd 100644
--- a/tex/context/modules/mkiv/m-chart.mkvi
+++ b/tex/context/modules/mkiv/m-chart.mkvi
@@ -29,12 +29,12 @@
% todo: figure out a nice way to define the lot: share current and
% support current as name (nb: we need to set parent then)
-\installcorenamespace {flowchart} % \def\??flch{@@flch} % chart
-\installcorenamespace {flowline} % \def\??flln{@@flln} % line
-\installcorenamespace {flowshape} % \def\??flsh{@@flsh} % shape
-\installcorenamespace {flowfocus} % \def\??flfc{@@flfc} % focus
-\installcorenamespace {flowsets} % \def\??flst{@@flst} % sets
-\installcorenamespace {flowsplit} % \def\??flsp{@@flsp} % split
+\installcorenamespace {flowchart} % chart
+\installcorenamespace {flowline} % line
+\installcorenamespace {flowshape} % shape
+\installcorenamespace {flowfocus} % focus
+\installcorenamespace {flowsets} % sets
+\installcorenamespace {flowsplit} % split
\installsimplecommandhandler \??flowchart {FLOWchart} \??flowchart % maybe just a setuphandler
\installsimplecommandhandler \??flowline {FLOWline} \??flowline % maybe just a setuphandler
@@ -118,7 +118,7 @@
\newtoks\everyFLOWchart
\unexpanded\def\module_charts_process[#name]%
- {\ctxcommand{flow_start_chart("#name")}}
+ {\clf_flow_start_chart{#name}}
\unexpanded\def\startFLOWchart
{\startnointerference
@@ -126,10 +126,10 @@
\dosingleempty\module_charts_start_chart}
\unexpanded\def\module_charts_start_chart[#name]%
- {\ctxcommand{flow_start_chart("#name")}}
+ {\clf_flow_start_chart{#name}}
\unexpanded\def\stopFLOWchart
- {\ctxcommand{flow_stop_chart()}%
+ {\clf_flow_stop_chart
\stopnointerference}
\unexpanded\def\defineFLOWchart % for old times sake
@@ -138,9 +138,9 @@
\unexpanded\def\module_charts_FLOW_define[#name][#settings]#cells% todo: save settings
{\startnointerference
\the\everyFLOWchart
- \ctxcommand{flow_start_chart("#name")}%
+ \clf_flow_start_chart{#name}%
#cells%
- \ctxcommand{flow_stop_chart()}%
+ \clf_flow_stop_chart
\stopnointerference}
\unexpanded\def\startFLOWcell
@@ -154,32 +154,32 @@
\ifsecondargument
\setupFLOWline[#2]%
\fi
- \ctxcommand{flow_start_cell {
- shape = {
- rulethickness = \number\dimexpr\FLOWshapeparameter\c!rulethickness,
- default = "\FLOWshapeparameter\c!default",
- framecolor = "\FLOWshapeparameter\c!framecolor",
- backgroundcolor = "\FLOWshapeparameter\c!backgroundcolor",
- },
- focus = {
- rulethickness = \number\dimexpr\FLOWfocusparameter\c!rulethickness,
- framecolor = "\FLOWfocusparameter\c!framecolor",
- backgroundcolor = "\FLOWfocusparameter\c!backgroundcolor",
- },
- line = {
- rulethickness = \number\dimexpr\FLOWlineparameter\c!rulethickness,
- radius = \number\dimexpr\FLOWlineparameter\c!radius,
- color = "\FLOWlineparameter\c!color",
- corner = "\FLOWlineparameter\c!corner",
- dash = "\FLOWlineparameter\c!dash",
- arrow = "\FLOWlineparameter\c!arrow",
- offset = \number\dimexpr\FLOWlineparameter\c!offset,
- },
- } }%
+ \clf_flow_start_cell
+ shape {
+ rulethickness \dimexpr\FLOWshapeparameter\c!rulethickness\relax
+ default {\FLOWshapeparameter\c!default}
+ framecolor {\FLOWshapeparameter\c!framecolor}
+ backgroundcolor {\FLOWshapeparameter\c!backgroundcolor}
+ }
+ focus {
+ rulethickness \dimexpr\FLOWfocusparameter\c!rulethickness\relax
+ framecolor {\FLOWfocusparameter\c!framecolor}
+ backgroundcolor {\FLOWfocusparameter\c!backgroundcolor}
+ }
+ line {
+ rulethickness \dimexpr\FLOWlineparameter\c!rulethickness\relax
+ radius \dimexpr\FLOWlineparameter\c!radius\relax
+ color {\FLOWlineparameter\c!color}
+ corner {\FLOWlineparameter\c!corner}
+ dash {\FLOWlineparameter\c!dash}
+ arrow {\FLOWlineparameter\c!arrow}
+ offset \dimexpr\FLOWlineparameter\c!offset\relax
+ }
+ \relax
\endgroup}
\unexpanded\def\stopFLOWcell
- {\ctxcommand{flow_stop_cell()}}
+ {\clf_flow_stop_cell}
\unexpanded\def\FLOWchart
{\dodoubleempty\module_charts_process}
@@ -190,64 +190,64 @@
\dontcomplain
\setupFLOWchart[#settings]%
\usebodyfontparameter\FLOWchartparameter
- \ctxcommand{flow_make_chart {
- chart = {
- name = "#name",
- option = "\FLOWchartparameter\c!option",
- backgroundcolor = "\FLOWchartparameter\c!backgroundcolor",
- width = \number\dimexpr\FLOWchartparameter\c!width,
- height = \number\dimexpr\FLOWchartparameter\c!height,
- dx = \number\dimexpr\FLOWchartparameter\c!dx,
- dy = \number\dimexpr\FLOWchartparameter\c!dy,
- offset = \number\dimexpr\FLOWchartparameter\c!offset,
- % bodyfont = "\FLOWchartparameter\c!bodyfont",
- dot = "\FLOWchartparameter\c!dot", % private option
- hcompact = "\FLOWchartparameter\c!hcompact", % undocumented option
- vcompact = "\FLOWchartparameter\c!vcompact", % undocumented option
- focus = "\FLOWchartparameter\c!focus",
- autofocus = "\FLOWchartparameter\c!autofocus",
- nx = "\FLOWchartparameter\c!nx",
- ny = "\FLOWchartparameter\c!ny",
- x = "\FLOWchartparameter\c!x",
- y = "\FLOWchartparameter\c!y",
- labeloffset = \number\dimexpr\FLOWchartparameter\c!labeloffset,
- commentoffset = \number\dimexpr\FLOWchartparameter\c!commentoffset,
- exitoffset = \number\dimexpr\FLOWchartparameter\c!exitoffset,
- split = "\FLOWchartparameter\c!split",
- },
- shape = {
- rulethickness = \number\dimexpr\FLOWshapeparameter\c!rulethickness,
- default = "\FLOWshapeparameter\c!default",
- framecolor = "\FLOWshapeparameter\c!framecolor",
- backgroundcolor = "\FLOWshapeparameter\c!backgroundcolor",
- },
- focus = {
- rulethickness = \number\dimexpr\FLOWfocusparameter\c!rulethickness,
- framecolor = "\FLOWfocusparameter\c!framecolor",
- backgroundcolor = "\FLOWfocusparameter\c!backgroundcolor",
- },
- line = {
- rulethickness = \number\dimexpr\FLOWlineparameter\c!rulethickness,
- radius = \number\dimexpr\FLOWlineparameter\c!radius,
- color = "\FLOWlineparameter\c!color",
- corner = "\FLOWlineparameter\c!corner",
- dash = "\FLOWlineparameter\c!dash",
- arrow = "\FLOWlineparameter\c!arrow",
- offset = "\FLOWlineparameter\c!offset",
- },
- set = {
- },
- split = {
- nx = \number\FLOWsplitparameter\c!nx,
- ny = \number\FLOWsplitparameter\c!ny,
- dx = \number\FLOWsplitparameter\c!dx,
- dy = \number\FLOWsplitparameter\c!dy,
- command = "",
- marking = "\FLOWsplitparameter\c!marking",
- before = "",
- after = "",
+ \clf_flow_make_chart
+ chart {
+ name {#name}
+ option {\FLOWchartparameter\c!option}
+ backgroundcolor {\FLOWchartparameter\c!backgroundcolor}
+ width \dimexpr\FLOWchartparameter\c!width\relax
+ height \dimexpr\FLOWchartparameter\c!height\relax
+ dx \dimexpr\FLOWchartparameter\c!dx\relax
+ dy \dimexpr\FLOWchartparameter\c!dy\relax
+ offset \dimexpr\FLOWchartparameter\c!offset\relax
+ % bodyfont {\FLOWchartparameter\c!bodyfont}
+ dot {\FLOWchartparameter\c!dot} % private option
+ hcompact {\FLOWchartparameter\c!hcompact} % undocumented option
+ vcompact {\FLOWchartparameter\c!vcompact} % undocumented option
+ focus {\FLOWchartparameter\c!focus}
+ autofocus {\FLOWchartparameter\c!autofocus}
+ nx \numexpr\FLOWchartparameter\c!nx\relax
+ ny \numexpr\FLOWchartparameter\c!ny\relax
+ x \numexpr\FLOWchartparameter\c!x\relax
+ y \numexpr\FLOWchartparameter\c!y\relax
+ labeloffset \dimexpr\FLOWchartparameter\c!labeloffset\relax
+ commentoffset \dimexpr\FLOWchartparameter\c!commentoffset\relax
+ exitoffset \dimexpr\FLOWchartparameter\c!exitoffset\relax
+ split {\FLOWchartparameter\c!split}
+ }
+ shape {
+ rulethickness \dimexpr\FLOWshapeparameter\c!rulethickness\relax
+ default {\FLOWshapeparameter\c!default}
+ framecolor {\FLOWshapeparameter\c!framecolor}
+ backgroundcolor {\FLOWshapeparameter\c!backgroundcolor}
+ }
+ focus {
+ rulethickness \dimexpr\FLOWfocusparameter\c!rulethickness\relax
+ framecolor {\FLOWfocusparameter\c!framecolor}
+ backgroundcolor {\FLOWfocusparameter\c!backgroundcolor}
+ }
+ line {
+ rulethickness \dimexpr\FLOWlineparameter\c!rulethickness\relax
+ radius \dimexpr\FLOWlineparameter\c!radius\relax
+ color {\FLOWlineparameter\c!color}
+ corner {\FLOWlineparameter\c!corner}
+ dash {\FLOWlineparameter\c!dash}
+ arrow {\FLOWlineparameter\c!arrow}
+ offset {\FLOWlineparameter\c!offset}
+ }
+ % set {
+ % }
+ split {
+ nx \numexpr\FLOWsplitparameter\c!nx\relax
+ ny \numexpr\FLOWsplitparameter\c!ny\relax
+ dx \numexpr\FLOWsplitparameter\c!dx\relax
+ dy \numexpr\FLOWsplitparameter\c!dy\relax
+ command {}
+ marking {\FLOWsplitparameter\c!marking}
+ before {}
+ after {}
}
- } }%
+ \relax
\egroup}
\unexpanded\def\FLOWcharts
@@ -281,13 +281,13 @@
\let\includeFLOWchart\include
\to \everyFLOWchart
-\unexpanded\def\FLOW_name #name{\ctxcommand{flow_set_name("#name")}\ignorespaces}
-\unexpanded\def\FLOW_shape #shape{\ctxcommand{flow_set_shape("#shape")}\ignorespaces}
-\unexpanded\def\FLOW_destination#destination{\ctxcommand{flow_set_destination("#destination")}\ignorespaces}
-\unexpanded\def\FLOW_focus #focus{\ctxcommand{flow_set_focus("#focus")}\ignorespaces}
-\unexpanded\def\FLOW_overlay #overlay{\ctxcommand{flow_set_overlay("#overlay")}\ignorespaces}
-\unexpanded\def\FLOW_location #location{\ctxcommand{flow_set_location("#location")}\ignorespaces}
-\unexpanded\def\FLOW_figure #figure{\ctxcommand{flow_set_figure("#figure")}\ignorespaces}
+\unexpanded\def\FLOW_name #name{\clf_flow_set_name{#name}\ignorespaces}
+\unexpanded\def\FLOW_shape #shape{\clf_flow_set_shape{#shape}\ignorespaces}
+\unexpanded\def\FLOW_destination#destination{\clf_flow_set_destination{#destination}\ignorespaces}
+\unexpanded\def\FLOW_focus #focus{\clf_flow_set_focus{#focus}\ignorespaces}
+\unexpanded\def\FLOW_overlay #overlay{\clf_flow_set_overlay{#overlay}\ignorespaces}
+\unexpanded\def\FLOW_location #location{\clf_flow_set_location{#location}\ignorespaces}
+\unexpanded\def\FLOW_figure #figure{\clf_flow_set_figure{#figure}\ignorespaces}
\unexpanded\def\FLOW_text {\dosingleempty\module_charts_FLOW_text}
\unexpanded\def\FLOW_label {\dosingleempty\module_charts_FLOW_label}
@@ -296,16 +296,16 @@
\unexpanded\def\FLOW_connection{\dodoubleempty\module_charts_FLOW_connection}
\unexpanded\def\FLOW_include {\dodoubleempty\module_charts_FLOW_include}
-\unexpanded\def\module_charts_FLOW_text [#align]#text{\ctxcommand{flow_set_text("#align",\!!bs\detokenize{#text}\!!es)}\ignorespaces}
-\unexpanded\def\module_charts_FLOW_label [#location]#text{\ctxcommand{flow_set_label("#location",\!!bs\detokenize{#text}\!!es)}\ignorespaces}
-\unexpanded\def\module_charts_FLOW_comment [#location]#text{\ctxcommand{flow_set_comment("#location",\!!bs\detokenize{#text}\!!es)}\ignorespaces}
-\unexpanded\def\module_charts_FLOW_exit [#location]#text{\ctxcommand{flow_set_exit("#location",\!!bs\detokenize{#text}\!!es)}\ignorespaces}
-\unexpanded\def\module_charts_FLOW_connection[#location][#offset]#name{\ctxcommand{flow_set_connection("#location","#offset","#name")}\ignorespaces}
+\unexpanded\def\module_charts_FLOW_text [#align]#text{\clf_flow_set_text{#align}{\detokenize{#text}}\ignorespaces}
+\unexpanded\def\module_charts_FLOW_label [#location]#text{\clf_flow_set_label{#location}{\detokenize{#text}}\ignorespaces}
+\unexpanded\def\module_charts_FLOW_comment [#location]#text{\clf_flow_set_comment{#location}{\detokenize{#text}}\ignorespaces}
+\unexpanded\def\module_charts_FLOW_exit [#location]#text{\clf_flow_set_exit{#location}{\detokenize{#text}}\ignorespaces}
+\unexpanded\def\module_charts_FLOW_connection[#location][#offset]#name{\clf_flow_set_connection{#location}{#offset}{#name}\ignorespaces}
\unexpanded\def\module_charts_FLOW_include [#name][#settings]{%
\begingroup
- \getparameters[FLOWi][\c!x=1,\c!y=1,#settings]%
- \ctxcommand{flow_set_include("#name",\number\FLOWix,\number\FLOWiy,\!!bs\detokenize{#settings}\!!es)}%
+ \getdummyparameters[\c!x=1,\c!y=1,#settings]%
+ \clf_flow_set_include{#name}\numexpr\dummyparameter\c!x\relax\numexpr\dummyparameter\c!y\relax{\detokenize{#settings}}%
\endgroup
\ignorespaces
}
@@ -382,7 +382,7 @@
\endgroup}
\unexpanded\def\getFLOWtext#1%
- {\ifcase#1\else\ctxcommand{flow_get_text(#1)}\fi}
+ {\ifcase#1\else\clf_flow_get_text\numexpr#1\relax\fi}
\defineframed % to be discussed: shape or global
[flowcell:base]
diff --git a/tex/context/modules/mkiv/m-compatible.mkiv b/tex/context/modules/mkiv/m-compatible.mkiv
new file mode 100644
index 000000000..0e056180a
--- /dev/null
+++ b/tex/context/modules/mkiv/m-compatible.mkiv
@@ -0,0 +1,63 @@
+%D \module
+%D [ file=m-compatibility,
+%D version=2018.02.21,
+%D title=\CONTEXT\ System Macros,
+%D subtitle=ConTeXt Compatibility Layer,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D I fear that I will not keep up in this file so feel free to contribute to the
+%D following. The idea is nto to load this file but more to have some insight in
+%D how to control compatibility (to some extent).
+
+\writestatus{loading}{ConTeXt Compatibility Layer}
+
+%D The side float mechanism has been redone and is not space compatible. Hopefully
+%D it will become stable soon and after that we will not touch it unless we have a
+%D real bug. There might be more control options. The problem is that there are too
+%D many combinations of content before and after a side float possible.
+
+\ifnum\contextversionno<20180101\relax
+ % nothing here
+\fi
+
+%D Picking up the right last line depth is sort of tricky when we cross a page and
+%D have some left|-|over material. The sychronizer is normally not needed but for
+%D now turned on by default.
+
+\ifnum\contextversionno<20180221\relax
+ \disabledirectives[vspacing.synchronizepage]
+\fi
+
+%D Some day we might default to the following which is a bit more conistent but
+%D not compatible.
+
+% \setdisplaymathspacemodel[4]
+%
+% \ifnum\contextversionno<20180221\relax
+% \setdisplaymathspacemodel[3]
+% \fi
+
+%D Currently this is in \type {cont-loc.mkiv} but some day we might do:
+
+% \definemixedcolumns
+% [\v!columns]
+% % compatible with columns default :
+% [\c!balance=\v!yes,
+% \c!blank={\v!line,\v!fixed}]
+%
+% \unexpanded\def\setupcolumns
+% {\setupmixedcolumns[\v!columns]}
+
+%D as well as:
+
+% \input page-cst.mkiv
+
+
+
+\endinput
diff --git a/tex/context/modules/mkiv/m-cweb.mkiv b/tex/context/modules/mkiv/m-cweb.mkiv
index 2546b2342..2bf4e967f 100644
--- a/tex/context/modules/mkiv/m-cweb.mkiv
+++ b/tex/context/modules/mkiv/m-cweb.mkiv
@@ -11,90 +11,57 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D This module has to be redone in the mkiv way.
+%D This module has to be redone in the mkiv way and I do that stepwise so the
+%D current code is not okay.
-%D First some auxiliary stuff, to be moved to system module.
-
-\def\dodofindfirstcharacter#1%
- {\ifx#1\relax
- \let\next=\egroup
- \else
- \handlecase
- {\expandafter\ifnum\expandafter\catcode\expandafter`#1=11
- \def\next##1\relax{\egroup\def\firstcharacter{#1}}%
- \fi}%
- \fi
- \next}
-
-\def\dofindfirstcharacter#1#2%
- {\def\firstcharacter{}%
- \bgroup
- \defconvertedargument\ascii{#2}%
- \let\next\dodofindfirstcharacter
- \let\handlecase#1%
- \expandafter\next\ascii\relax}
-
-\def\normalcase#1%
- {#1}
-
-\def\findfirstcharacter%
- {\dofindfirstcharacter\lowercase}
-
-\def\FindFirstCharacter%
- {\dofindfirstcharacter\normalcase}
-
-\def\FINDFIRSTCHARACTER%
- {\dofindfirstcharacter\uppercase}
-
-% nog doen:
+% todo:
%
% \deactivateCWEB in output routine
% status info
-% gelinkte entries
+% linked entries
% parskip en parindent
+% breaks and whitespace
+% fonts ... now math abuse down here
%D \gdef\CWEBquote#1.{{\em Quote :}\ #1.} % checks the .
-
-%D This module (re)implements the \CWEB\ macros as defined in
-%D the file \type{cwebmac.tex}.
%D
-%D \CWEB\ uses short, often one character long, names for
-%D macros. This is no real problem because no one is supposed
-%D to read and understand the files generated by \CWEB. The
-%D standard macros are meant for \PLAIN\ \TEX\ users. In
-%D \CONTEXT\ and other macro packages however, there is a
-%D potential conflict with format specific or user defined
-%D commands. Furthermore, the \CWEB\ macros implement their own
-%D output routines. When integrating \CWEB\ documents in
-%D another environment, the \CWEB\ specific macros have to be
-%D made local. The first part of this module is dedicated to
-%D this feature.
+%D This module (re)implements the \CWEB\ macros as defined in the file \type
+%D {cwebmac.tex}. \CWEB\ uses short, often one character long, names for macros.
+%D This is no real problem because no one is supposed to read and understand the
+%D files generated by \CWEB. The standard macros are meant for \PLAIN\ \TEX\ users.
+%D In \CONTEXT\ and other macro packages however, there is a potential conflict with
+%D format specific or user defined commands. Furthermore, the \CWEB\ macros
+%D implement their own output routines. When integrating \CWEB\ documents in another
+%D environment, the \CWEB\ specific macros have to be made local. The first part of
+%D this module is dedicated to this feature.
%D
-%D Instead of using \type{\def} and \type{\let} for defining
-%D macros, we use:
+%D Instead of using \type {\def} and \type {\let} for defining macros, we use:
%D
%D \starttyping
%D \defCEBmacro arguments {meaning}
%D \letCEBmacro arguments {meaning}
%D \stoptyping
%D
-%D \CWEB files contain implicit calls to macros that generate
-%D the table of contents, the lists of sections and the index.
-%D Because we want to be much more flexible, we implemented our
-%D own alternatives, and therefore have to bypass the original
-%D ones. The next macro is used for defining these obsolete
-%D \CWEB\ macros. The dummies take care of arguments.
+%D \CWEB\ files contain implicit calls to macros that generate the table of contents,
+%D the lists of sections and the index. Because we want to be much more flexible, we
+%D implemented our own alternatives, and therefore have to bypass the original ones.
+%D The next macro is used for defining these obsolete \CWEB\ macros. The dummies
+%D take care of arguments.
%D
%D \starttyping
%D \defCEBdummy arguments {meaning}
%D \stoptyping
%D
-%D The list of \CWEB\ specific macro names is saved in a
-%D \TOKENLIST. This serves two purposes. First it enables us to
-%D activate the \CWEB\ macros, which are saved under a
-%D different name, second it can be used to temporary restore
-%D the meanings, for instance when the output routine builds
-%D the page.
+%D The list of \CWEB\ specific macro names is saved in a \TOKENLIST. This serves two
+%D purposes. First it enables us to activate the \CWEB\ macros, which are saved
+%D under a different name, second it can be used to temporary restore the meanings,
+%D for instance when the output routine builds the page.
+%D
+%D We don't provide specific formatting commands. We just assume \CONTEXT\ being
+%D used (so you can use all it provides) and|/|or that specific user macros are
+%D implemented somewhere else.
+
+\unprotect
\newtoks\CWEBmacros
@@ -105,210 +72,149 @@
%D \deactivateCWEB
%D \stoptyping
%D
-%D Which are implemented as:
+%D These are implemented as:
-\def\activateCWEB%
- {\let\doCWEB=\activateCWEBmacro
+\unexpanded\def\activateCWEB
+ {\let\doCWEB\activateCWEBmacro
\the\CWEBmacros}
-\def\deactivateCWEB%
- {\let\doCWEB=\deactivateCWEBmacro
+\unexpanded\def\deactivateCWEB
+ {\let\doCWEB\deactivateCWEBmacro
\the\CWEBmacros}
-%D The three definition macros append the name of the macro to
-%D the list. The first two macros save the meaning, the last one
-%D assigns \type{{}} to the macro and gobbles original meaning.
+%D The three definition macros append the name of the macro to the list. The first
+%D two macros save the meaning, the last one assigns \type {{}} to the macro and
+%D gobbles original meaning.
+
+\installcorenamespace{newCWEB}
+\installcorenamespace{oldCWEB}
-\long\def\defCWEBmacro#1%
+\unexpanded\def\defCWEBmacro#1%
{\appendtoks\doCWEB#1\to\CWEBmacros
- \setvalue{newCWEB\string#1}}
+ \setuvalue{\??newCWEB\string#1}}
-\long\def\letCWEBmacro#1%
+\unexpanded\def\letCWEBmacro#1%
{\appendtoks\doCWEB#1\to\CWEBmacros
- \letvalue{newCWEB\string#1}}
+ \letvalue{\??newCWEB\string#1}}
-\long\def\defCWEBdummy#1#2#%
+\unexpanded\def\defCWEBdummy#1#2#%
{\appendtoks\doCWEB#1\to\CWEBmacros
- \setvalue{newCWEB\string#1}#2{}%
+ \setuvalue{\??newCWEB\string#1}#2{}%
\gobbleoneargument}
-%D The macro \type{\defCWEBdummy} of course takes care of the
-%D argument. This leaves the two (de|)|activating macros:
+%D The macro \type {\defCWEBdummy} of course takes care of the argument. This leaves
+%D the two (de|)|activating macros:
-\def\CWEBmacro#1%
- {\getvalue{newCWEB\string#1}}
+\unexpanded\def\CWEBmacro#1%
+ {\getvalue{\??newCWEB\string#1}}
-\def\activateCWEBmacro#1%
- {\letvalue{oldCWEB\string#1}=#1%
- \def#1{\CWEBmacro#1}}
+\unexpanded\def\activateCWEBmacro#1%
+ {\letvalue{\??oldCWEB\string#1}=#1%
+ \unexpanded\def#1{\CWEBmacro#1}}
-\def\deactivateCWEBmacro#1%
- {\expandafter\let\expandafter#1\expandafter=\csname oldCWEB\string#1\endcsname}
+\unexpanded\def\deactivateCWEBmacro#1%
+ {\expandafter\let\expandafter#1\csname\??oldCWEB\string#1\endcsname}
-%D I did consider loading the \CWEB\ macros using temporary
-%D substitutes of \type{\def}, \type{\font}, \type{\newbox} etc.
-%D The main problem is that the file contains more than
-%D definitions and taking all kind of assignments into account
-%D too would not make things easier. So I decided to stick to
-%D the method as just described.
+\protect
-%D Now we're ready for the real job. What follows is a partial
-%D adaption of the file \type{cwebmac.tex}, version 3.1, dated
-%D September 1994 and written by Levy and Knuth. When possible
-%D we kept the original meaning, but we've granted ourselves
+%D I did consider loading the \CWEB\ macros using temporary substitutes of \type
+%D {\def}, \type {\font}, \type {\newbox} etc. The main problem is that the file
+%D contains more than definitions and taking all kind of assignments into account
+%D too would not make things easier. So I decided to stick to the method as just
+%D described.
+%D
+%D Now we're ready for the real job. What follows is a partial adaption of the file
+%D \type {cwebmac.tex}, version 3.1, dated September 1994 and written by Levy and
+%D Knuth. When possible we kept the original meaning, but we've granted ourselves
%D the freedom to reformat the macro's for readibility.
%D
-%D We'll only present the macros we actually use. The source
-%D however contains the original implementation.
-
-% standard macros for CWEB listings (in addition to plain.tex)
-% Version 3.1 --- September 1994.
-%
-% \ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros
-%
-% \xdef\fmtversion{\fmtversion+CWEB3.1}
-
-%D \macros{.}{}
+%D We'll only present the macros we actually use. The source however contains the
+%D original implementation.
%D
-%D \CWEBquote preserve a way to get the dot accent (all
-%D other accents will still work as usual).
+%D The next is based on the standard macros for CWEB listings (in addition to \type
+%D {plain.tex}) Version 3.1 --- September 1994.
-\letCWEBmacro\: = \.
-
-% \parskip = 0pt % no stretch between paragraphs
-% \parindent = 1em % for paragraphs and for the first line of C text
-
-% \font\ninerm = cmr9
-% \let\mc = \ninerm % medium caps
-% \font\eightrm = cmr8
-% \let\sc = \eightrm % small caps (NOT a caps-and-small-caps font)
-% \let\mainfont = \tenrm
-% \let\cmntfont = \tenrm
-% \font\tenss = cmss10
-% \let\cmntfont = \tenss % alternative comment font
-% \font\titlefont = cmr7 scaled \magstep4 % title on the contents page
-% \font\ttitlefont = cmtt10 scaled \magstep2 % typewriter type in title
-% \font\tentex = cmtex10 % TeX extended character set (used in strings)
-% \fontextraspace\tentex = 0pt % no double space after sentences
-
-%D \macros{mc,sc,cmntfont,eightrm}{}
-%D
-%D The naming of the fonts in in line with those in \PLAIN\
-%D \TEX. Although \CONTEXT\ implements its own scheme, there is
-%D still support for the \PLAIN\ ones. We keep the original
-%D names, but change their meaning. That way the macros obey
-%D switching to other sizes or styles.
-
-\defCWEBmacro\mc {\tx}
-\defCWEBmacro\sc {\txx}
-\defCWEBmacro\cmntfont {\ss}
-\defCWEBmacro\eightrm {\tx}
-
-%D \macros{tentex,sevenrm,sevensy,teni}{}
-%D
-%D The next one uses a temporary solution. The \type{cmtex10}
-%D font is not part of the default mechanism. We make use of
-%D the \CONTEXT\ variables \type{\textface}, \type{\scriptface}
-%D and \type{\scriptscriptface}, which hold the current
-%D sizes.
-
-\defCWEBmacro\tentex%
- {\font\next=cmtex10 at \textface
- \fontextraspace\next\zeropoint
- \next}
-
-\defCWEBmacro\sevenrm {\getvalue{\scriptface rmtf}}
-\defCWEBmacro\sevensy {\getvalue{\scriptface mmsy}}
-\defCWEBmacro\teni {\getvalue{\textface mmmi}}
-
-%D \macros{CWEBpt}{}
+%D \macros{.}
%D
-%D The original macros are based on a 10~point bodyfont size. We
-%D therefore have to specify dimension in points a bit
-%D different. Specifications like .6pt are changed to
-%D \type{.06} times \type{\bodyfontsize}.
+%D \CWEBquote preserve a way to get the dot accent (all other accents will still
+%D work as usual).
-\defCWEBmacro\CWEBpt {\bodyfontsize} % still dutch
+\letCWEBmacro\: = \.
-%D \macros{CEE,UNIX,TEX,CPLUSPLUS}{}
+%D \macros{CEE,UNIX,TEX,CPLUSPLUS}
%D
-%D Next come some logo's. It does not make much sense to use
-%D the \CONTEXT\ logo mechanism here, so we simply say:
+%D Next come some logo's. It does not make much sense to use the \CONTEXT\ logo
+%D mechanism here, so we simply say:
-\defCWEBmacro \CEE/{{\mc C\spacefactor1000}}
-\defCWEBmacro \UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}}
+\defCWEBmacro \CEE/{{\tx C\spacefactor1000}}
+\defCWEBmacro \UNIX/{{\tx UNIX\spacefactor1000}}
\defCWEBmacro \TEX/{\TeX}
-\defCWEBmacro\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
+\defCWEBmacro\CPLUSPLUS/{{\tx C\PP\spacefactor1000}}
\defCWEBmacro \Cee{\CEE/} % for backward compatibility
-%D \macros{\ }{}
+%D \macros{\ }
%D
-%D Now we come to the real work: the short commands that make
-%D up the typography.
+%D Now we come to the real work: the short commands that make up the typography.
%D
%D \CWEBquote italic type for identifiers.
\defCWEBmacro\\#1%
- {\leavevmode\hbox{\it#1\/\kern.05em}}
+ {\dontleavehmode
+ \hbox{\it#1\/\kern.05em}}
-%D \macros{\string|}{}
+%D \macros{\string|}
%D
%D \CWEBquote one letter identifiers look better this way.
\defCWEBmacro\|#1%
- {\leavevmode\hbox{$#1$}}
+ {\dontleavehmode
+ \hbox{$#1$}}
-%D \macros{\string\&}{}
+%D \macros{\string\&}
%D
%D \CWEBquote boldface type for reserved words.
\defCWEBmacro\&#1%
- {\leavevmode
- \hbox
- {\def\_%
- {\kern.04em
- \vbox{\hrule width.3em height .06\CWEBpt}% .6pt}%
- \kern.08em}%
- \bf#1\/\kern.05em}}
+ {\dontleavehmode
+ \hbox{\bf#1\/\kern.05em}}
-%D \macros{.}{}
+%D \macros{.}
%D
-%D Here we use the previously saved period. This macro
-%D takes care of special characters in strings.
+%D Here we use the previously saved period. This macro takes care of special
+%D characters in strings.
\defCWEBmacro\.#1%
- {\leavevmode
- \hbox
- {\tentex % typewriter type for strings
- \let\\=\BS % backslash in a string
- \let\{=\LB % left brace in a string
- \let\}=\RB % right brace in a string
- \let\~=\TL % tilde in a string
- \let\ =\SP % space in a string
- \let\_=\UL % underline in a string
- \let\&=\AM % ampersand in a string
- \let\^=\CF % circumflex in a string
- #1\kern.05em}}
-
-%D \macros{)}{}
+ {\dontleavehmode
+ \hbox
+ {\tttf % typewriter type for strings
+ \let\\=\BS % backslash in a string
+ \let\{=\LB % left brace in a string
+ \let\}=\RB % right brace in a string
+ \let\~=\TL % tilde in a string
+ \let\ =\SP % space in a string
+ \let\_=\UL % underline in a string
+ \let\&=\AM % ampersand in a string
+ \let\^=\CF % circumflex in a string
+ #1\kern.05em}}
+
+%D \macros{)}
%D
%D Some discretionary hack.
\defCWEBmacro\)%
- {\discretionary{\hbox{\tentex\BS}}{}{}}
+ {\discretionary{\hbox{\tttf\BS}}{}{}}
-%D \macros{AT}{}
+%D \macros{AT}
%D
-%D \CWEBquote at sign for control text (not needed in versions
-%D $>=$ 2.9).
+%D \CWEBquote at sign for control text (not needed in versions $>=$ 2.9).
\defCWEBmacro\AT{@}
-%D \macros{ATL,postATL,NOATL}{}
+%D \macros{ATL,postATL,NOATL}
%D
%D A two step macro that handles whatever.
-\defCWEBmacro\ATL%
+\defCWEBmacro\ATL
{\par
\noindent
\bgroup
@@ -316,143 +222,116 @@
\postATL}
\defCWEBmacro\postATL#1 #2 %
- {\bf letter \\{\uppercase{\char"#1}} tangles as \tentex "#2"%
+ {\bf letter \\{\WORD{\char"#1}} tangles as \tttf \quotation{#2}%
\egroup
\par}
\defCWEBmacro\noATL#1 #2 %
{}
-%D \macros{noatl}{}
+%D \macros{noatl}
%D
-%D \CWEBquote suppress output from \type{@l}.
+%D \CWEBquote suppress output from \type {@l}.
-\defCWEBmacro\noatl%
- {\let\ATL=\noATL}
+\defCWEBmacro\noatl
+ {\let\ATL\noATL}
% \defCWEBmacro\ATH%
% {\X\kern-.5em:Preprocessor definitions\X}
%D \macros{PB}
%D
-%D \CWEBquote hook for program brackets {\tttf\string|...\string|}
-%D in TeX part or section name.
+%D \CWEBquote hook for program brackets {\tttf\string|...\string|} in \TEX\ part or
+%D section name.
-\defCWEBmacro\PB%
+\defCWEBmacro\PB
{\relax}
-% \chardef\AM = `\& % ampersand character in a string
-% \chardef\BS = `\\ % backslash in a string
-% \chardef\LB = `\{ % left brace in a string
-% \chardef\RB = `\} % right brace in a string
-% \chardef\TL = `\~ % tilde in a string
-% \chardef\UL = `\_ % underline character in a string
-% \chardef\CF = `\^ % circumflex character in a string
-
-\defCWEBmacro\AM {\char`\&} % ampersand character in a string
-\defCWEBmacro\BS {\char`\\} % backslash in a string
-\defCWEBmacro\LB {\char`\{} % left brace in a string
-\defCWEBmacro\RB {\char`\}} % right brace in a string
-\defCWEBmacro\TL {\char`\~} % tilde in a string
-\defCWEBmacro\UL {\char`\_} % underline character in a string
-\defCWEBmacro\CF {\char`\^} % circumflex character in a string
-
-\defCWEBmacro\SP {{\tt\char`\ }} % (visible) space in a string
-
-% \newbox\PPbox \setbox\PPbox=\hbox
-% {\kern.5pt\raise1pt\hbox{\sevenrm+\kern-1pt+}\kern.5pt}
-% \newbox\MMbox \setbox\MMbox=\hbox
-% {\kern.5pt\raise1pt\hbox{\sevensy\char0\kern-1pt\char0}\kern.5pt}
-% \newbox\MGbox \setbox\MGbox=\hbox % symbol for ->
-% {\kern-2pt\lower3pt\hbox{\teni\char'176}\kern1pt}
-% \newbox\MODbox \setbox\MODbox=\hbox
-% {\eightrm\%}
-%
-% \def\PP {\copy\PPbox}
-% \def\MM {\copy\MMbox}
-% \def\MG {\copy\MGbox}
-% \def\MOD {\mathbin{\copy\MODbox}}
-
-\defCWEBmacro\PP% symbol for ++
- {\kern.05\CWEBpt
- \raise.1\CWEBpt\hbox{\sevenrm+\kern-.1\CWEBpt+}%
- \kern.05\CWEBpt}
-
-\defCWEBmacro\MM%
- {\kern.05\CWEBpt
- \raise.1\CWEBpt\hbox{\sevensy\char0\kern-.1\CWEBpt\char0}%
- \kern.05\CWEBpt}
-
-\defCWEBmacro\MG%
- {\kern-.2\CWEBpt
- \lower.3\CWEBpt\hbox{\teni\char'176}%
- \kern .1\CWEBpt}
+\letCWEBmacro\AM \letterampersand % ampersand character in a string
+\letCWEBmacro\BS \letterbackslash % backslash in a string
+\letCWEBmacro\LB \letterleftbrace % left brace in a string
+\letCWEBmacro\RB \letterrightbrace % right brace in a string
+\letCWEBmacro\TL \lettertilde % tilde in a string
+\letCWEBmacro\UL \letterunderscore % underline character in a string
+\letCWEBmacro\CF \letterhat % circumflex character in a string
+\letCWEBmacro\SP \textvisiblespace % (visible) space in a string
+
+%D We're in mathmode, otherwise we could have:
+%D
+%D \starttyping
+%D \defCWEBmacro\PP{\raise.15em\hbox{\tx\textplus \kern-.05em\textplus }}
+%D \defCWEBmacro\MM{\raise.15em\hbox{\tx\textminus\kern .10em\textminus}}
+%D \defCWEBmacro\MG{\raise.15em\hbox{\rightarrow}}
+%D \stoptyping
+
+\defCWEBmacro\PP % symbol for ++
+ {\kern.05em
+ \raise.1em\hbox{$\scriptstyle+\kern-.1em+$}%
+ \kern.05em}
+
+\defCWEBmacro\MM % symbol for --
+ {\kern.05em
+ \raise.1em\hbox{$\scriptstyle-\kern-.1em-$}%
+ \kern.05em}
+
+\defCWEBmacro\MG
+ {\kern-.2em
+ \lower.3em\hbox{$\rightarrow$}%
+ \kern .1em}
\defCWEBmacro\MRL#1%
{\mathrel{\let\K==#1}}
-% \def\MRL#1%
-% {\KK#1}
-% \def\KK#1#2%
-% {\buildrel\;#1\over{#2}}
+% \def\MRL #1{\KK#1}
+% \def\KK #1#2{\buildrel\;#1\over{#2}}
\letCWEBmacro\GG = \gg
\letCWEBmacro\LL = \ll
\letCWEBmacro\NULL = \Lambda
-% \mathchardef\AND = "2026 % bitwise and; also \& (unary operator)
-
-\defCWEBmacro\AND% redefines itself (funny)
- {\mathchardef\AND="2026 \AND} % bitwise and; also \& (unary operator)
+\letCWEBmacro\AND = \mathampersand % bitwise and; also \& (unary operator)
\letCWEBmacro\OR = \mid % bitwise or
\letCWEBmacro\XOR = \oplus % bitwise exclusive or
\defCWEBmacro\CM {{\sim}} % bitwise complement
-\defCWEBmacro\MOD {\mathbin{\eightrm\%}}
+\defCWEBmacro\MOD {\mathbin{\tx\%}}
\defCWEBmacro\DC {\kern.1em{::}\kern.1em} % symbol for ::
\defCWEBmacro\PA {\mathbin{.*}} % symbol for .*
\defCWEBmacro\MGA {\mathbin{\MG*}} % symbol for ->*
\defCWEBmacro\this {\&{this}}
-% \newbox \bak % backspace one em
-% \newbox \bakk % backspace two ems
-%
-% \setbox\bak =\hbox to -1em{}
-% \setbox\bakk=\hbox to -2em{}
-
\newcount\CWEBind % current indentation in ems
\defCWEBmacro\1% indent one more notch
- {\global\advance\CWEBind by 1
- \hangindent\CWEBind em}
+ {\global\advance\CWEBind \plusone
+ \hangindent\CWEBind \emwidth}
\defCWEBmacro\2% indent one less notch
- {\global\advance\CWEBind by -1 }
+ {\global\advance\CWEBind \minusone}
\defCWEBmacro\3#1% optional break within a statement
{\hfil
- \penalty#10
+ \penalty#10\relax
\hfilneg}
\defCWEBmacro\4% backspace one notch
- {\hbox to -1em{}}
+ {\hpack to -1em{}}
\defCWEBmacro\5% optional break
{\hfil
- \penalty-1
+ \penalty\minusone
\hfilneg
\kern2.5em
- \hbox to -2em{}%
+ \hpack to -2em{}%
\ignorespaces}
\defCWEBmacro\6% forced break
- {\ifmmode
- \else
+ {\ifmmode \else
\par
\hangindent\CWEBind em
\noindent
\kern\CWEBind em
- \hbox to -2em{}%
+ \hpack to -2em{}%
\ignorespaces
\fi}
@@ -467,45 +346,20 @@
\defCWEBmacro\9#1%
{}
-\newcount\gdepth % depth of current major group, plus one
-\newcount\secpagedepth
-\secpagedepth=3 % page breaks will occur for depths -1, 0, and 1
-
-% \newtoks\gtitle % title of current major group
-% \newskip\intersecskip
-% \intersecskip=12pt minus 3pt % space between sections
+\newcount\CWEBgdepth % depth of current major group, plus one
+\newcount\CWEBsecpagedepth
-% \let\yskip=\smallskip
+\CWEBsecpagedepth=3 % page breaks will occur for depths -1, 0, and 1
\defCWEBmacro\?%
{\mathrel?}
-% \def\note#1#2.%
-% {\Y\noindent
-% {\hangindent2em\baselineskip10pt\eightrm#1~#2.\par}}
-
-\defCWEBmacro\lapstar%
+\defCWEBmacro\lapstar
{\rlap{*}}
-% \def\stsec%
-% {\rightskip=0pt % get out of C mode (cf. \B)
-% \sfcode`;=1500
-% \pretolerance 200
-% \hyphenpenalty 50
-% \exhyphenpenalty 50
-% \noindent{\let\*=\lapstar\bf\secstar.\quad}}
-%
-% \let\startsection=\stsec
-
\defCWEBmacro\defin#1%
{\global\advance\CWEBind by 2 \1\&{#1 } } % begin `define' or `format'
-% \def\A% xref for doubly defined section name
-% {\note{See also section}}
-%
-% \def\As% xref for multiply defined section name
-% {\note{See also sections}}
-
\defCWEBmacro\B%
{\rightskip=0pt plus 100pt minus 10pt % go into C mode
\sfcode`;=3000
@@ -515,15 +369,10 @@
\global\CWEBind=2 \1\ \unskip}
\defCWEBmacro\C#1%
- {\5\5\quad$/\ast\,${\cmntfont #1}$\,\ast/$}
-
-% \let\SHC\C % "// short comments" treated like "/* ordinary comments */"
+ {\5\5\quad$/\ast\,${\ss\detokenize{#1}}$\,\ast/$}
\defCWEBmacro\SHC#1%
- {\5\5\quad$//\,${\cmntfont#1}}
-
-% \def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$}
-% \def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}}
+ {\5\5\quad$//\,${\ss#1}}
\defCWEBmacro\D% macro definition
{\defin{\#define}}
@@ -548,61 +397,9 @@
\defCWEBmacro\J% TANGLE's join operation
{\.{@\&}}
-% \let\K== % assignment operator
-
\letCWEBmacro\K = \leftarrow % "honest" alternative to standard assignment operator
% \L is Polish letter suppressed-L
-
-% \outer\def\M#1%
-% {\MN{#1}%
-% \ifon
-% \vfil
-% \penalty-100
-% \vfilneg % beginning of section
-% \vskip\intersecskip
-% \startsection
-% \ignorespaces}
-%
-% \outer\def\N#1#2#3.%
-% {\gdepth=#1%
-% \gtitle={#3}%
-% \MN{#2}% beginning of starred section
-% \ifon
-% \ifnum#1<\secpagedepth
-% \vfil
-% \eject % force page break if depth is small
-% \else
-% \vfil
-% \penalty-100
-% \vfilneg
-% \vskip\intersecskip
-% \fi
-% \fi
-% \message{*\secno}% progress report
-% \edef\next%
-% {\write\cont % write to contents file
-% {\ZZ{#3}{#1}{\secno}{\noexpand\the\pageno}}}%
-% \next % \ZZ{title}{depth}{sec}{page}
-% \ifon
-% \startsection
-% {\bf#3.\quad}%
-% \ignorespaces}
-%
-% \def\MN#1%
-% {\par % common code for \M, \N
-% {\xdef\secstar{#1}%
-% \let\*=\empty
-% \xdef\secno{#1}}% remove \* from section name
-% \ifx\secno\secstar
-% \onmaybe
-% \else
-% \ontrue
-% \fi
-% \mark{{{\tensy x}\secno}{\the\gdepth}{\the\gtitle}}}
-%
-% each \mark is {section reference or null}{depth plus 1}{group title}
-
% \O is Scandinavian letter O-with-slash
% \P is paragraph sign
@@ -612,7 +409,7 @@
% \S is section sign
\defCWEBmacro\T#1%
- {\leavevmode % octal, hex or decimal constant
+ {\dontleavehmode % octal, hex or decimal constant
\hbox
{$\def\?{\kern.2em}%
\def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant
@@ -628,16 +425,6 @@
\letCWEBmacro\V = \lor % logical or
\letCWEBmacro\W = \land % logical and
-% defined later on
-%
-% \def\X#1:#2\X%
-% {\ifmmode
-% \gdef\XX{\null$\null}%
-% \else
-% \gdef\XX{}%
-% \fi % section name
-% \XX$\langle\,${#2\eightrm\kern.5em#1}$\,\rangle$\XX}
-
\unprotect
\def\theCWEByskip {\blank[\v!small]}
@@ -649,264 +436,64 @@
{\par
\yskip}
-\defCWEBmacro\yskip%
+\defCWEBmacro\yskip
{\theCWEByskip}
\letCWEBmacro\Z = \le
-% \letCWEBmacro\ZZ = \let % now you can \write the control sequence \ZZ
+\letCWEBmacro\ZZ = \relax
\letCWEBmacro\* = *
-\defCWEBmacro\oct%
+\defCWEBmacro\oct
{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}
-\defCWEBmacro\hex%
+\defCWEBmacro\hex
{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}}
\defCWEBmacro\vb#1%
- {\leavevmode
+ {\dontleavehmode
\hbox
- {\kern.2\CWEBpt
+ {\kern.2em
\vrule
\vtop
{\vbox
{\hrule
- \hbox{\strut\kern.2\CWEBpt\.{#1}\kern.2\CWEBpt}}
+ \hbox{\strut\kern.2em\.{#1}\kern.2em}}
\hrule}%
\vrule
- \kern.2\CWEBpt}} % verbatim string
+ \kern.2em}} % verbatim string
-\def\onmaybe%
+\def\onmaybe
{\let\ifon=\maybe}
\let\maybe=\iftrue
\newif\ifon
-% \newif\iftitle
-% \newif\ifpagesaved
-%
-% \def\lheader%
-% {\mainfont
-% \the\pageno
-% \eightrm
-% \qquad
-% \grouptitle
-% \hfill
-% \title
-% \qquad
-% \mainfont
-% \topsecno} % top line on left-hand pages
-%
-% \def\rheader%
-% {\mainfont
-% \topsecno
-% \eightrm
-% \qquad
-% \title
-% \hfill
-% \grouptitle
-% \qquad
-% \mainfont
-% \the\pageno} % top line on right-hand pages
-%
-% \def\grouptitle
-% {\let\i=I
-% \let\j=J
-% \uppercase\expandafter{\expandafter\takethree\topmark}}
-%
-% \def\topsecno%
-% {\expandafter\takeone\topmark}
-%
-% \def\takeone #1#2#3{#1}
-% \def\taketwo #1#2#3{#2}
-% \def\takethree #1#2#3{#3}
-%
-% \def\nullsec%
-% {\eightrm
-% \kern-2em} % the \kern-2em cancels \qquad in headers
-%
-% \let\page=\pagebody % \def\page {\box255 }
-% \raggedbottom % \normalbottom % faster, but loses plain TeX footnotes
-%
-% \def\normaloutput#1#2#3%
-% {\shipout\vbox
-% {\ifodd
-% \pageno
-% \hoffset=\pageshift
-% \fi
-% \vbox to \fullpageheight
-% {\iftitle
-% \global\titlefalse
-% \else
-% \hbox to \pagewidth
-% {\vbox to 10pt{}%
-% \ifodd\pageno #3\else#2\fi}
-% \fi
-% \vfill#1}} % parameter #1 is the page itself
-% \global\advance\pageno by 1}
-%
-% \gtitle={\.{CWEB} output} % this running head is reset by starred sections
-%
-% \mark{\noexpand\nullsec0{\the\gtitle}}
-%
-% \def\title%
-% {\expandafter\uppercase\expandafter{\jobname}}
-%
-% \def\topofcontents%
-% {\centerline{\titlefont\title}
-% \vskip.7in
-% \vfill} % this material will start the table of contents page
-
-\def\botofcontents%
+\def\botofcontents
{\vfill
\centerline{\covernote}} % this material will end the table of contents page
-\def\covernote%
+\def\covernote
{}
% some leftover
\defCWEBmacro\contentspagenumber{0} % default page number for table of contents
-% \newdimen\pagewidth \pagewidth = 158mm % the width of each page
-% \newdimen\pageheight \pageheight = 223mm % the height of each page
-% \newdimen\fullpageheight \fullpageheight = 240mm % page height including headlines
-% \newdimen\pageshift \pageshift = 0in % shift righthand pages wrt lefthand ones
-%
-% \def\magnify#1%
-% {\mag=#1
-% \pagewidth=6.5truein
-% \pageheight=8.7truein
-% \fullpageheight=9truein
-% \setpage}
-%
-% \def\setpage%
-% {\hsize\pagewidth
-% \vsize\pageheight} % use after changing page size
-%
-% \def\contentsfile {\jobname.toc} % file that gets table of contents info
-% \def\readcontents {\input \contentsfile}
-% \def\readindex {\input \jobname.idx}
-% \def\readsections {\input \jobname.scn}
-%
-% \newwrite\cont
-% \output{\setbox0=\page % the first page is garbage
-% \openout\cont=\contentsfile
-% \write\cont{\catcode `\noexpand\@=11\relax} % \makeatletter
-% \global\output{\normaloutput\page\lheader\rheader}}
-% \setpage
-% \vbox to \vsize{} % the first \topmark won't be null
-
\defCWEBdummy\magnify#1% magnify the page
{}
-\defCWEBmacro\ch%
+\defCWEBmacro\ch
{\note{The following sections were changed by the change file:}
\let\*=\relax}
-% \newbox\sbox % saved box preceding the index
-% \newbox\lbox % lefthand column in the index
-%
-% \def\inx%
-% {\par\vskip6pt plus 1fil % we are beginning the index
-% \def\page{\box255 }
-% \normalbottom
-% \write\cont{} % ensure that the contents file isn't empty
-% \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
-% \closeout\cont % the contents information has been fully gathered
-% \output
-% {\ifpagesaved
-% \normaloutput{\box\sbox}\lheader\rheader
-% \fi
-% \global\setbox\sbox=\page
-% \global\pagesavedtrue}
-% \pagesavedfalse
-% \eject % eject the page-so-far and predecessors
-% \setbox\sbox\vbox{\unvbox\sbox} % take it out of its box
-% \vsize=\pageheight
-% \advance\vsize by -\ht\sbox % the remaining height
-% \hsize=.5\pagewidth
-% \advance\hsize by -10pt
-% % column width for the index (20pt between cols)
-% \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
-% \def\lr{L} % this tells whether the left or right column is next
-% \output
-% {\if L\lr
-% \global\setbox\lbox=\page
-% \gdef\lr{R}
-% \else
-% \normaloutput
-% {\vbox to\pageheight
-% {\box\sbox
-% \vss
-% \hbox to\pagewidth{\box\lbox\hfil\page}}}
-% \lheader
-% \rheader
-% \global\vsize\pageheight\gdef\lr{L}\global\pagesavedfalse\fi}
-% \message{Index:}
-% \parskip 0pt plus .5pt
-% \outer\def\I##1, {\par\hangindent2em\noindent##1:\kern1em} % index entry
-% \def\[##1]{$\underline{##1}$} % underlined index item
-% \rm
-% \rightskip0pt plus 2.5em
-% \tolerance 10000
-% \let\*=\lapstar
-% \hyphenpenalty 10000
-% \parindent0pt
-% \readindex}
-%
-% \def\fin%
-% {\par\vfill\eject % this is done when we are ending the index
-% \ifpagesaved\null\vfill\eject\fi % output a null index column
-% \if L\lr\else\null\vfill\eject\fi % finish the current page
-% \parfillskip 0pt plus 1fil
-% \def\grouptitle{NAMES OF THE SECTIONS}
-% \let\topsecno=\nullsec
-% \message{Section names:}
-% \output={\normaloutput\page\lheader\rheader}
-% \setpage
-% \def\note##1##2.{\quad{\eightrm##1~##2.}}
-% \def\Q{\note{Cited in section}} % crossref for mention of a section
-% \def\Qs{\note{Cited in sections}} % crossref for mentions of a section
-% \def\U{\note{Used in section}} % crossref for use of a section
-% \def\Us{\note{Used in sections}} % crossref for uses of a section
-% \def\I{\par\hangindent 2em}\let\*=*
-% \readsections}
-%
-% \def\con%
-% {\par\vfill\eject % finish the section names
-% %\ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
-% \rightskip = 0pt
-% \hyphenpenalty = 50
-% \tolerance = 200
-% \setpage
-% \output={\normaloutput\page\lheader\rheader}
-% \titletrue % prepare to output the table of contents
-% \pageno=\contentspagenumber
-% \def\grouptitle{TABLE OF CONTENTS}
-% \message{Table of contents:}
-% \topofcontents
-% \line{\hfil Section\hbox to3em{\hss Page}}
-% \let\ZZ=\contentsline
-% \readcontents\relax % read the contents info
-% \botofcontents
-% \end} % print the contents page(s) and terminate
-%
-% \def\contentsline#1#2#3#4%
-% {\ifnum#2=0
-% \smallbreak
-% \fi
-% \line{\consetup{#2}#1
-% \rm\leaders\hbox to .5em{.\hfil}\hfil\ #3\hbox to3em{\hss#4}}}
-%
-
\defCWEBmacro\consetup#1%
{\ifcase#1 \bf % depth -1 (@**)
\or % depth 0 (@*)
- \or \hskip2em % depth 1 (@*1)
- \or \hskip4em % depth 2 (@*2)
- \or \hskip6em % depth 3 (@*3)
- \or \hskip8em % depth 4 (@*4)
+ \or \hskip 2em % depth 1 (@*1)
+ \or \hskip 4em % depth 2 (@*2)
+ \or \hskip 6em % depth 3 (@*3)
+ \or \hskip 8em % depth 4 (@*4)
\or \hskip10em % depth 5 (@*5)
\else \hskip12em
\fi} % depth 6 or more
@@ -927,149 +514,65 @@
\thinspace
\fi}
-% \def\noinx%
-% {\let\inx=\end}
-%
-% \def\nosecs%
-% {\let\FIN=\fin
-% \def\fin%
-% {\let\parfillskip=\end
-% \FIN}}
-%
-% \def\nocon%
-% {\let\con=\end}
-%
-% \newcount\twodigits
-%
-% \def\hours%
-% {\twodigits=\time
-% \divide\twodigits by 60
-% \printtwodigits
-% \multiply\twodigits by -60
-% \advance\twodigits by \time
-% :\printtwodigits}
-%
-% \def\gobbleone1{}
-%
-% \def\printtwodigits%
-% {\advance\twodigits by 100
-% \expandafter\gobbleone\number\twodigits
-% \advance\twodigits by -100 }
-%
-% \def\today%
-% {\ifcase\month
-% \or January\or February\or March\or April\or May\or June%
-% \or July\or August\or September\or October\or November\or December%
-% \fi
-% \space
-% \number\day, \number\year}
-%
-% \def\datethis%
-% {\def\startsection%
-% {\leftline{\sc\today\ at \hours}
-% \bigskip
-% \let\startsection=\stsec
-% \stsec}}
-%
-% \def\datecontentspage%
-% {\def\topofcontents%
-% {\leftline{\sc\today\ at \hours}
-% \bigskip
-% \centerline{\titlefont\title}
-% \vfill}}
-
\defCWEBdummy\datethis {} % say `\datethis' in limbo, to get your listing timestamped before section 1
\defCWEBdummy\datecontentspage {} % timestamps the contents page
-\defCWEBmacro\TeX%
+\defCWEBmacro\TeX
{{\ifmmode\it\fi
- \leavevmode
+ \dontleavehmode
\hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}}
-
+
% alternative implementation
\newif\ifCWEBnotes
-\defCWEBmacro\Q {\CWEBnotesfalse \note{This code is cited in section}} % xref for mention of a section
-\defCWEBmacro\Qs {\CWEBnotestrue \note{This code is cited in sections}} % xref for mentions of a section
-
-\defCWEBmacro\U {\CWEBnotesfalse \note{This code is used in section}} % xref for use of a section
-\defCWEBmacro\Us {\CWEBnotestrue \note{This code is used in sections}} % xref for uses of a section
-
-\defCWEBmacro\A {\CWEBnotesfalse \note{See also section}} % xref for doubly defined section name
-\defCWEBmacro\As {\CWEBnotestrue \note{See also sections}} % xref for multiply defined section name
-
-\defCWEBmacro\ET% conjunction between two section numbers
- { and~}
-
-\defCWEBmacro\ETs% conjunction between the last two of several section numbers
- {, and~}
-
-%\def\processCWEBsectionnumbers[#1]%
-% {\bgroup
-% \def\CWEBcomma%
-% {\def\CWEBcomma{, }}%
-% \def\docommand##1%
-% {\bgroup
-% \def\[####1]{####1}%
-% \xdef\CWEBreference{##1}%
-% \egroup
-% \CWEBcomma{\naar{\donottest{##1}}[web:\CWEBreference]}}%
-% \processcommalist[{#1}]\docommand
-% \egroup}
-
-% \def\processCWEBsectionnumbers[#1]%
-% {\bgroup
-% \def\CWEBcomma%
-% {\def\CWEBcomma{, }}%
-% \def\docommand##1%
-% {\bgroup
-% \def\(####1){####1}%
-% \xdef\CWEBreference{##1}%
-% \egroup
-% \CWEBcomma
-% {\localcolortrue\naar{\donottest{##1}}[web:\CWEBreference]}}%
-% \bgroup
-% \def\[##1]{\(##1)}\let\(=\relax\xdef\CWEBreferences{#1}%
-% \egroup
-% \unexpanded\def\(##1){\[##1]}%
-% \processcommacommand[\CWEBreferences]\docommand
-% \egroup}
-
-\def\processCWEBsectionnumbers[#1]%
+\defCWEBmacro\Q {\CWEBnotesfalse \note{This code is cited in section}} % xref for mention of a section
+\defCWEBmacro\Qs {\CWEBnotestrue \note{This code is cited in sections}} % xref for mentions of a section
+
+\defCWEBmacro\U {\CWEBnotesfalse \note{This code is used in section}} % xref for use of a section
+\defCWEBmacro\Us {\CWEBnotestrue \note{This code is used in sections}} % xref for uses of a section
+
+\defCWEBmacro\A {\CWEBnotesfalse \note{See also section}} % xref for doubly defined section name
+\defCWEBmacro\As {\CWEBnotestrue \note{See also sections}} % xref for multiply defined section name
+
+\defCWEBmacro\ET { and~} % conjunction between two section numbers
+\defCWEBmacro\ETs {, and~} % conjunction between the last two of several section numbers
+
+\def\processCWEBsectionnumber#1%
{\bgroup
- \def\CWEBcomma%
- {\def\CWEBcomma{, }}%
- \def\docommand##1%
- {\bgroup
- \def\[####1]{####1}%
- \xdef\CWEBreference{##1}%
- \egroup
- \CWEBcomma{\localcolortrue\goto{\donottest{##1}}[web:\CWEBreference]}}%
- \processlist{(}{)}{,}\docommand(#1)
+ \def\[##1]{##1}%
+ \xdef\CWEBreference{#1}%
+ \egroup
+ \CWEBcomma{\goto{#1}[web:\CWEBreference]}}
+
+\unexpanded\def\processCWEBsectionnumbers[#1]%
+ {\bgroup
+ \def\CWEBcomma{\def\CWEBcomma{, }}%
+ \processlist(),\processCWEBsectionnumber(#1)%
\egroup}
-\def\processCWEBsectionnotes%
+\unexpanded\def\processCWEBsectionnotes
{\catcode`\s=12
\doprocessCWEBsectionnotes}
-\def\doprocessCWEBsectionnotes#1.%
+\def\doprocessCWEBsectionnote#1\ET#2#3.%
+ {\processCWEBsectionnumbers[#1]%
+ \if#2s%
+ {, and~\goto{##3}[web:#3]}%
+ \else
+ { and~\goto{##2##3}[web:#2#3]}%
+ \fi}%
+
+\unexpanded\def\doprocessCWEBsectionnotes#1.%
{\ifCWEBnotes
- \def\next##1\ET##2##3.%
- {\processCWEBsectionnumbers[##1]%
- \if##2s%
- {, and~\goto{##3}[web:##3]}%
- \else
- { and~\goto{##2##3}[web:##2##3]}%
- \fi}%
- \next#1.%
+ \doprocessCWEBsectionnote#1.%
\else
\goto{#1}[web:#1]%
\fi
\afterCWEBnote % inside group!
\egroup}
-\let\afterCWEBnote=\relax
+\let\afterCWEBnote\relax
\defCWEBmacro\note#1%
{\bgroup
@@ -1077,36 +580,63 @@
\def\afterCWEBnote{\par}%
\hangindent2em
%\baselineskip10pt
- \eightrm#1~\processCWEBsectionnotes}
+ \tx#1~\processCWEBsectionnotes}
-\def\oldCWEBmacroX#1:#2\X% original
+\unexpanded\def\oldCWEBmacroX#1:#2\X% original
{\ifmmode
\gdef\XX{\null$\null}%
\else
- \gdef\XX{}%
+ \glet\XX\empty
\fi % section name
- \XX$\langle\,${#2\eightrm\kern.5em#1}$\,\rangle$\XX}
+ \XX$\langle\,${#2\tx\kern.5em#1}$\,\rangle$\XX}
-\defCWEBmacro\ATH%
+\defCWEBmacro\ATH
{\oldCWEBmacroX\kern-.5em:Preprocessor definitions\X}
-\def\newCWEBmacroX#1:#2\X% original
+\unexpanded\def\newCWEBmacroX#1:#2\X% original
{\ifmmode
\gdef\XX{\null$\null}%
\else
- \gdef\XX{}%
+ \glet\XX\empty
\fi % section name
\XX$\langle\,$%
- {#2\eightrm\kern.5em\processCWEBsectionnumbers[{#1}]}%
+ {#2\tx\kern.5em\processCWEBsectionnumbers[{#1}]}%
$\,\rangle$\XX}
\defCWEBmacro\X#1:#2\X%
{\newCWEBmacroX#1:#2\X}
-\definemarking[CWEBfilename]
-\definemarking[CWEBsectiontitle]
-\definemarking[CWEBsectionnumber]
-\definemarking[CWEBsectiondepth]
+%D The next code is a bit messy because there is skipping over content
+%D and we have \type {\fi}'s in the source.
+
+\let\CWEBsecno\empty
+
+\definelist[cweb]
+
+\defCWEBmacro\startsection
+ {\rightskip=0pt % get out of C mode (cf. \B)
+ \sfcode`;=1500
+ \pretolerance 200
+ \hyphenpenalty 50
+ \exhyphenpenalty 50
+ \noindent
+ \bgroup
+ \let\*=\lapstar
+ \gotoCWEBsection{\bf\CWEBsecstar.\quad}[\CWEBsecno]%
+ \egroup}
+
+\defCWEBmacro\MN#1%
+ {\par % common code for \M, \N
+ \begingroup
+ \xdef\CWEBsecstar{#1}%
+ \let\*=\empty
+ \xdef\CWEBsecno{#1}% remove \* from section name
+ \endgroup
+ \ifx\CWEBsecno\CWEBsecstar
+ \onmaybe
+ \else
+ \ontrue
+ \fi}
\defCWEBmacro\M#1%
{\MN{#1}%
@@ -1118,16 +648,15 @@
\startsection
\pagereference[web:#1]%
\expanded{\marking[CWEBsectionnumber]{\secno}}%
- \expanded{\marking[CWEBsectiondepth]{\the\gdepth}}%
+ \expanded{\marking[CWEBsectiondepth]{\the\CWEBgdepth}}%
\ignorespaces}
\defCWEBmacro\N#1#2#3.%
- {\gdepth=#1%
+ {\CWEBgdepth=#1%
\MN{#2}% beginning of starred section
\ifon
- \ifnum#1<\secpagedepth
- \vfil
- \eject % force page break if depth is small
+ \ifnum#1<\CWEBsecpagedepth
+ \page
\else
\vfil
\penalty-100
@@ -1135,34 +664,16 @@
\theCWEBvskip
\fi
\fi
- \message{*\secno}% progress report
- \makesectionformat % context
- \defconvertedargument\ascii{#3}%
- \edef\next%
- {\write\CWEBcont % write to contents file
- {\string\ZZ{\ascii}{#1}{\secno}%
- {\sectionformat::\noexpand\userfolio}{\noexpand\realfolio}}}%
- \next % \ZZ{title}{depth}{sec}{page}
+ \writedatatolist[cweb][section=\CWEBsecno,title={#3},depth=#1]%
\ifon
\startsection
\pagereference[web:#2]%
\marking[CWEBsectiontitle] {#3}%
- \expanded{\marking[CWEBsectionnumber]{\secno}}%
- \expanded{\marking[CWEBsectiondepth]{\the\gdepth}}%
+ \expanded{\marking[CWEBsectionnumber]{\CWEBsecno}}%
+ \expanded{\marking[CWEBsectiondepth]{\the\CWEBgdepth}}%
{\bf#3.\quad}%
\ignorespaces}
-\defCWEBmacro\MN#1%
- {\par % common code for \M, \N
- {\xdef\secstar{#1}%
- \let\*=\empty
- \xdef\secno{#1}}% remove \* from section name
- \ifx\secno\secstar
- \onmaybe
- \else
- \ontrue
- \fi}
-
\newif\iflinktoCWEBfile
\def\setCWEBlinkfile#1%
@@ -1171,12 +682,11 @@
\unprotect
-\def\gotoCWEBsection#1[#2]%
+\unexpanded\def\gotoCWEBsection#1[#2]%
{\iflinktoCWEBfile
\bgroup
\setupinteraction[\c!color=,\c!style=]%
\let\savedreferenceprefix=\referenceprefix
- \localcolortrue
\goto{#1}[\otherCWEBfile::\savedreferenceprefix web:#2]%
\egroup
\else
@@ -1185,24 +695,10 @@
\protect
-\defCWEBmacro\startsection%
- {\rightskip=0pt % get out of C mode (cf. \B)
- \sfcode`;=1500
- \pretolerance 200
- \hyphenpenalty 50
- \exhyphenpenalty 50
- \noindent
- \bgroup
- \let\*=\lapstar
- \gotoCWEBsection{\bf\secstar.\quad}[\secno]%
- \egroup}
-
-\def\ignoreCWEBinput%
- {\let\normalinput=\input
- \def\input ##1 %
- {\let\input=\normalinput}}
+\unexpanded\def\ignoreCWEBinput
+ {\def\input ##1 {\let\input\normalinput}}
-\def\loadCWEBmacros#1%
+\unexpanded\def\loadCWEBmacros#1%
{\let\oldN=\N
\def\N{\bgroup\setbox0=\vbox\bgroup\endinput}%
\ignoreCWEBinput
@@ -1210,33 +706,27 @@
\egroup\egroup
\let\N=\oldN}
-\def\resetCWEBcontext%
- {\catcode`\|=12 % used in context discretionaries
- \everypar{} % used for context indentation and floats
- \parskip=0pt % no stretch between cweb paragraphs
- \parindent=1em} % is related to cweb backspace etc
+\unexpanded\def\resetCWEBcontext
+ {\catcode`\|=\othercatcode % used in context discretionaries
+ \everypar \emptytoks % used for context indentation and floats
+ \parskip \zeropoint % no stretch between cweb paragraphs
+ \parindent \emwidth} % is related to cweb backspace etc
-\newwrite\CWEBcont
-
-\def\processCWEBsource #1 %
+\unexpanded\def\processCWEBsource #1 %
{\bgroup
\resetCWEBcontext
\activateCWEB
\ignoreCWEBinput
- \immediate\openout\CWEBcont=#1.toc
- \write\CWEBcont{\noexpand\unprotect}
- \message{Source:}
+ \let\end\relax
\marking[CWEBfilename]{#1}
\ReadFile{#1.tex}\relax
- \write\CWEBcont{\noexpand\protect}
- \closeout\CWEBcont
\par
\egroup}
-\def\resetCWEBindexentry%
+\unexpanded\def\resetCWEBindexentry
{\xdef\currentCWEBindexentry{}}
-\def\showCWEBindexentry#1% can be redefined
+\unexpanded\def\showCWEBindexentry#1% can be redefined
{\theCWEBvskip
\vskip3\lineheight
\goodbreak
@@ -1244,7 +734,32 @@
{\pagereference[web:#1]\bf#1}%
\theCWEBvskip}
-\def\checkCWEBindexentry#1%
+
+ \def\dodofindfirstcharacter#1%
+ {\ifx#1\relax
+ \let\next=\egroup
+ \else
+ \handlecase
+ {\expandafter\ifnum\expandafter\catcode\expandafter`#1=11
+ \def\next##1\relax{\egroup\def\firstcharacter{#1}}%
+ \fi}%
+ \fi
+ \next}
+
+ \def\dofindfirstcharacter#1#2%
+ {\def\firstcharacter{}%
+ \bgroup
+ \defconvertedargument\ascii{#2}%
+ \let\next\dodofindfirstcharacter
+ \let\handlecase#1%
+ \expandafter\next\ascii\relax}
+
+ \def\FINDFIRSTCHARACTER
+ {\dofindfirstcharacter\uppercase}
+
+
+
+\unexpanded\def\checkCWEBindexentry#1%
{\bgroup
\def\\##1{##1}% a dummy that also removes the {}
\def\|##1{##1}% another dummy
@@ -1261,11 +776,14 @@
\showCWEBindexentry{\currentCWEBindexentry}}}%
\egroup}
-\def\theCWEBbeforeindex {\startcolumns}
-\def\theCWEBafterindex {\stopcolumns}
+\unexpanded\def\theCWEBbeforeindex {\startcolumns}
+\unexpanded\def\theCWEBafterindex {\stopcolumns}
-\def\processCWEBindex #1 %
- {\bgroup
+\unexpanded\def\processCWEBindex #1 %
+ {\par
+ \bgroup
+ \forgetall
+ \setupalign[verytolerant,flushleft,nothyphenated]
\resetCWEBcontext
\activateCWEB
\resetCWEBindexentry
@@ -1274,42 +792,36 @@
\checkCWEBindexentry{##1}%
\hangindent2em
\noindent##1:\kern1em%
- \def\next####1.%
- {\processCWEBsectionnumbers[{####1}]}%
+ \def\next####1.{\processCWEBsectionnumbers[{####1}]}%
\next}%
\def\[##1]%
{$\underline{##1}$}%
\let\*=\lapstar
- \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
-% \parskip 0pt plus .5pt
- \rightskip0pt plus 2.5em
- \tolerance 10000
- \hyphenpenalty 10000
- \parindent0pt
- \message{Index:}
- \marking[CWEBfilename] {#1}
- \marking[CWEBsectiontitle] {index}
+ \marking[CWEBfilename]{#1}
+ \marking[CWEBsectiontitle]{index}
\marking[CWEBsectionnumber]{}
\marking[CWEBsectiondepth]{}
- \loadCWEBmacros{#1}
+% \loadCWEBmacros{#1}
\theCWEBbeforeindex
\ReadFile{#1.idx}\relax
\theCWEBafterindex
\par
\egroup}
-\def\processCWEBsections #1 %
- {\bgroup
+\unexpanded\def\processCWEBsections #1 %
+ {\par
+ \bgroup
+ \forgetall
\resetCWEBcontext
\activateCWEB
- \loadCWEBmacros{#1}
+ % \loadCWEBmacros{#1}
\parfillskip = 0pt plus 1fil
\parindent = 0pt
\let\topsecno=\nullsec
\def\note##1%
{\quad
\bgroup
- \eightrm
+ \tx
##1~\processCWEBsectionnotes}
\def\Q {\CWEBnotesfalse \note{Cited in section}} % crossref for mention of a section
\def\Qs{\CWEBnotestrue \note{Cited in sections}} % crossref for mentions of a section
@@ -1317,57 +829,49 @@
\def\Us{\CWEBnotestrue \note{Used in sections}} % crossref for uses of a section
\def\I {\par\hangindent 2em}%
\let\*=*
- \message{Section names:}
- \marking[CWEBfilename] {#1}
- \marking[CWEBsectiontitle] {sections}
+ \marking[CWEBfilename]{#1}
+ \marking[CWEBsectiontitle]{sections}
\marking[CWEBsectionnumber]{}
\marking[CWEBsectiondepth]{}
- \loadCWEBmacros{#1}
+% \loadCWEBmacros{#1}
\ReadFile{#1.scn}\relax
- \par
\botofcontents
\par
\egroup}
-\def\processCWEBcontents #1 %
- {\bgroup
+\unexpanded\def\processCWEBcontents #1 %
+ {\par
+ \bgroup
+ \forgetall
\resetCWEBcontext
\activateCWEB
- \loadCWEBmacros{#1}
- \rightskip = 0pt
- \hyphenpenalty = 50
- \tolerance = 200
- \parindent = 0pt
- \line{\hfil Section\hbox to3em{\hss Page}}
- \let\ZZ=\contentsline
- \message{Table of contents:}
- \marking[CWEBfilename] {#1}
- \marking[CWEBsectiontitle] {table of contents}
+ \marking[CWEBfilename]{#1}
+ \marking[CWEBsectiontitle]{table of contents}
\marking[CWEBsectionnumber]{}
\marking[CWEBsectiondepth]{}
- \loadCWEBmacros{#1}
- \ReadFile{#1.toc}\relax
+ \forgetall
+ \placelist[cweb][criterium=all,command=\CWEBlistentry]
\par
\egroup}
-\defCWEBmacro\contentsline#1#2#3#4#5%
- {\ifnum#2=0
- \smallbreak
- \fi
- \line{\consetup{#2}#1
- \rm
- \leaders\hbox to .5em{.\hfil}\hfil\
- {\localcolortrue\goto{#3}[web:#3]}% below: \gotorealpage ? should be changed
- \hbox to3em{\localcolortrue\hss\gotorealpage{}{}{#5}{\translatednumber[#4]\presetgoto}}}}
-
-%D A last hack, needed because a file can overload of the
-%D above. (Some day: a check like \type{\ifx#1\CWEBdefined}.)
-
-\def\outer#1#2%
- {\ifx#2\undefined
- \expandafter#1\expandafter#2%
- \else
- \expandafter#1\expandafter\ThrowAway
- \fi}
+% {all}
+%
+% \structurelistuservariable
+% \rawstructurelistuservariable
+%
+% \goto{#3}[web:#3]
+
+\installstructurelistprocessor{cweb}
+ {\begingroup
+ \advance\leftskip 3em
+ \advance\rightskip3em
+ \currentlistentrydestinationattribute
+ \dontleavehmode
+ \llap{\hbox \currentlistentryreferenceattribute{number} to 3em{\structurelistuservariable{section}\hss}}%
+ \structurelistuservariable{title}%
+ \hfill
+ \rlap{\hbox \currentlistentryreferenceattribute{page} to 3em{\hss\structurelistuservariable{depth}}}%
+ \par
+ \endgroup}
\endinput
diff --git a/tex/context/modules/mkiv/m-database.mkiv b/tex/context/modules/mkiv/m-database.mkiv
index cc7dd3d72..49d62ea3d 100644
--- a/tex/context/modules/mkiv/m-database.mkiv
+++ b/tex/context/modules/mkiv/m-database.mkiv
@@ -13,7 +13,7 @@
%D For Mojca.
-\registerctxluafile{m-database}{1.001}
+\registerctxluafile{m-database}{}
\unprotect
diff --git a/tex/context/modules/mkiv/m-escrito.mkiv b/tex/context/modules/mkiv/m-escrito.mkiv
index 763857918..2d69fb218 100644
--- a/tex/context/modules/mkiv/m-escrito.mkiv
+++ b/tex/context/modules/mkiv/m-escrito.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\registerctxluafile{m-escrito}{1.001}
+\registerctxluafile{m-escrito}{}
%D This is a fun project and not meant for production (yet). It's a follow up on a
%D project by Taco presented at a Bacho\TeX\ meeting years ago. I probably messed up
diff --git a/tex/context/modules/mkiv/m-markdown.mkiv b/tex/context/modules/mkiv/m-markdown.mkiv
index 6e0036513..29d41341e 100644
--- a/tex/context/modules/mkiv/m-markdown.mkiv
+++ b/tex/context/modules/mkiv/m-markdown.mkiv
@@ -19,7 +19,7 @@
%D rendering (pagination, etc) of documents. As I'm no user myself, it
%D is up to others to provide documentation and examples.
-\registerctxluafile{m-markdown}{1.001}
+\registerctxluafile{m-markdown}{}
\unprotect
diff --git a/tex/context/modules/mkiv/m-matrix.mkiv b/tex/context/modules/mkiv/m-matrix.mkiv
index f59363e94..9cac69672 100644
--- a/tex/context/modules/mkiv/m-matrix.mkiv
+++ b/tex/context/modules/mkiv/m-matrix.mkiv
@@ -17,7 +17,7 @@
%D be made. Dalyoung does the clever bits, and Hans only cleanes up and
%D optimizes a bit.
-% \registerctxluafile{l-matrix}{1.001} % not yet
+% \registerctxluafile{l-matrix}{} % not yet
\startmodule[matrix]
@@ -70,10 +70,16 @@ end
-- todo: define a matrix at the tex end so that we have more control
+-- local fences = {
+-- parentheses = { left = "\\left(\\,", right = "\\,\\right)" },
+-- brackets = { left = "\\left[\\,", right = "\\,\\right]" },
+-- bars = { left = "\\left|\\,", right = "\\,\\right|" },
+-- }
+
local fences = {
- parentheses = { left = "\\left(\\,", right = "\\,\\right)" },
- brackets = { left = "\\left[\\,", right = "\\,\\right]" },
- bars = { left = "\\left|\\,", right = "\\,\\right|" },
+ parentheses = { "matrix:parentheses" },
+ brackets = { "matrix:brackets" },
+ bars = { "matrix:bars" },
}
-- one can add more fences
@@ -104,7 +110,10 @@ function matrix.typeset(m,options)
elseif tonumber(template) then
template = "%0." .. template .. "F"
end
- context.startmatrix(whatever)
+ context.startnamedmatrix(whatever)
+ if type(m[1]) ~= "table" then
+ m = { copy(m) }
+ end
for i=1, #m do
local mi = m[i]
for j=1,#mi do
@@ -118,31 +127,20 @@ function matrix.typeset(m,options)
end
context.NR()
end
- context.stopmatrix()
+ context.stopnamedmatrix()
elseif m then
context(m)
end
end
--- interchange two rows (i-th, j-th)
-
--- function matrix.swaprows(t,i,j)
--- if i <= #t and j <= #t then
--- t[i], t[j] = t[j], t[i]
--- return t
--- else
--- return "error: out of bound"
--- end
--- end
-
function matrix.swaprows(t,i,j)
local ti = t[i]
if not ti then
- return "error: no row i"
+ return "error: no row"
end
local tj = t[j]
if not tj then
- return "error: no row j"
+ return "error: no row"
end
t[i], t[j] = tj, ti
return t
@@ -150,28 +148,14 @@ end
-- interchange two columns (i-th, j-th)
--- function matrix.swapcolumns(t, i, j)
--- if i <= #t[1] and j <= #t[1] then
--- for k = 1, #t do
--- t[k][i], t[k][j] = t[k][j], t[k][i]
--- end
--- return t
--- else
--- return "error: out of bound"
--- end
--- end
-
function matrix.swapcolumns(t, i, j)
local t1 = t[1]
if not t1 then
return "error: no rows"
end
local n = #t1
- if i <= n then
- return "error: no row i"
- end
- if j <= n then
- return "error: no row j"
+ if i > n or j > n then
+ return "error: no column"
end
for k = 1, #t do
local tk = t[k]
@@ -315,7 +299,7 @@ local function determinant(m)
end
return s*d
else
- return "error: not a square matrix"
+ return "error: not a square matrix" -- not context(..)
end
end
@@ -387,7 +371,7 @@ matrix.rowEchelon = rowechelon
-- make matrices until its determinant is not 0
-function matrix.make(n,m,low,high)
+function matrix.make(m,n,low,high) -- m and n swapped
if not n then
n = 10
end
@@ -398,17 +382,16 @@ function matrix.make(n,m,low,high)
low = 0
end
if not high then
- high = 100
+ high = 10
end
- local t = { } -- make an empty n1 x n2 array
- local again = true
- for i=1,n do
+ local t = { }
+ for i=1,m do
t[i] = { }
end
while true do
- for i=1,n do
+ for i=1,m do
local ti = t[i]
- for j=1,m do
+ for j=1,n do
ti[j] = random(low,high)
end
end
@@ -483,14 +466,30 @@ end
local function solve(m,c)
local n = #m
if n ~= #c then
- return copy(m)
+ -- return "error: size mismatch"
+ return nil
end
local newm = copy(m)
local temp = copy(c)
+ local solution = copy(c)
for i=1,n do
insert(newm[i],temp[i])
end
- return rowechelon(newm,1)
+ newm = uppertri(newm, 0)
+ for k = n,1,-1 do
+ local val = 0
+ local new = newm[k]
+ for j = k+1, n do
+ val = val + new[j] * solution[j]
+ end
+ if new[k] == 0 then
+ -- return "error: no unique solution"
+ return nil
+ else
+ solution[k] = (new[n+1] - val)/new[k]
+ end
+ end
+ return solution
end
matrix.solve = solve
@@ -527,6 +526,9 @@ matrix.inverse = inverse
\continueifinputfile{m-matrix.mkiv}
+\usemodule[m-matrix]
+\usemodule[art-01]
+
\starttext
\startluacode
@@ -542,147 +544,323 @@ document.DemoMatrixA = {
document.DemoMatrixB = {
{ 0, 2, 4, -4, 1 },
{ 0, 0, 2, 3, 4 },
- { 2, 2, -6, 2, 4 },
+ { 2, 2, -6, 3, 4 },
{ 2, 0, -6, 9, 7 },
{ 2, 2, -6, 2, 4 },
- { 2, 2, -6, 2, 4 },
+}
+
+document.DemoMatrixC = {
+ { 3, 3, -1, 3 },
+ { -1, 4, 1, 3 },
+ { 5, 4, 0, 2 },
+ { 2, 4, 0, -1 },
}
\stopluacode
+\startbuffer[demo]
+\typebuffer
+\startalignment[middle]
+ \dontleavehmode\inlinebuffer
+\stopalignment
+\stopbuffer
+
+\setuphead[section][before={\testpage[5]\blank[2*big]}]
+
\startsubject[title={A symbolic matrix}]
+\startbuffer
\ctxmodulematrix{typeset(moduledata.matrix.symbolic("a", "m", "n"))}
\ctxmodulematrix{typeset(moduledata.matrix.symbolic("a", "m", "n", 4, 8))}
+\stopbuffer
+
+\getbuffer[demo]
+
+\stopsubject
+
+\startsubject[title={Generate a new $m \times n$ matrix}]
+
+\startbuffer
+\startluacode
+ moduledata.matrix.typeset(moduledata.matrix.make(4,3, 0,5))
+ context.qquad()
+ moduledata.matrix.typeset(moduledata.matrix.make(5,5,-1,5))
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
\startsubject[title={Swap two rows (2 and 4)}]
+\startbuffer
\startluacode
-moduledata.matrix.typeset(document.DemoMatrixA)
-context.blank()
-moduledata.matrix.swap(document.DemoMatrixA, 2, 4)
-context.blank()
-moduledata.matrix.typeset(document.DemoMatrixA)
+ moduledata.matrix.typeset(document.DemoMatrixA)
+ context("$\\qquad \\Rightarrow \\qquad$")
+ moduledata.matrix.typeset(moduledata.matrix.swaprows(document.DemoMatrixA,2,4))
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
-\startsubject[title={Multiply $3 \times r_2$}]
+\startsubject[title={Swap two columns (2 and 4)}]
+\startbuffer
\startluacode
-moduledata.matrix.typeset(document.DemoMatrixA)
-context.blank()
-moduledata.matrix.typeset(moduledata.matrix.multiply(document.DemoMatrixA, 2, 3))
+ moduledata.matrix.typeset(document.DemoMatrixA)
+ context("$\\qquad \\Rightarrow \\qquad$")
+ moduledata.matrix.typeset(moduledata.matrix.swapcolumns(document.DemoMatrixA,2, 4))
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
-\startsubject[title={Row 2 + $4 \times r_3$}]
+\startsubject[title={Multiply 3 to row 2($3 \times r_2$)}]
+\startbuffer
\startluacode
-moduledata.matrix.typeset(document.DemoMatrixA)
-context.blank()
-moduledata.matrix.sumrow(document.DemoMatrixA, 2, 3, 4)
-context.blank()
-moduledata.matrix.typeset(document.DemoMatrixA,{ fences = "bars" } )
+ moduledata.matrix.typeset(document.DemoMatrixA)
+ context("$\\qquad \\Rightarrow \\qquad$")
+ moduledata.matrix.typeset(moduledata.matrix.multiply(document.DemoMatrixA,2,3))
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
-\startsubject[title={Transpose a matrix}]
+\startsubject[title={Add 4 times of row 3 to row 2($r_2 + 4 \times r_3$)}]
+\startbuffer
\startluacode
-moduledata.matrix.typeset(document.DemoMatrixA)
-context.blank()
-moduledata.matrix.typeset(moduledata.matrix.transpose(document.DemoMatrixA))
+ moduledata.matrix.typeset(document.DemoMatrixA)
+ context("$\\qquad \\Rightarrow \\qquad$")
+ moduledata.matrix.sumrow(document.DemoMatrixA,2,3,4)
+ moduledata.matrix.typeset(document.DemoMatrixA)
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
+
+\stopsubject
+
+\startsubject[title={Transpose a matrix}]
+\startbuffer
+\startluacode
+ moduledata.matrix.typeset(document.DemoMatrixA)
+ context("$\\qquad \\Rightarrow \\qquad$")
+ moduledata.matrix.typeset(moduledata.matrix.transpose(document.DemoMatrixA))
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
\startsubject[title={The inner product of two vectors}]
+\startbuffer
+\startluacode
+ context("$<1,2,3> \\cdot <3,1,2> \\ =\\ $ ")
+ context( moduledata.matrix.inner({ 1, 2, 3 }, { 3, 1, 2 }))
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
+
\startluacode
-context(moduledata.matrix.inner({ 1, 2, 3 }, { 3, 1, 2 }))
-context.blank()
+context("$<1,2,3> \\cdot <3,1,2, 4> \\ =\\ $ ")
context(moduledata.matrix.inner({ 1, 2, 3 }, { 3, 1, 2, 4 }))
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
+
+\stopsubject
\startsubject[title={The product of two matrices}]
+\startbuffer
\startluacode
-moduledata.matrix.typeset(document.DemoMatrixA)
-context.blank()
-moduledata.matrix.typeset(moduledata.matrix.product(document.DemoMatrixA,document.DemoMatrixA))
+ context("$\\ $")
+ moduledata.matrix.typeset(document.DemoMatrixB)
+ context("$\\cdot$")
+ moduledata.matrix.typeset(document.DemoMatrixA)
+ context("$ = $")
+ moduledata.matrix.typeset(moduledata.matrix.product
+ (document.DemoMatrixB,document.DemoMatrixB))
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
\startsubject[title={An Upper Triangular Matrix}]
-\ctxmodulematrix{typeset(moduledata.matrix.uppertri(document.DemoMatrixB))}
+\startbuffer
+\startluacode
+ moduledata.matrix.typeset(document.DemoMatrixB)
+ context("$\\qquad \\Rightarrow \\qquad$")
+ moduledata.matrix.typeset(moduledata.matrix.uppertri(document.DemoMatrixB))
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
-\startsubject[title={A determinant}]
+\stopsubject
+\startsubject[title={Determinant: using triangulation}]
+
+\startbuffer
\startluacode
-local m = {
- { 1, 2, 4 },
- { 0, 0, 2 },
- { 2, 2, -6 },
-}
-context(moduledata.matrix.determinant(m, "determinant=yes" ))
+ local m = {
+ { 1, 2, 4 },
+ { 0, 0, 2 },
+ { 2, 2, -6 },
+ { 2, 2, -6 },
+ }
+ moduledata.matrix.typeset(m, {fences="bars"})
+ context("$\\qquad = \\qquad$")
+ moduledata.matrix.determinant(m)
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
+
+\startbuffer
+\startluacode
+ moduledata.matrix.typeset(document.DemoMatrixC, { fences = "bars" })
+ context("$\\qquad = \\qquad$")
+ context(moduledata.matrix.determinant(document.DemoMatrixC))
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
-\startsubject[title={Row echelon form}]
+\startsubject[title={Determinant: using Laplace Expansion}]
+\startbuffer
\startluacode
-local m = {
- { 1, 3, -2, 0, 2, 0, 0 },
- { 2, 6, -5, -2, 4, -3, -1 },
- { 0, 0, 5, 10, 0, 15, 5 },
- { 2, 6, 0, 8, 4, 18, 6 },
-}
+ moduledata.matrix.typeset(document.DemoMatrixC, { fences = "bars" })
+ context("$\\qquad = \\qquad$")
+ context(moduledata.matrix.laplace(document.DemoMatrixC))
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
+
+\stopsubject
+
+\startsubject[title={Example of Laplace Expansion using submatrix function}]
-moduledata.matrix.typeset(m)
-context.blank()
-moduledata.matrix.typeset(moduledata.matrix.rowechelon(m,1), { determinant = "yes" })
+\startbuffer
+\startluacode
+ local m = {
+ { 1, 5, 4, 2 },
+ { 5, 2, 0, 4 },
+ { 2, 2, 1, 1 },
+ { 1, 0, 0, 5 },
+ }
+ local options = {fences = "bars"}
+
+ moduledata.matrix.typeset(m,options)
+ context("\\par $=$")
+ for j = 1, #m[1] do
+ local mm = moduledata.matrix.submatrix(m, 1, j)
+ local factor = (-1)^(1+j) *(m[1][j])
+ context("\\ ($%d$) \\cdot ", factor)
+ moduledata.matrix.typeset(mm, options)
+ if j < #m[1] then
+ context("\\ $+$ ")
+ end
+ end
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
-\startsubject[title={Solving linear equation}]
+\startsubject[title={Row echelon form}]
+\startbuffer
\startluacode
-local m = {
- { 1, 3, -2, 0 },
- { 2, 0, 1, 2 },
- { 6, -5, -2, 4 },
- { -3, -1, 5, 10 },
-}
+ local m = {
+ { 1, 3, -2, 0, 2, 0, 0 },
+ { 2, 6, -5, -2, 4, -3, -1 },
+ { 0, 0, 5, 10, 0, 15, 5 },
+ { 2, 6, 0, 8, 4, 18, 6 },
+ }
+ moduledata.matrix.typeset(m)
+ context("$\\Rightarrow$")
+ moduledata.matrix.typeset(moduledata.matrix.rowechelon(m,1))
+\stopluacode
+
+\stopbuffer
-local c = { 5, 2, 6, 8 }
-
-moduledata.matrix.typeset(moduledata.matrix.solve(m,c))
-context.blank()
-moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = 6 })
-context.blank()
-moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "no" })
-context.blank()
-moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "%0.3f" })
-context.blank()
-moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "%0.4F" })
+\getbuffer[demo]
+
+\stopsubject
+
+\startsubject[title={Solving linear equation}]
+
+\startbuffer
+\startluacode
+ local m = {
+ { 1, 3, -2, 0 },
+ { 2, 0, 1, 2 },
+ { 6, -5, -2, 4 },
+ { -3, -1, 5, 10 },
+ }
+
+ local c = { 5, 2, 6, 8 }
+
+ moduledata.matrix.typeset(moduledata.matrix.solve(m,c))
+ context.blank()
+ moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = 6 })
+ context.blank()
+ moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "no" })
+ context.blank()
+ moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "%0.3f" })
+ context.blank()
+ moduledata.matrix.typeset(moduledata.matrix.solve(m,c), { template = "%0.4F" })
\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
\startsubject[title={Inverse matrix}]
-\startcombination[2*1]
- {\ctxlua{moduledata.matrix.typeset { { 1, 1, 1 }, { 0, 2, 3 }, { 3, 2, 1 } }}} {}
- {\ctxlua{moduledata.matrix.typeset(moduledata.matrix.inverse { { 1, 1, 1 }, { 0, 2, 3 }, { 3, 2, 1 } })}} {}
-\stopcombination
+\startbuffer
+\startluacode
+ local m = {
+ { 1, 1, 1 },
+ { 0, 2, 3 },
+ { 3, 2, 1 },
+ }
+ context("$A =\\quad$")
+ moduledata.matrix.typeset(m)
+ context("$\\qquad A^{-1} = \\quad$")
+ moduledata.matrix.typeset(moduledata.matrix.inverse(m))
+ context("\\blank\\ ")
+ moduledata.matrix.typeset(m)
+ context("$\\cdot$")
+ moduledata.matrix.typeset(moduledata.matrix.inverse(m))
+ context("$ = $")
+ moduledata.matrix.typeset(moduledata.matrix.product(m, moduledata.matrix.inverse(m)))
+\stopluacode
+\stopbuffer
+
+\getbuffer[demo]
\stopsubject
diff --git a/tex/context/modules/mkiv/m-media.mkiv b/tex/context/modules/mkiv/m-media.mkiv
new file mode 100644
index 000000000..e2b324279
--- /dev/null
+++ b/tex/context/modules/mkiv/m-media.mkiv
@@ -0,0 +1,30 @@
+%D \module
+%D [ file=m-media,
+%D version=2017.10.17,
+%D title=\CONTEXT\ Backend Macros,
+%D subtitle=Media support,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Because media support in acrobat is unstable over years and because it depends
+%D on flash support is no longer part of the core. If at some point decent support
+%D for video shows up again we might look into it again.
+
+\endinput % soon this will go
+
+\unprotect
+
+\registerctxluafile{grph-u3d}{} % grph-inc.mkiv
+\registerctxluafile{lpdf-u3d}{} % back-u3d.mkiv
+\registerctxluafile{back-u3d}{} % back-pdf.mkiv
+
+\registerctxluafile{grph-swf}{} % grph-inc.mkiv
+\registerctxluafile{lpdf-swf}{} % back-u3d.mkiv
+\registerctxluafile{back-swf}{} % back-pdf.mkiv
+
+\protect \endinput
diff --git a/tex/context/modules/mkiv/m-nodechart.mkvi b/tex/context/modules/mkiv/m-nodechart.mkvi
index c9d985850..ab117efe0 100644
--- a/tex/context/modules/mkiv/m-nodechart.mkvi
+++ b/tex/context/modules/mkiv/m-nodechart.mkvi
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\registerctxluafile{m-nodechart}{1.001}
+\registerctxluafile{m-nodechart}{}
\usemodule[chart]
diff --git a/tex/context/modules/mkiv/m-punk.mkiv b/tex/context/modules/mkiv/m-punk.mkiv
index f7e17da83..b72abd64d 100644
--- a/tex/context/modules/mkiv/m-punk.mkiv
+++ b/tex/context/modules/mkiv/m-punk.mkiv
@@ -13,6 +13,7 @@
\startluacode
local concat = table.concat
+local round = math.round
local chardata = characters.data
local fontdata = fonts.hashes.identifiers
@@ -85,7 +86,7 @@ function metapost.characters.process(mpxformat, name, instances, scalefactor)
scalefactor = scalefactor or 1
instances = instances or metapost.characters.instances or 10
local fontname = file.removesuffix(file.basename(name))
- local hash = file.robustname(string.format("%s %05i %03i", fontname, scalefactor*1000, instances))
+ local hash = file.robustname(string.format("%s %05i %03i", fontname, round(scalefactor*1000), instances))
local lists = containers.read(fonts.mp.cache, hash)
if not lists then
statistics.starttiming(flusher)
@@ -203,7 +204,7 @@ metapost.characters.flusher = flusher
statistics.register("metapost font generation", function()
local time = statistics.elapsedtime(flusher)
if total > 0 then
- return string.format("%i glyphs, %.3f seconds runtime, %i glyphs/second", total, time, total/time)
+ return string.format("%i glyphs, %.3f seconds runtime, %0.3f glyphs/second", total, time, total/time)
else
return string.format("%i glyphs, %.3f seconds runtime", total, time)
end
diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv
index a7d9f8b5c..12b54b9ac 100644
--- a/tex/context/modules/mkiv/m-scite.mkiv
+++ b/tex/context/modules/mkiv/m-scite.mkiv
@@ -45,7 +45,7 @@
-- todo: hook into the pretty print code
-- todo: a simple catcode regime with only \ { }
-local gsub, sub, find = string.gsub, string.sub, string.find
+local gsub, sub, find, lower = string.gsub, string.sub, string.find, string.lower
local concat = table.concat
local formatters = string.formatters
local lpegmatch = lpeg.match
@@ -57,13 +57,14 @@ buffers.scite = scite
-- context output:
local f_def_color = formatters["\\definecolor[slxc%s][h=%02X%02X%02X]%%"]
-local f_fore_none = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s#1}}%%"]
-local f_fore_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s\\bf#1}}%%"]
-local f_none_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\bf#1}}%%"]
-local f_none_none = formatters["\\unexpanded\\def\\slx%s#1{{#1}}%%"]
-local f_texstyled = formatters["\\slx%s{%s}"]
-local f_hanging = formatters["\\slxb{%s}%s\\slxe"]
+local f_fore_none = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s#1}\\slxbreak}%%"]
+local f_fore_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\slxc%s\\bf#1}\\slxbreak}%%"]
+local f_none_bold = formatters["\\unexpanded\\def\\slx%s#1{{\\bf#1}\\slxbreak}%%"]
+local f_none_none = formatters["\\unexpanded\\def\\slx%s#1{{#1}\\slxbreak}%%"]
+local f_texstyled = formatters["\\slx%s{%s}\\slxbreak"]
+local f_hanging = formatters["\\slxb{%r}%s\\slxe"] -- we need to round: lua 5.3
+local v_none = interfaces.variables.none
local f_mapping = [[
\let\string\slxL\string\letterleftbrace
@@ -152,7 +153,9 @@ local function exportstyled(lexer,text)
local position = result[i+1]
local txt = sub(text,start,position-1)
txt = lpegmatch(replacer,txt)
- if whites[style] then
+ if txt == "" then
+ -- skip
+ elseif whites[style] then
buffer[#buffer+1] = txt
else
buffer[#buffer+1] = f_texstyled(style,txt)
@@ -167,53 +170,144 @@ function scite.installcommands()
context(exportcolors())
end
-local p1 = lpeg.tsplitat(lpeg.patterns.newline)
-local p2 = lpeg.P("\\slxS ")^1
-local p3 = lpeg.Cs((lpeg.Cp() * lpeg.P(" ") * lpeg.Cp() / function(b,e) return "\\slxF{" .. (e-b-1) .. "}" end
- + (1-lpeg.P(" "))^1)^0)
+local function slxF(b,e)
+ local d = (e - b)/6
+ if d > 0 then
+ return "\\slxF{" .. d .. "}"
+ else
+ return " "
+ end
+end
--- slxb could have a \hskip so then we can replace the slxS's
+local p1 = lpeg.tsplitat(lpeg.patterns.newline)
+local p2 = lpeg.P("\\slxS ")
+local p3 = p2^1
+local p4 = lpeg.Cs( ( (lpeg.Cp() * p2 * p2^1 * lpeg.Cp()) / slxF + lpeg.P(1) )^0 )
local function indent(str)
local l = lpegmatch(p1,str)
for i=1,#l do
local s = l[i]
if #s > 0 then
- local n = lpegmatch(p2,s)
+ local n = lpegmatch(p3,s)
if n then
- n = (n-1)/6
+ n = (n-1)/6 -- length of "\\slxS "
else
n = 0
end
-s = lpegmatch(p3,s) -- can be combined
+ if n > 0 then
+ s = sub(s,n*6+1)
+ end
+ s = lpegmatch(p4,s) -- can be combined
l[i] = f_hanging(n,s) -- "\\slxb{%s}%s\\slxe "
--- print(">",s)
--- print("<",l[i])
end
end
return concat(l,"\n")
end
+local assignbuffer = buffers.assign
+local getcontent = buffers.getcontent
+local loaddata = io.loaddata
+local loadedlexers = scite.loadedlexers
+
local function lexdata(data,lexname)
- local styled = exportstyled(scite.loadedlexers[lexname],data or "")
- styled = indent(styled)
- buffers.assign("lex",styled)
+ if not data then
+ data = ""
+ elseif data ~= "" then
+ if data and not find(data,"[\r\n]$") then
+ -- fix for lexbyline
+ data = data .. "\r"
+ end
+ if lexname == v_none then
+-- data = string.formatters["%!tex!"](data)
+ data = exportstyled(loadedlexers["dummy"] or loadedlexers.tex,data)
+ else
+ data = exportstyled(loadedlexers[lexname] or loadedlexers.tex,data)
+ end
+ data = indent(data)
+ end
+io.savedata("temp.logs ",data)
+ assignbuffer("lex",data)
end
scite.lexdata = lexdata
function scite.lexbuffer(name,lexname)
- lexdata(buffers.getcontent(name) or "",lexname or "tex")
+ lexdata(getcontent(name) or "",lexname or "tex")
end
function scite.lexfile(filename,lexname)
- lexdata(io.loaddata(filename) or "",lexname or file.suffix(filename))
+ lexdata(loaddata(filename) or "",lexname or file.suffix(filename))
+end
+
+interfaces.implement {
+ name = "scitelexfile",
+ arguments = "string",
+ actions = scite.lexfile,
+}
+
+interfaces.implement {
+ name = "scitelexbuffer",
+ arguments = { "string", "string" },
+ actions = scite.lexbuffer,
+}
+
+interfaces.implement {
+ name = "sciteinstallcommands",
+ actions = scite.installcommands,
+}
+
+local startInlineScite = context.startInlineScite
+local stopInlineScite = context.stopInlineScite
+local startDisplayScite = context.startDisplayScite
+local stopDisplayScite = context.stopDisplayScite
+
+local lexdata = buffers.scite.lexdata
+
+local handler = visualizers.newhandler {
+ startinline = function(settings) startInlineScite(settings.name or "") end,
+ stopinline = function(settings) stopInlineScite() end,
+ startdisplay = function(settings) startDisplayScite(settings.name or "") end,
+ stopdisplay = function(settings) stopDisplayScite() end,
+ noescape = true,
+}
+
+local knownlexers = scite.knownlexers
+
+local parser = function(content,specification)
+ local method = lower(specification.method)
+ lexdata(content,knownlexers[method] or method)
end
--- html output
+local visualizer = {
+ handler = handler,
+ parser = parser,
+}
+
+visualizers.register("cld", visualizer)
+visualizers.register("tex", visualizer)
+visualizers.register("lua", visualizer)
+visualizers.register("mps", visualizer)
+visualizers.register("xml", visualizer)
+visualizers.register("bibtex",visualizer)
+visualizers.register("btx", visualizer)
+visualizers.register("web", visualizer)
+visualizers.register("cpp", visualizer)
+visualizers.register("txt", visualizer)
+-----------.register("sql", visualizer)
\stopluacode
+\definetyping[TEX] [option=cld]
+\definetyping[LUA] [option=lua]
+\definetyping[BTX] [option=bibtex]
+\definetyping[MPS] [option=mps]
+\definetyping[MP] [option=mps]
+\definetyping[CPP] [option=web]
+\definetyping[WEB] [option=web]
+\definetyping[TXT] [option=txt]
+\definetyping[NONE][option=none]
+
% This is a preliminary interface.
\unprotect
@@ -221,22 +315,38 @@ end
\newdimen\scitespaceskip
\unexpanded\def\buff_scite_slxb#1%
- {%\begingroup
- \hangindent\numexpr#1+2\relax\scitespaceskip
+ {\hangindent\numexpr#1+2\relax\scitespaceskip
+ \hskip#1\scitespaceskip
\hangafter 1\relax}
\unexpanded\def\buff_scite_slxe
- {\par
- }%\endgroup}
-
-\unexpanded\def\installscitecommands
- {\ctxlua{buffers.scite.installcommands()}%
- \let\installscitecommands\relax
- \scitespaceskip\fontcharwd\font`0\relax
- \unexpanded\def\slxS{\hskip\scitespaceskip}%
- \unexpanded\def\slxF##1{\hskip##1\scitespaceskip\relax}%
+ {\par}
+
+\unexpanded\def\buff_scite_slxs {\hskip\scitespaceskip\relax}
+\unexpanded\def\buff_scite_slxf#1{\hskip#1\scitespaceskip\relax}
+
+\unexpanded\def\installscitecommandsinline
+ {\scitespaceskip\interwordspace % \fontcharwd\font`0\relax % brrrrr
+ \let\slxb\gobbleoneargument
+ \let\slxe\space
+ \let\installscitecommandsinline\relax}
+
+\unexpanded\def\installscitecommandsdisplay
+ {\scitespaceskip\interwordspace % \fontcharwd\font`0\relax % brrrrr
\let\slxb\buff_scite_slxb
- \let\slxe\buff_scite_slxe}
+ \let\slxe\buff_scite_slxe
+ \let\installscitecommandsdisplay\relax}
+
+\clf_sciteinstallcommands
+
+\installscitecommandsinline
+
+\let\slxS\buff_scite_slxs
+\let\slxF\buff_scite_slxf
+
+\def\module_scite_inherit_typing
+ {\buff_verbatim_initialize_typing_one
+ \buff_verbatim_set_line_margin}
\unexpanded\def\startscite
{\begingroup
@@ -254,10 +364,12 @@ end
{\dosingleargument\module_scite_file}
\unexpanded\def\module_scite_file[#1]%
- {\start
- \ctxlua{buffers.scite.lexfile("#1")}%
- \installscitecommands
+ {\begingroup
+ \setcatcodetable\ctxcatcodes % needed in xml
+ \clf_scitelexfile{#1}%
\tt
+ \installscitecommandsdisplay
+ \module_scite_inherit_typing
\dontcomplain
\raggedright
\startcontextcode
@@ -265,27 +377,80 @@ end
\getbuffer[lex]
\stoplines
\stopcontextcode
- \stop}
+ \endgroup}
\unexpanded\def\scitebuffer
- {\dodoubleargument\module_scite_buffer}
+ {\dodoubleempty\module_scite_buffer}
\unexpanded\def\module_scite_buffer[#1][#2]%
- {\start
+ {\begingroup
+ \setcatcodetable\ctxcatcodes % needed in xml
\ifsecondargument
- \ctxlua{buffers.scite.lexbuffer("#2","#1")}%
+ \clf_scitelexbuffer{#2}{#1}%
\else
- \ctxlua{buffers.scite.lexbuffer("#1","tex")}%
+ \clf_scitelexbuffer{#1}{tex}%
\fi
- \installscitecommands
\tt
+ \installscitecommandsdisplay
+ \module_scite_inherit_typing
\dontcomplain
\raggedright
- \setcatcodetable\ctxcatcodes % needed in xml
\startlines
- \getbuffer[lex]%
+ \getbuffer[lex]
\stoplines
- \stop}
+ \endgroup}
+
+\unexpanded\def\sciteinlinebuffer
+ {\dodoubleempty\module_scite_buffer_inline}
+
+\unexpanded\def\module_scite_buffer_inline[#1][#2]%
+ {\dontleavehmode
+ \begingroup
+ \setcatcodetable\ctxcatcodes % needed in xml
+ \ifsecondargument
+ \clf_scitelexbuffer{#2}{#1}%
+ \else
+ \clf_scitelexbuffer{#1}{tex}%
+ \fi
+ \tt
+ \installscitecommandsinline
+ \module_scite_inherit_typing
+ \dontcomplain
+ \getbuffer[lex]%
+ \endgroup}
+
+\unexpanded\def\startInlineScite#1%
+ {\dontleavehmode
+ \begingroup
+ \setcatcodetable\ctxcatcodes % needed in xml
+ \tt
+ \installscitecommandsinline
+ \dontcomplain
+ \ignorespaces
+ \clf_getbuffercontent{lex}% much faster than getbuffer
+ \removeunwantedspaces}
+
+\unexpanded\def\stopInlineScite
+ {\endgroup}
+
+\unexpanded\def\startDisplayScite#1%
+ {\begingroup
+ \setcatcodetable\ctxcatcodes % needed in xml
+ \tt
+ \installscitecommandsdisplay
+ \dontcomplain
+\buff_verbatim_initialize_typing_one
+\buff_verbatim_set_line_margin
+ \raggedright
+ \startlines
+ \clf_getbuffer{lex}}
+
+\unexpanded\def\stopDisplayScite
+ {\stoplines
+ \endgroup}
+
+\unexpanded\def\slxbreak
+ {\allowbreak}
\protect
@@ -335,4 +500,13 @@ end
% \getbuffer[demo] \scitebuffer[demo]
+\startbuffer[foo]
+This is text. % line 1
+This is text. % line 2
+\stopbuffer
+
+\scitebuffer[none][foo]
+
+\sciteinlinebuffer[none][foo]
+
\stoptext
diff --git a/tex/context/modules/mkiv/m-spreadsheet.mkiv b/tex/context/modules/mkiv/m-spreadsheet.mkiv
index 914a2b57a..1d76d86ab 100644
--- a/tex/context/modules/mkiv/m-spreadsheet.mkiv
+++ b/tex/context/modules/mkiv/m-spreadsheet.mkiv
@@ -13,7 +13,7 @@
%D This is an experimental follow up on discussion on the mailing list.
-\registerctxluafile{m-spreadsheet}{1.001}
+\registerctxluafile{m-spreadsheet}{}
\unprotect
diff --git a/tex/context/modules/mkiv/m-subsub.mkiv b/tex/context/modules/mkiv/m-subsub.mkiv
index 88be11680..e0f6b1f27 100644
--- a/tex/context/modules/mkiv/m-subsub.mkiv
+++ b/tex/context/modules/mkiv/m-subsub.mkiv
@@ -12,65 +12,29 @@
\unprotect
-\definesection[\s!section-8]
-\definesection[\s!section-9]
-\definesection[\s!section-10]
-\definesection[\s!section-11]
-\definesection[\s!section-12]
+\writestatus\m!system{}
+\writestatus\m!system{\the\maxstructuredepth\space levels sections are already predefined}
+\writestatus\m!system{}
-\definehead
- [\v!subsubsubsubsubsection]
- [\c!section=\s!section-8,
- \c!default=\v!subsubsubsubsection]
+\protect
-\definehead
- [\v!subsubsubsubsubsubsection]
- [\c!section=\s!section-9,
- \c!default=\v!subsubsubsubsubsection]
+\continueifinputfile{m-subsub.mkiv}
-\definehead
- [\v!subsubsubsubsubsubsubsection]
- [\c!section=\s!section-10,
- \c!default=\v!subsubsubsubsubsubsection]
+\starttext
-\definehead
- [\v!subsubsubsubsubsubsubsubsection]
- [\c!section=\s!section-11,
- \c!default=\v!subsubsubsubsubsubsubsection]
+ % \part {level 1 part}
+ \chapter {level 2 chapter}
+ \section {level 3 section}
+ \subsection {level 4 subsection}
+ \subsubsection {level 5 subsubsection}
+ \subsubsubsection {level 6 subsubsubsection}
+ \subsubsubsubsection {level 7 subsubsubsubsection}
+ \subsubsubsubsubsection {level 8 subsubsubsubsubsection}
+ \subsubsubsubsubsubsection {level 9 subsubsubsubsubsubsection}
+ \subsubsubsubsubsubsubsection {level 10 subsubsubsubsubsubsubsection}
+ \subsubsubsubsubsubsubsubsection {level 11 subsubsubsubsubsubsubsubsection}
+ \subsubsubsubsubsubsubsubsubsection {level 12 subsubsubsubsubsubsubsubsubsection}
-\definehead
- [\v!subsubsubsubsubsubsubsubsubsection]
- [\c!section=\s!section-12,
- \c!default=\v!subsubsubsubsubsubsubsubsection]
+ In case you wonder: level 1 part.
-\definehead
- [\v!subsubsubsubsubsubject]
- [\c!coupling=\v!subsubsubsubsubsection,
- \c!default=\v!subsubsubsubsubsection,
- \c!incrementnumber=\v!no]
-
-\definehead
- [\v!subsubsubsubsubsubsubject]
- [\c!coupling=\v!subsubsubsubsubsubsection,
- \c!default=\v!subsubsubsubsubsubsection,
- \c!incrementnumber=\v!no]
-
-\definehead
- [\v!subsubsubsubsubsubsubsubject]
- [\c!coupling=\v!subsubsubsubsubsubsubsection,
- \c!default=\v!subsubsubsubsubsubsubsection,
- \c!incrementnumber=\v!no]
-
-\definehead
- [\v!subsubsubsubsubsubsubsubsubject]
- [\c!coupling=\v!subsubsubsubsubsubsubsubsection,
- \c!default=\v!subsubsubsubsubsubsubsubsection,
- \c!incrementnumber=\v!no]
-
-\definehead
- [\v!subsubsubsubsubsubsubsubsubsubject]
- [\c!coupling=\v!subsubsubsubsubsubsubsubsubsection,
- \c!default=\v!subsubsubsubsubsubsubsubsubsection,
- \c!incrementnumber=\v!no]
-
-\protect \endinput
+\stoptext
diff --git a/tex/context/modules/mkiv/m-three.mkiv b/tex/context/modules/mkiv/m-three.mkiv
new file mode 100644
index 000000000..c8ff2167a
--- /dev/null
+++ b/tex/context/modules/mkiv/m-three.mkiv
@@ -0,0 +1,72 @@
+%D \module
+%D [ file=m-three,
+%D version=2017.11.08,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=\METAPOST\ pseudo-3D module support,
+%D author=Hans Hagen and Alan Braslau,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\defineMPinstance
+ [three]
+ [\s!format=metafun,
+ \s!extensions=\v!yes,
+ \s!initializations=\v!yes,
+ \c!method=\s!double]
+
+\startMPdefinitions{three}
+ loadmodule "tres" ;
+\stopMPdefinitions
+
+\protect
+
+\continueifinputfile{m-three.mkiv}
+
+%D We put this test here as in \type {meta-tex.mkiv} it would abort due to redefinition
+%D of namespaces.
+
+\starttext
+
+%D Alan: we need to make a fill example:
+
+\startMPpage[instance=three]
+ path f ; f := (
+ projection Origin --
+ projection (1,0,0) --
+ projection (1,1,0) --
+ projection (0,1,0) --
+ projection (0,1,1) --
+ projection (1,1,1) --
+ projection (1,0,1) --
+ projection (0,0,1) --
+ cycle
+ ) scaled 5cm ;
+
+ fill f withcolor "darkred" ;
+
+ path p ; p := (
+ projection Origin --
+ projection (1,0,0) --
+ projection (1,1,0) --
+ projection (0,1,0) --
+ projection (0,1,1) --
+ projection (1,1,1) --
+ projection (1,0,1) --
+ projection (0,0,1) --
+ cycle
+ ) scaled 5cm ;
+
+ draw p withcolor .5white ;
+
+ for i=0 upto length p :
+ draw point i of p withpen currentpen scaled 2mm withcolor "lightblue" ;
+ endfor ;
+\stopMPpage
+
+\stoptext
diff --git a/tex/context/modules/mkiv/m-timing.mkiv b/tex/context/modules/mkiv/m-timing.mkiv
index 5502768f6..404d5bae0 100644
--- a/tex/context/modules/mkiv/m-timing.mkiv
+++ b/tex/context/modules/mkiv/m-timing.mkiv
@@ -31,7 +31,7 @@
\definecolor[usage:time] [darkblue]
\definecolor[usage:frame][darkgray]
-\ctxloadluafile{trac-tim}{}
+\ctxloadluafile{trac-tim}
\startluacode
local progress = moduledata.progress
diff --git a/tex/context/modules/mkiv/m-typesetting.mkiv b/tex/context/modules/mkiv/m-typesetting.mkiv
new file mode 100644
index 000000000..4456778ff
--- /dev/null
+++ b/tex/context/modules/mkiv/m-typesetting.mkiv
@@ -0,0 +1,191 @@
+%D \module
+%D [ file=m-typesetting,
+%D version=2017.11.15, % reused from columnset style
+%D title=\CONTEXT\ Modules,
+%D subtitle=Typesetting pages,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[typesetting]
+
+% \setupcombination
+% [style=mono]
+
+\definecombination
+ [twopages]
+
+\definecombination
+ [fourpages]
+ [twopages]
+ [distance=.5\bodyfontsize,
+ width=\textwidth]
+
+\definecombination
+ [sixpages]
+ [twopages]
+ [distance=.5\bodyfontsize,
+ width=\textwidth]
+
+\definemeasure[firstpages][\dimexpr\dimexpr\textwidth-1 \bodyfontsize\relax/2\relax]
+\definemeasure[twopages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+\definemeasure[fourpages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+\definemeasure[sixpages] [\dimexpr\dimexpr\textwidth-2.5\bodyfontsize\relax/6\relax]
+\definemeasure[eightpages][\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+
+\starttexdefinition unexpanded WhenValidPage#1
+ \ifnum#1>\noffigurepages\relax
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi
+\stoptexdefinition
+
+\starttexdefinition unexpanded OnePage #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][1*1]
+ {\typesetfile[#1.tex][page=1,lines=15]} {1}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded FirstPages #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][2*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{firstpages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{firstpages}]} {2}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded OneSpread #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][1*1]
+ {\typesetfile[#1.tex][page=2,lines=15]} {2}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded TwoPages #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][2*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{twopages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded TwoSpread #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][2*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{twopages}]} {3}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded FourPages #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]} {1}
+ {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{fourpages}]}} {\WhenValidPage{2}{2}}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{fourpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{fourpages}]}} {\WhenValidPage{4}{4}}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded FourPairs #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][2*2]
+ {\typesetfile[#1.tex][page=1,width=\measure{firstpages}]} {1}
+ {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{firstpages}]}} {\WhenValidPage{2}{2}}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{firstpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{firstpages}]}} {\WhenValidPage{4}{4}}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+% \starttexdefinition unexpanded FourPagesTwo #1#2
+% \startlinecorrection[blank]
+% \startcombination[fourpages][4*1]
+% {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]} {1}
+% {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{fourpages}]}} {\WhenValidPage{2}{2}}
+% {\typesetfile[#2.tex][page=1,width=\measure{fourpages}]} {1}
+% {\WhenValidPage{2}{\typesetfile[#2.tex][page=2,width=\measure{fourpages}]}} {\WhenValidPage{2}{2}}
+% \stopcombination
+% \stoplinecorrection
+% \stoptexdefinition
+
+\starttexdefinition unexpanded FourSpread #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{fourpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{fourpages}]}} {\WhenValidPage{4}{4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{fourpages}]}} {\WhenValidPage{5}{5}}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded SixPages #1
+ \startlinecorrection[blank]
+ \startcombination[sixpages][6*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{sixpages}]} {1}
+ {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{sixpages}]}} {\WhenValidPage{2}{2}}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{sixpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{sixpages}]}} {\WhenValidPage{4}{4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{sixpages}]}} {\WhenValidPage{5}{5}}
+ {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{sixpages}]}} {\WhenValidPage{6}{6}}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded SixSpread #1
+ \startlinecorrection[blank]
+ \startcombination[sixpages][6*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{sixpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{sixpages}]}} {\WhenValidPage{4}{4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{sixpages}]}} {\WhenValidPage{5}{5}}
+ {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{sixpages}]}} {\WhenValidPage{6}{6}}
+ {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{sixpages}]}} {\WhenValidPage{7}{7}}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded EightPages #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*2]
+ {\typesetfile[#1.tex][page=1,width=\measure{eightpages}]} {#1 / 1}
+ {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{eightpages}]}} {\WhenValidPage{2}{#1 / 2}}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{eightpages}]}} {\WhenValidPage{3}{#1 / 3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{eightpages}]}} {\WhenValidPage{4}{#1 / 4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{eightpages}]}} {\WhenValidPage{5}{#1 / 5}}
+ {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{eightpages}]}} {\WhenValidPage{6}{#1 / 6}}
+ {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{eightpages}]}} {\WhenValidPage{7}{#1 / 7}}
+ {\WhenValidPage{8}{\typesetfile[#1.tex][page=8,width=\measure{eightpages}]}} {\WhenValidPage{8}{#1 / 8}}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded EightSpread #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*2]
+ {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{eightpages}]}} {\WhenValidPage{3}{#1 / 3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{eightpages}]}} {\WhenValidPage{4}{#1 / 4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{eightpages}]}} {\WhenValidPage{5}{#1 / 5}}
+ {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{eightpages}]}} {\WhenValidPage{6}{#1 / 6}}
+ {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{eightpages}]}} {\WhenValidPage{7}{#1 / 7}}
+ {\WhenValidPage{8}{\typesetfile[#1.tex][page=8,width=\measure{eightpages}]}} {\WhenValidPage{8}{#1 / 8}}
+ {\WhenValidPage{9}{\typesetfile[#1.tex][page=9,width=\measure{eightpages}]}} {\WhenValidPage{9}{#1 / 9}}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-abbreviations-mixed.mkiv b/tex/context/modules/mkiv/s-abbreviations-mixed.mkiv
new file mode 100644
index 000000000..f7b2121d0
--- /dev/null
+++ b/tex/context/modules/mkiv/s-abbreviations-mixed.mkiv
@@ -0,0 +1,28 @@
+%D \module
+%D [ file= s-abbreviations-mixed, % was: s-abr-04
+%D version=1996.01.01,
+%D title=\CONTEXT\ Style File,
+%D subtitle=General Abbreviations Mixed,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\setupsorting
+ [logo]
+ [\c!style=\font_style_pseudoMixedCapped]
+
+\protect
+
+\startmodule[abbreviations-mixed]
+
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
+
+\stopmodule
+
diff --git a/tex/context/modules/mkiv/s-abbreviations-pseudocaps.mkiv b/tex/context/modules/mkiv/s-abbreviations-pseudocaps.mkiv
new file mode 100644
index 000000000..fa8606a7b
--- /dev/null
+++ b/tex/context/modules/mkiv/s-abbreviations-pseudocaps.mkiv
@@ -0,0 +1,30 @@
+%D \module
+%D [ file= s-abbreviations-pseudocaps, % was: s-abr-01
+%D version=1996.01.01,
+%D title=\CONTEXT\ Style File,
+%D subtitle=General Abbreviations Pseudocaps,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\setupsorting
+ [logo]
+ [\c!style=\v!capital]
+
+\setupcapitals
+ [\c!title=\v!no]
+
+\protect
+
+\startmodule[abbreviations-pseudocaps]
+
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-abbreviations-smallcaps.mkiv b/tex/context/modules/mkiv/s-abbreviations-smallcaps.mkiv
new file mode 100644
index 000000000..2ce86ca33
--- /dev/null
+++ b/tex/context/modules/mkiv/s-abbreviations-smallcaps.mkiv
@@ -0,0 +1,31 @@
+%D \module
+%D [ file= s-abbreviations-smallcaps, % was: s-abr-02
+%D version=1996.01.01,
+%D title=\CONTEXT\ Style File,
+%D subtitle=General Abbreviations Smallcaps,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\setupsorting
+ [logo]
+ [\c!style=\v!smallcaps]
+
+\setupcapitals
+ [\c!title=\v!no]
+
+\protect
+
+\startmodule[abbreviations-smallcaps]
+
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
+
+\stopmodule
+
diff --git a/tex/context/modules/mkiv/s-mod-02.mkiv b/tex/context/modules/mkiv/s-abbreviations-words.mkiv
index 37e3d2f14..2b7d7cedc 100644
--- a/tex/context/modules/mkiv/s-mod-02.mkiv
+++ b/tex/context/modules/mkiv/s-abbreviations-words.mkiv
@@ -1,8 +1,8 @@
%D \module
-%D [ file=s-mod-02,
-%D version=very-old,
+%D [ file= s-abbreviations-words, % was: s-abr-32
+%D version=1998.08.10,
%D title=\CONTEXT\ Style File,
-%D subtitle=Documentation Screen Environment,
+%D subtitle=General Abbreviations Words,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
@@ -13,12 +13,16 @@
\unprotect
-\startmode[nocode]
+\setupsorting
+ [logo]
+ [\c!style=\v!WORD]
- % \definieerbuffer[definition] % ignore
+\protect
- \def\startdefinition#1\stopdefinition{}
+\startmodule[abbreviations-words]
-\stopmode
+\usemodule[abbreviations-logos]
+\usemodule[abbreviations-extras]
+
+\stopmodule
-\protect \endinput
diff --git a/tex/context/modules/mkiv/s-art-01.mkiv b/tex/context/modules/mkiv/s-article-basic.mkiv
index 601ee1adc..69a577961 100644
--- a/tex/context/modules/mkiv/s-art-01.mkiv
+++ b/tex/context/modules/mkiv/s-article-basic.mkiv
@@ -1,6 +1,19 @@
-\unprotect
+%D \module
+%D [ file=s-article-basic,
+%D version=2010.01.01, % long ago, just for me
+%D title=\CONTEXT\ Style File,
+%D subtitle=Article Basic Setup,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[article-basic]
-\startmodule[art-01]
+\unprotect
\definemeasure [article:margin] [\paperheight/20] % was 15, see xtables-mkiv for results
\definemeasure [overview:margin] [\paperheight/30]
diff --git a/tex/context/modules/mkiv/s-def-01.mkiv b/tex/context/modules/mkiv/s-def-01.mkiv
deleted file mode 100644
index 49e585bd0..000000000
--- a/tex/context/modules/mkiv/s-def-01.mkiv
+++ /dev/null
@@ -1,10 +0,0 @@
-% yes or no
-
-\unprotect
-
-\startsetups defaults:frontpart:pagenumbers:roman
- \defineconversionset[\c!frontpart:\c!pagenumber][][romannumerals]
- \setupuserpagenumber[\c!way=\v!by\v!block]
-\stopsetups
-
-\protect
diff --git a/tex/context/modules/mkiv/s-domotica-settings.lua b/tex/context/modules/mkiv/s-domotica-settings.lua
index a564ddf0e..c7946666d 100644
--- a/tex/context/modules/mkiv/s-domotica-settings.lua
+++ b/tex/context/modules/mkiv/s-domotica-settings.lua
@@ -48,7 +48,7 @@ function moduledata.zwave.show_settings(pattern)
end
- if string.find(pattern,"%*") then
+ if string.find(pattern,"*",1,true) then
local list = dir.glob(pattern)
local last = nil
diff --git a/tex/context/modules/mkiv/s-evohome.mkiv b/tex/context/modules/mkiv/s-evohome.mkiv
new file mode 100644
index 000000000..1577517e5
--- /dev/null
+++ b/tex/context/modules/mkiv/s-evohome.mkiv
@@ -0,0 +1,295 @@
+%D \module
+%D [ file=s-evohome,
+%D version=2017.11.12,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Evohome Graphics,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\setupbodyfont[dejavu]
+
+\starttext
+
+\startluacode
+
+local evohome = require("util-evo")
+
+moduledata.evohome = { }
+
+function moduledata.evohome.status(specification)
+
+ local presets = evohome.helpers.loadpresets(specification.presets)
+ local zones = evohome.helpers.loadtemperatures(presets)
+
+ -- todo : time
+
+ if not zones then
+ context("no zones")
+ context.blank()
+ return
+ end
+
+ local t = zones.time
+
+ t = t and os.date("%Y-%m-%d %H:%M:%S",t) or "unknown time"
+
+ context.starttitle { title = t }
+
+ context.starttabulate { "|l|c|c|c|c|" }
+ context.BC() context("name")
+ context.BC() context("current")
+ context.BC() context("min")
+ context.BC() context("max")
+ context.BC() context("target")
+ context.NC() context.NR()
+ for i=1,#zones do
+ local zone = zones[i]
+ context.NC() context.word(zone.name)
+ context.NC() context("%0.1f",zone.current)
+ context.NC() context("%0.1f",zone.min)
+ context.NC() context("%0.1f",zone.max)
+ context.NC() context("%0.1f",zone.target)
+ context.NC() context.NR()
+ end
+ context.stoptabulate()
+
+ for i=1,#zones do
+ local zone = zones[i]
+-- evohome.helpers.updatezone(presets,zone.name)
+ local data = evohome.helpers.getzonestate(presets,zone.name)
+ local schedule = data and data.schedule or { }
+ context.startsubject { title = zone.name }
+ context.starttabulate { "|l|c|c|" }
+ context.BC() context("day")
+ context.BC() context("time")
+ context.BC() context("temperature")
+ context.NR()
+ local daily = schedule.dailySchedules
+ if daily then
+ for i=1,#daily do
+ local d = daily[i]
+ local s = d.switchpoints
+ if s then
+ for i=1,#s do
+ context.NC()
+ if i == 1 then
+ context.word(d.dayOfWeek)
+ end
+ context.NC() context(s[i].timeOfDay)
+ context.NC() context(s[i].temperature)
+ context.NC() context.NR()
+ end
+ end
+ end
+ end
+ context.stoptabulate()
+ context.stopsubject()
+ end
+
+ context.stoptitle()
+
+end
+
+function moduledata.evohome.history(specification)
+
+ local presets = evohome.helpers.loadpresets(specification.presets)
+ local zones = evohome.helpers.loadtemperatures(presets)
+
+ if not zones then
+ context("no zones")
+ context.blank()
+ return
+ end
+
+ local data = evohome.helpers.loadhistory(presets)
+
+ if not zones then
+ context("no history")
+ return
+ end
+
+ local years = data.years
+
+ if not years then
+ context("no years")
+ return
+ end
+
+ local minyear = specification.year or 2017
+ local maxyear = minyear
+ local minmonth = specification.month or 1
+ local maxmonth = specification.month or 12
+
+ local scale = 1/8 -- 20
+ local mark = 3
+ local abstemp = 25
+
+ for y=minyear,maxyear do
+
+ local year = years[y]
+
+ for m=minmonth,maxmonth do
+
+ local month = year.months[m]
+
+ if month then
+
+ context.starttitle { title = "\\month{" .. m .. "}\\enspace" .. y } -- todo: function context.Month(m) end
+
+ for i=1,#zones do
+
+ local zone = zones[i]
+ local where = zone.name
+ local mintemp = zone.min
+ local maxtemp = zone.max
+
+ -- context.startMPpage { offset = "10pt" }
+ context.startlinecorrection()
+ context.startMPcode()
+ context("linecap := butt; pickup pencircle scaled .5")
+
+ context("fill (%s,%s) -- (%s,%s) -- (%s,%s) -- (%s,%s) -- cycle withcolor .8white ;",
+ 0, mintemp/scale,
+ 31 * 24, mintemp/scale,
+ 31 * 24, maxtemp/scale,
+ 0, maxtemp/scale
+ )
+
+ for i=0,abstemp do
+ context("draw (%s,%s) -- (%s,%s) withcolor .6white ;",
+ 0, i/scale,
+ 31 * 24, i/scale
+ )
+ end
+
+ local days = month.days
+ if days then
+ local nd = os.nofdays(y,m)
+ for d=1,nd do
+ local day = days[d]
+ local xoffset = (d-1) * 24
+ local wd = os.weekday(d,m,y)
+ local weekend = wd == 1 or wd == 7
+ if not weekend then
+ -- okay
+ elseif mark == 1 then
+ context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -17.5,xoffset, -32.5)
+ context("draw (%s,%s) -- (%s,%s) ; ",xoffset+24,-17.5,xoffset+24,-32.5)
+ elseif mark == 2 then
+ context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -17.5,xoffset+24,-17.5)
+ context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -32.5,xoffset+24,-32.5)
+ elseif mark == 3 then
+ context("draw unitsquare xysized (%s,%s) shifted (%s,%s) ; ",24,15,xoffset,-32.5)
+ end
+ context([[draw textext("%s") shifted (%s,%s) ; ]],d,xoffset + 12,-25)
+ if day then
+ for h=0,23 do
+ local hours = day.hours
+ if hours then
+ local hour = hours[h]
+ if hour then
+ local a = 0
+ local n = 0
+ local m = 0
+ for minute, d in next, hour do
+ local v = d[where]
+ a = a + v
+ n = n + 1
+ if v > m then
+ m = v
+ end
+ end
+ a = a / n
+ local dx = xoffset + h
+ local dy = a/scale
+ local dm = m/scale
+ context("draw (%s,%s) -- (%s,%s) withcolor %s ; ",
+ dx, 0,dx,dy,weekend and "darkmagenta" or "darkblue")
+ context("draw (%s,%s) -- (%s,%s) withcolor %s ; ",
+ dx,dy,dx,dm,"darkred")
+ end
+ end
+ end
+ end
+ end
+ for d=0,30 do
+ local xoffset = d * 24
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+ 0,0,xoffset+ 0,-10)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+ 6,0,xoffset+ 6,-2.5)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+12,0,xoffset+12,-5)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+18,0,xoffset+18,-2.5)
+ end
+ local xoffset = 31 * 24
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset,0,xoffset,-10)
+ end
+
+ for i=0,abstemp,5 do
+ context([[draw textext.lft("%s") shifted (%s,%s) ; ]],i,-10,i/scale)
+ context("draw (%s,%s) -- (%s,%s) withcolor .2white ;",0,i/scale,31 * 24,i/scale)
+ end
+
+ context([[draw textext("\strut\month{%s}\enspace%s\enspace:\enspace%s") shifted (%s,%s) ; ]], m, y, where, 31 * 24 / 2, -50)
+ context([[draw textext.lft("\textdegree{}C") shifted (%s,%s) ; ]],-10,-25)
+
+ context("currentpicture := currentpicture xsized TextWidth") ;
+
+ context.stopMPcode()
+ context.stoplinecorrection()
+ -- context.stopMPpage()
+ end
+
+ context.stoptitle()
+
+ end
+
+ end
+
+ end
+
+end
+
+\stopluacode
+
+\continueifinputfile{s-evohome.mkiv}
+
+\usemodule[art-01]
+
+\setuplayout
+ [article]
+ [footer=0cm,
+ header=1cm,
+ topspace=5mm,
+ bottomspace=5mm]
+
+\starttext
+
+ \startluacode
+
+ -- os.execute([[mtxrun --script evohome --collect --presets=c:/data/develop/domotica/code/evohome-presets.lua]])
+
+ -- local specification = {
+ -- year = 2017,
+ -- -- month = 11,
+ -- presets = "c:/data/develop/domotica/evohome/evohome-presets.lua",
+ -- }
+
+ -- moduledata.evohome.status (specification)
+ -- moduledata.evohome.history(specification)
+
+ local specification = {
+ year = 2018,
+ -- month = 11,
+ presets = "c:/data/develop/domotica/evohome/evohome-presets.lua",
+ }
+
+ -- moduledata.evohome.status (specification)
+ moduledata.evohome.history(specification)
+
+ \stopluacode
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-fnt-10.mkiv b/tex/context/modules/mkiv/s-fnt-10.mkiv
deleted file mode 100644
index 731c4be39..000000000
--- a/tex/context/modules/mkiv/s-fnt-10.mkiv
+++ /dev/null
@@ -1,169 +0,0 @@
-%D \module
-%D [ file=s-fnt-01,
-%D version=2006.10.10, % guess
-%D title=\CONTEXT\ Style File,
-%D subtitle=Listing Glyphs in Large Fonts,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-% sort of obsolete
-
-\startluacode
-local fontdata = fonts.hashes.identifiers
-
--- function fonts.tracers.show_all()
--- local tfmdata = fontdata[font.current()]
--- if tfmdata and tfmdata.shared then
--- local NC, NR, char = context.NC, context.NR, context.char
--- context.starttabulate { "|l|r|c|" }
--- for unicode, description in fonts.iterators.characters(tfmdata) do
--- NC() context(description.name) NC() context(unicode) NC() char(unicode) NC() NR()
--- end
--- context.stoptabulate()
--- end
--- end
-
-local context = context
-local escaped = context.escaped
-
-function fonts.tracers.show_all()
- local tfmdata = fontdata[font.current()]
- if tfmdata then
- local NC, NR, HL, char, bold, tttf = context.NC, context.NR, context.HL, context.char, context.bold, context.tttf
- local descriptions = tfmdata.descriptions or { }
- local data = characters.data
- -- context.setuptabulate { header = "repeat" }
- context.starttabulatehead()
- NC() bold("unicode")
- NC() bold("visual")
- NC() bold("index")
- NC() bold("glyph")
- NC() bold("adobe")
- NC() bold("context")
- NC() NR()
- context.stoptabulatehead()
- context.starttabulate { "|l|c|l|p|p|p|" }
- for unicode, chr in fonts.iterators.characters(tfmdata) do
- local des, dat = descriptions[unicode], data[unicode]
- local index = chr.index or 0
- local cname = (dat and dat.contextname) or ""
- local aname = (dat and dat.adobename) or ""
- local gname = (des and des.name) or ""
- local mname = dat and dat.mathname
- if type(mname) ~= "string" then
- mname = ""
- end
- local mspec = dat and dat.mathspec
- if mspec then
- for m=1,#mspec do
- local n = mspec[m].name
- if n then
- if mname == "" then
- mname = n
- else
- mname = mname .. " " .. n
- end
- end
- end
- end
- if mname ~= "" then
- mname = "m: " .. mname
- if cname ~= "" then
- cname = cname .. " " .. mname
- else
- cname = mname
- end
- end
- NC() tttf() context("U+%05X",unicode)
- NC() char(unicode)
- NC() tttf() context("%05X",index)
- NC() if gname ~= "" then tttf() escaped(gname) end
- NC() if aname ~= "" then tttf() context(aname) end
- NC() if cname ~= "" then tttf() context(cname) end
- NC() NR()
- end
- context.stoptabulate()
- else
- context("problems")
- end
-end
-
-function fonts.tracers.show_glyphs()
- local tfmdata = fontdata[font.current()]
- if tfmdata then
- for unicode, chr in fonts.iterators.characters(tfmdata) do
- context.showglyph(unicode)
- end
- end
-end
-\stopluacode
-
-\unexpanded\def\ShowCompleteFont#1#2#3%
- {\bgroup
- \page
- \font\TestFont=#1 at #2
- \setuplayout[style=\TestFont]
- \setupheadertexts[]
- \setupfootertexts[#1 -- \pagenumber]
- \setupfootertexts[pagenumber]
- \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm]
- \TestFont
- \nonknuthmode
- \startcolumns[n=#3]
- \TestFont
- \ctxlua { fonts.tracers.show_all() }
- \stopcolumns
- \page
- \egroup}
-
-\unexpanded\def\ShowAllGlyphs#1#2#3%
- {\bgroup
- \page
- \def\showglyph##1{\dontleavehmode\strut\char##1\relax\par}
- \font\TestFontA=#1 at 12pt
- \font\TestFontB=#1 at #2
- \setuplayout[style=\TestFontA]
- \setupheadertexts[]
- \setupfootertexts[#1\space\endash\space\pagenumber]
- \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm,header=1cm,footer=2cm]
- \TestFontB \setupinterlinespace[line=1.2\dimexpr#2\relax] \raggedcenter
- \nonknuthmode
- \startcolumns[n=#3]
- \TestFontB
- \ctxlua { fonts.tracers.show_glyphs() }
- \stopcolumns
- \page
- \egroup}
-
-\continueifinputfile{s-fnt-10.mkiv}
-
-\starttext
-
-% \ShowCompleteFont{name:dejavusansmono}{10pt}{1}
-% \ShowCompleteFont{name:dejavuserif}{10pt}{2}
-% \ShowCompleteFont{name:officinasansbookitcregular}{10pt}{2}
-% \ShowCompleteFont{name:officinaserifbookitcregular}{10pt}{2}
-% \ShowCompleteFont{name:serpentineserifeflight}{10pt}{2}
-\ShowCompleteFont{name:lmroman10-regular}{10pt}{1}
-% \ShowCompleteFont{name:lmtypewriter10-regular}{10pt}{2}
-% \ShowCompleteFont{lt55485}{10pt}{2}
-% \ShowCompleteFont{lmr10}{10pt}{2}
-% \ShowCompleteFont{lbr}{10pt}{2}
-% \ShowCompleteFont{name:Cambria}{10pt}{2}
-% \ShowCompleteFont{name:CambriaMath}{10pt}{2}
-% \ShowCompleteFont{name:texgyrepagella-regular}{10pt}{2}
-% \ShowCompleteFont{name:texgyrechorus-mediumitalic}{10pt}{2}
-% \ShowAllGlyphs {name:texgyrepagella-regular} {48pt}{2}
-% \ShowAllGlyphs {name:texgyrechorus-mediumitalic}{48pt}{2}
-% \ShowCompleteFont{name:euler10-regular}{10pt}{2}
-
-% \ShowCompleteFont{name:palatinosansinformalcombold}{20pt}{2}
-% \ShowCompleteFont{name:palatinonovaregular}{11pt}{2}
-% \ShowCompleteFont{pirat.ttf}{12pt}{1}
-
-\stoptext
diff --git a/tex/context/modules/mkiv/s-fnt-21.mkiv b/tex/context/modules/mkiv/s-fnt-21.mkiv
deleted file mode 100644
index 10d5a4623..000000000
--- a/tex/context/modules/mkiv/s-fnt-21.mkiv
+++ /dev/null
@@ -1,64 +0,0 @@
-%D \module
-%D [ file=s-fnt-20,
-%D version=2009.01.10,
-%D title=\CONTEXT\ Style File,
-%D subtitle=Tracing Feature Application (2),
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D This module is related to:
-
-\usemodule[fnt-20]
-
-\setvariables
- [otftracker]
- [set=\setups{araball}]
-
-\startsetups araball
- \begingroup
- \setupcolors[state=start]%
- \enabletrackers[otf.analyzing]% beware, kind of global
- \ruledhbox \bgroup
- \definedfont[\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}]%
- \ifnum\getvariable{otftracker}{direction}<0 \textdir TRT\else\ifnum\getvariable{otftracker}{direction}>0 \textdir TLT\fi\fi\relax
- \getvariable{otftracker}{sample}%
- \egroup
- \disabletrackers[otf.analyzing]%
- \endgroup
-\stopsetups
-
-\unexpanded\def\ShowOtfTrackerSample#1%
- {\doiffile{#1}
- {\blank
- \startlinecorrection
- \vbox \bgroup
- \forgetall
- \setbox\scratchbox\hbox{\component #1 \relax}
- \hbox{\copy\scratchbox\quad\lower\dp\scratchbox\hbox{\ruledhbox{\externalfigure[#1-volt.pdf][height=\htdp\scratchbox]}}}
- \hbox{\strut\tttf#1}%
- \egroup
- \stoplinecorrection
- \blank}}
-
-\endinput
-
-% \usemodule[fnt-21]
-%
-% \starttext
-%
-% \setvariables
-% [otftracker]
-% [direction=-1,
-% sample=لا,
-% title=Test,
-% font=file:arabtype,
-% % font=file:husayni,
-% % font=file:scheherazaderegot,
-% features=arabic]
-%
-% \stoptext
diff --git a/tex/context/modules/mkiv/s-fnt-24.mkiv b/tex/context/modules/mkiv/s-fonts-cjk.mkiv
index 2e6b9a591..fae041316 100644
--- a/tex/context/modules/mkiv/s-fnt-24.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-cjk.mkiv
@@ -1,5 +1,5 @@
%D \module
-%D [ file=s-fnt-24,
+%D [ file=s-fonts-cjk, % was: s-fnt-24
%D version=2009.02.06,
%D title=\CONTEXT\ Style File,
%D subtitle=CJK Glyph Combination Testing,
@@ -11,9 +11,11 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+\startmodule[fonts-cjk]
+
\unprotect
-\def\ShowChineseCombiChar#1#2#3#4%
+\unexpanded\def\ShowChineseCombiChar#1#2#3#4%
{\blank[small]
\dontleavehmode
\hbox\bgroup
@@ -71,7 +73,7 @@ end
\unexpanded\def\ShowCombinationsChinese
{\dodoubleempty\doShowCombinationsChinese}
-\def\doShowCombinationsChinese[#1][#2]%
+\unexpanded\def\doShowCombinationsChinese[#1][#2]%
{\startpacked
\setscript[hanzi]
\setupcolors[\c!state=\v!start]
@@ -80,4 +82,6 @@ end
\disabletrackers[cjk.analyzing]
\stoppacked}
+\stopmodule
+
\protect \endinput
diff --git a/tex/context/modules/mkiv/s-fonts-complete.mkiv b/tex/context/modules/mkiv/s-fonts-complete.mkiv
new file mode 100644
index 000000000..afdd79b4c
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-complete.mkiv
@@ -0,0 +1,160 @@
+%D \module
+%D [ file=s-fnt-01,
+%D version=2006.10.10, % guess
+%D title=\CONTEXT\ Style File,
+%D subtitle=Listing Glyphs in Large Fonts,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is sort of obsolete as other moduels give nicer overviews.
+
+\startluacode
+ moduledata.fonts = moduledata.fonts or { }
+ moduledata.fonts.complete = moduledata.fonts.complete or { }
+
+ local fontdata = fonts.hashes.identifiers
+
+ local context = context
+ local escaped = context.escaped
+
+ function moduledata.fonts.complete.all()
+ local tfmdata = fontdata[true]
+ if tfmdata then
+ local NC, NR, HL, char, bold, tttf = context.NC, context.NR, context.HL, context.char, context.bold, context.tttf
+ local descriptions = tfmdata.descriptions or { }
+ local data = characters.data
+ -- context.setuptabulate { header = "repeat" }
+ context.starttabulatehead()
+ NC() bold("unicode")
+ NC() bold("visual")
+ NC() bold("index")
+ NC() bold("glyph")
+ NC() bold("adobe")
+ NC() bold("context")
+ NC() NR()
+ context.stoptabulatehead()
+ context.starttabulate { "|l|c|l|p|p|p|" }
+ for unicode, chr in fonts.iterators.characters(tfmdata) do
+ local des, dat = descriptions[unicode], data[unicode]
+ local index = chr.index or 0
+ local cname = (dat and dat.contextname) or ""
+ local aname = (dat and dat.adobename) or ""
+ local gname = (des and des.name) or ""
+ local mname = dat and dat.mathname
+ if type(mname) ~= "string" then
+ mname = ""
+ end
+ local mspec = dat and dat.mathspec
+ if mspec then
+ for m=1,#mspec do
+ local n = mspec[m].name
+ if n then
+ if mname == "" then
+ mname = n
+ else
+ mname = mname .. " " .. n
+ end
+ end
+ end
+ end
+ if mname ~= "" then
+ mname = "m: " .. mname
+ if cname ~= "" then
+ cname = cname .. " " .. mname
+ else
+ cname = mname
+ end
+ end
+ NC() tttf() context("U+%05X",unicode)
+ NC() char(unicode)
+ NC() tttf() context("%05X",index)
+ NC() if gname ~= "" then tttf() escaped(gname) end
+ NC() if aname ~= "" then tttf() context(aname) end
+ NC() if cname ~= "" then tttf() context(cname) end
+ NC() NR()
+ end
+ context.stoptabulate()
+ else
+ context("problems")
+ end
+ end
+
+ function moduledata.fonts.complete.glyphs()
+ local tfmdata = fontdata[true]
+ if tfmdata then
+ for unicode, chr in fonts.iterators.characters(tfmdata) do
+ context.showglyph(unicode)
+ end
+ end
+ end
+\stopluacode
+
+\unexpanded\def\ShowCompleteFont#1#2#3%
+ {\begingroup
+ \page
+ \font\TestFont=#1 at #2
+ \setuplayout[style=\TestFont]
+ \setupheadertexts[]
+ \setupfootertexts[#1 -- \pagenumber]
+ \setupfootertexts[pagenumber]
+ \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm]
+ \TestFont
+ \nonknuthmode
+ \startcolumns[n=#3]
+ \TestFont
+ \ctxlua { moduledata.fonts.complete.all() }
+ \stopcolumns
+ \page
+ \endgroup}
+
+\unexpanded\def\ShowAllGlyphs#1#2#3%
+ {\begingroup
+ \page
+ \def\showglyph##1{\dontleavehmode\strut\char##1\relax\par}
+ \font\TestFontA=#1 at 12pt
+ \font\TestFontB=#1 at #2
+ \setuplayout[style=\TestFontA]
+ \setupheadertexts[]
+ \setupfootertexts[#1\space\endash\space\pagenumber]
+ \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm,header=1cm,footer=2cm]
+ \TestFontB \setupinterlinespace[line=1.2\dimexpr#2\relax] \raggedcenter
+ \nonknuthmode
+ \startcolumns[n=#3]
+ \TestFontB
+ \ctxlua { moduledata.fonts.complete.glyphs() }
+ \stopcolumns
+ \page
+ \endgroup}
+
+\continueifinputfile{s-fonts-complete.mkiv}
+
+\starttext
+
+% \ShowCompleteFont{name:dejavusansmono}{10pt}{1}
+% \ShowCompleteFont{name:dejavuserif}{10pt}{2}
+% \ShowCompleteFont{name:officinasansbookitcregular}{10pt}{2}
+% \ShowCompleteFont{name:officinaserifbookitcregular}{10pt}{2}
+% \ShowCompleteFont{name:serpentineserifeflight}{10pt}{2}
+\ShowCompleteFont{name:lmroman10-regular}{10pt}{1}
+% \ShowCompleteFont{name:lmtypewriter10-regular}{10pt}{2}
+% \ShowCompleteFont{lt55485}{10pt}{2}
+% \ShowCompleteFont{lmr10}{10pt}{2}
+% \ShowCompleteFont{lbr}{10pt}{2}
+% \ShowCompleteFont{name:Cambria}{10pt}{2}
+% \ShowCompleteFont{name:CambriaMath}{10pt}{2}
+% \ShowCompleteFont{name:texgyrepagella-regular}{10pt}{2}
+% \ShowCompleteFont{name:texgyrechorus-mediumitalic}{10pt}{2}
+% \ShowAllGlyphs {name:texgyrepagella-regular} {48pt}{2}
+% \ShowAllGlyphs {name:texgyrechorus-mediumitalic}{48pt}{2}
+% \ShowCompleteFont{name:euler10-regular}{10pt}{2}
+
+% \ShowCompleteFont{name:palatinosansinformalcombold}{20pt}{2}
+% \ShowCompleteFont{name:palatinonovaregular}{11pt}{2}
+% \ShowCompleteFont{pirat.ttf}{12pt}{1}
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-coverage.lua b/tex/context/modules/mkiv/s-fonts-coverage.lua
index dd772d5f0..2408fc9a3 100644
--- a/tex/context/modules/mkiv/s-fonts-coverage.lua
+++ b/tex/context/modules/mkiv/s-fonts-coverage.lua
@@ -19,19 +19,37 @@ local char, bold, getvalue = context.char, context.bold, context.getvalue
local chardata = characters.data
-function moduledata.fonts.coverage.showcomparison(specification)
+function moduledata.fonts.coverage.showdifference(specification)
+ moduledata.fonts.coverage.showcomparison(specification,true)
+end
+
+function moduledata.fonts.coverage.showcomparison(specification,difference)
specification = interfaces.checkedspecification(specification)
local fontfiles = utilities.parsers.settings_to_array(specification.list or "")
local pattern = upper(specification.pattern or "")
+ local slot = specification.slot or ""
local present = { }
local names = { }
local files = { }
local chars = { }
+ local slots = false
- if not pattern then
+ if slot ~= "" then
+ slot = utilities.parsers.settings_to_array(slot)
+ for i=1,#slot do
+ local s = tonumber(slot[i])
+ if not s then
+ -- next one
+ elseif slots then
+ slots[s] = true
+ else
+ slots = { [s] = true }
+ end
+ end
+ elseif not pattern then
-- skip
elseif pattern == "" then
pattern = nil
@@ -80,11 +98,13 @@ function moduledata.fonts.coverage.showcomparison(specification)
table.concat(t," ")
}
- context.starttabulate { "|Tl" .. string.rep("|c",#names) .. "|Tl|" }
+ local nofnames = #names
+
+ context.starttabulate { "|Tl" .. string.rep("|c",nofnames) .. "|Tl|" }
NC()
bold("unicode")
NC()
- for i=1,#names do
+ for i=1,nofnames do
bold(i)
NC()
end
@@ -93,17 +113,35 @@ function moduledata.fonts.coverage.showcomparison(specification)
NR()
HL()
for k, v in table.sortedpairs(present) do
- if k <= 0 then
+ local skip = false
+ if difference then
+ local n = 0
+ for i=1,nofnames do
+ if chars[i][k] then
+ n= n + 1
+ end
+ end
+ skip = n == nofnames
+ end
+ if skip then
+ -- ignore
+ elseif k <= 0 then
-- ignore
elseif k >= 0x110000 then
logs.report("warning","weird character %U",k)
else
local description = chardata[k].description
- if not pattern or (pattern == k) or (description and lpegmatch(pattern,description)) then
+ local wantedslot = true
+ if slots then
+ wantedslot = slots[k]
+ elseif pattern then
+ wantedslot = pattern == k or (description and lpegmatch(pattern,description))
+ end
+ if wantedslot then
NC()
context("%05X",k)
NC()
- for i=1,#names do
+ for i=1,nofnames do
getvalue(names[i])
if chars[i][k] then
char(k)
diff --git a/tex/context/modules/mkiv/s-fonts-coverage.mkiv b/tex/context/modules/mkiv/s-fonts-coverage.mkiv
index 305bb9b7b..98a5c00a4 100644
--- a/tex/context/modules/mkiv/s-fonts-coverage.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-coverage.mkiv
@@ -25,6 +25,7 @@
\registerctxluafile{s-fonts-coverage}{}
\installmodulecommandluasingle \showfontcomparison {moduledata.fonts.coverage.showcomparison}
+\installmodulecommandluasingle \showfontdifference {moduledata.fonts.coverage.showdifference}
\stopmodule
diff --git a/tex/context/modules/mkiv/s-fonts-engines.mkiv b/tex/context/modules/mkiv/s-fonts-engines.mkiv
new file mode 100644
index 000000000..1b1f664b8
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-engines.mkiv
@@ -0,0 +1,196 @@
+%D \module
+%D [ file=s-fonts-engines, % was: s-fnt-22
+%D version=2017.06.21,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Compare engines and such,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is just for me when I wanted to check some husayni (by Idris)
+%D regression. Interesting is that fina should be disabled for hb (otherwise
+%D garbage) and that some substitutions are ignored in hb (1.1.3), so we can
+%D only compare some examples. Don't expect this style to be stable as I
+%D might change default features.
+
+\startmodule[fonts-engines]
+
+\usemodule[fonts-steps]
+\usemodule[fonts-plugins]
+
+\enabletrackers[fonts.reorderlookups]
+
+\startsetups otftracker-extra-context
+ \definedfont[\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}]\relax
+ \setotfcompositiondirection{\getvariable{otftracker}{direction}}\relax
+ \getvariable{otftracker}{sample}\relax
+\stopsetups
+
+\startsetups otftracker-extra-context-reordered
+ \definedfont[\getvariable{otftracker}{font}*otftracker-context-reordered at \getvariable{otftracker}{size}]\relax
+ \setotfcompositiondirection{\getvariable{otftracker}{direction}}\relax
+ \getvariable{otftracker}{sample}\relax
+\stopsetups
+
+\startsetups otftracker-extra-harfbuzz
+ \definedfont[\getvariable{otftracker}{font}*otftracker-harfbuzz-native at \getvariable{otftracker}{size}]\relax
+ \setotfcompositiondirection{\getvariable{otftracker}{direction}}\relax
+ \getvariable{otftracker}{sample}\relax
+\stopsetups
+
+\startsetups otftracker-extra-uniscribe
+ \definedfont[\getvariable{otftracker}{font}*otftracker-harfbuzz-uniscribe at \getvariable{otftracker}{size}]\relax
+ \setotfcompositiondirection{\getvariable{otftracker}{direction}}\relax
+ \getvariable{otftracker}{sample}\relax
+\stopsetups
+
+\definecolor[otftracker-overlay-1][a=1,t=.5,b=1]
+\definecolor[otftracker-overlay-2][a=1,t=.5,g=1]
+\definecolor[otftracker-overlay-3][a=1,t=.5,r=1]
+
+% This is a sort of a check against xetex but with limited font trickery because we bypass
+% the normal font handling. It's no big deal for a test. The biggest problem is that we
+% run into default features and we don't know what is turned on by default. We also need
+% to disable tagging so that hb itself can do some (init/medi/fina) magic in setting
+% features.
+
+\startsetups otftracker-extra
+ \start
+ \blank
+ \definefontfeature
+ [otftracker-context-reordered]
+ [\getvariable{otftracker}{features}]
+ [reorderlookups=arab]
+ \definefontfeature
+ [otftracker-harfbuzz-uniscribe]
+ [\getvariable{otftracker}{features}]
+ [mode=plug,
+ features=harfbuzz,
+ shaper=uniscribe,
+ % stch=nothing,
+ % ccmp=nothing,
+ % locl=nothing,
+ % rlig=nothing,
+ % calt=nothing,
+ % mset=nothing,
+ fina=nothing, % looks like the libs does something special
+ init=nothing, % looks like the libs does something special
+ medi=nothing, % looks like the libs does something special
+ isol=nothing, % looks like the libs does something special
+ % method=binary,
+ script=arabic]
+ \definefontfeature
+ [otftracker-harfbuzz-native]
+ [\getvariable{otftracker}{features}]
+ [mode=plug,
+ features=harfbuzz,
+ shaper=native,
+ % stch=nothing,
+ % ccmp=nothing,
+ % locl=nothing,
+ % rlig=nothing,
+ % calt=nothing,
+ % mset=nothing,
+ fina=nothing, % looks like the libs does something special
+ init=nothing, % looks like the libs does something special
+ medi=nothing, % looks like the libs does something special
+ isol=nothing, % looks like the libs does something special
+ script=arabic]
+ \doifelsesomething {\getvariable{otftracker}{comment}} {
+ \def\ExtraComment{
+ \TB
+ \NC
+ comment
+ \NC
+ \vtop {
+ \hsize\dimexpr\hsize-10em\relax
+ \veryraggedright
+ \getvariable{otftracker}{comment}
+ }
+ \NC \NR
+ }
+ } {
+ \def\ExtraComment{}
+ }
+ \starttabulate[|lTB|l|]
+ \NC
+ context
+ \NC
+ \showglyphs \showfontkerns
+ \enabletrackers[otf.sample.silent]
+ \ruledhbox{\directsetup{otftracker-extra-context}}
+ \disabletrackers[otf.sample]
+ \NC \NR \TB \NC
+ reordered
+ \NC
+ \showglyphs \showfontkerns
+ \enabletrackers[otf.sample.silent]
+ \ruledhbox{\directsetup{otftracker-extra-context-reordered}}
+ \disabletrackers[otf.sample]
+ \NC \NR \TB \NC
+ harfbuzz
+ \NC
+ \showglyphs \showfontkerns
+ \enabletrackers[fonts.plugins.hb.colors]
+ \ruledhbox{\directsetup{otftracker-extra-harfbuzz}}
+ \disabletrackers[fonts.plugins.hb.colors]
+ \NC \NR \TB \NC
+ uniscribe
+ \NC
+ \showglyphs \showfontkerns
+ \enabletrackers[fonts.plugins.hb.colors]
+ \ruledhbox{\directsetup{otftracker-extra-uniscribe}}
+ \disabletrackers[fonts.plugins.hb.colors]
+ \NC \NR \TB \NC
+ context
+ \NC
+ \showglyphs \showfontkerns
+ \ruledhbox{\directsetup{otftracker-extra-context}}
+ \NC \NR \TB \NC
+ harfbuzz
+ \NC
+ \showglyphs \showfontkerns
+ \ruledhbox{\directsetup{otftracker-extra-harfbuzz}}
+ \NC \NR \TB \NC
+ uniscribe
+ \NC
+ \showglyphs \showfontkerns
+ \ruledhbox{\directsetup{otftracker-extra-uniscribe}}
+ \NC \NR \TB \NC
+ context harfbuzz
+ \NC
+ \showglyphs \showfontkerns
+ \hbox to \zeropoint {
+ \ruledhbox{\color[otftracker-overlay-1]{\directsetup{otftracker-extra-harfbuzz}}}
+ \hss
+ }
+ \ruledhbox{\color[otftracker-overlay-3]{\directsetup{otftracker-extra-context}}}
+ \NC \NR \TB \NC
+ uniscribe harfbuzz
+ \NC
+ \showglyphs \showfontkerns
+ \hbox to \zeropoint {
+ \ruledhbox{\color[otftracker-overlay-1]{\directsetup{otftracker-extra-harfbuzz}}}
+ \hss
+ }
+ \ruledhbox{\color[otftracker-overlay-2]{\directsetup{otftracker-extra-uniscribe}}}
+ \NC \NR \TB \NC
+ context uniscribe
+ \NC
+ \showglyphs \showfontkerns
+ \hbox to \zeropoint {
+ \ruledhbox{\color[otftracker-overlay-1]{\directsetup{otftracker-extra-uniscribe}}}
+ \hss
+ }
+ \ruledhbox{\color[otftracker-overlay-2]{\directsetup{otftracker-extra-context}}}
+ \NC \NR
+ \ExtraComment
+ \stoptabulate
+ \stop
+\stopsetups
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-fonts-kerns.mkiv b/tex/context/modules/mkiv/s-fonts-kerns.mkiv
new file mode 100644
index 000000000..c3a5637c3
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-kerns.mkiv
@@ -0,0 +1,215 @@
+%D \module
+%D [ file=s-fonts-kerns,
+%D version=2018.02.20, % was s-fnt-40 (given the kin dof code < 2010)
+%D title=\CONTEXT\ Style File,
+%D subtitle=Show Fonts Kerns,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is real old code but we keep it around for educational purposes. it's
+%D not that efficient and we have better ways.
+%D
+%D \starttyping
+%D \showfontkerns
+%D \stoptyping
+%D
+%D This one shows all kerns so it's s bit different and as we use it in the
+%D manual \unknown
+
+\startluacode
+
+ local nodecodes = nodes.nodecodes
+
+ local disc_code = nodecodes.disc
+ local kern_code = nodecodes.kern
+ local glyph_code = nodecodes.glyph
+ local hlist_code = nodecodes.hlist
+
+ -- local function flatten(l)
+ -- while l do
+ -- local id = l.id
+ -- if id == disc_code then
+ -- local r = l.replace
+ -- if r then
+ -- local p = l.prev
+ -- local n = l.next
+ -- if n and p and n.id == glyph_code and p.id == glyph_code then
+ -- local s = node.slide(r)
+ -- p.next = r
+ -- n.prev = s
+ -- r.prev = p
+ -- s.next= n
+ -- l.replace = nil
+ -- node.free(l)
+ -- end
+ -- end
+ -- elseif id == hlist_code then
+ -- flatten(l.list)
+ -- end
+ -- l = l.next
+ -- end
+ -- end
+
+ local function mark(l,c)
+ while l do
+ local id = l.id
+ if id == kern_code then
+ context.showkern(l.kern,c)
+ elseif id == disc_code then
+ mark(l.pre,2)
+ mark(l.post,3)
+ mark(l.replace,4)
+ elseif id == hlist_code then
+ mark(l.list,c)
+ end
+ l = l.next
+ end
+ end
+
+ local function collect(l)
+ local m = { }
+ while l do
+ local id = l.id
+ if id == hlist_code then
+ m[#m+1] = l
+ end
+ l = l.next
+ end
+ return m
+ end
+
+ local function inject(l,m,i)
+ local x = l
+ i = i or 0
+ while l do
+ local id = l.id
+ if id == kern_code then
+ i = i + 1
+ node.insert_before(x,l,node.copy(m[i]))
+ elseif id == disc_code then
+ i = inject(l.pre,m,i)
+ i = inject(l.post,m,i)
+ i = inject(l.replace,m,i)
+ elseif id == hlist_code then
+ i = inject(l.list,m,i)
+ end
+ l = l.next
+ end
+ return i
+ end
+
+ moduledata.fonts = moduledata.fonts or { }
+ moduledata.fonts.kerns = moduledata.fonts.kerns or { }
+
+ function moduledata.fonts.kerns._show_(n)
+ inject(tex.box[n].list,collect(tex.box[6].list))
+ end
+
+ function moduledata.fonts.kerns.show(n)
+ context("\\bgroup")
+ context("\\setbox6\\vbox\\bgroup\\forgetall")
+ -- flatten(tex.box[n].list)
+ mark(tex.box[n].list,1)
+ context("\\egroup")
+ context("\\ctxlua{moduledata.fonts.kerns._show_('%s')}",n)
+ context("\\egroup")
+ end
+
+\stopluacode
+
+\setupcolors[state=start]
+
+\definefont[VerySmall][Mono at 4pt]
+
+\definecolor[kern:0][s=.5]
+\definecolor[kern:1][b=.5]
+\definecolor[kern:2][r=.5]
+\definecolor[kern:3][g=.5]
+\definecolor[kern:4][r=.5,g=.5]
+
+\def\showkernwidthfactor{1}
+
+\newconditional\showkernstate
+\settrue \showexplicitkerns
+
+\unexpanded\def\showkern#1#2%
+ {\begingroup
+ \dontcomplain
+ \setbox\scratchbox\hbox to \zeropoint \bgroup
+ \ifcase#2\or
+ \ifconditional\showkernstate
+ \color[kern:0]{\dovlwdhtdp\showkernwidthfactor{0.75}{0.5}}%
+ \global\setfalse\showkernstate
+ \raise.8\strutht
+ \else
+ \color[kern:0]{\dovlwdhtdp\showkernwidthfactor{1.05}{0.5}}%
+ \global\settrue\showkernstate
+ \raise1.1\strutht
+ \fi
+ \else\ifconditional\showexplicitkerns % if other kerns
+ \color[kern:0]{\dovlwdhtdp\showkernwidthfactor{0.75}{0.5}}%
+ \lower1.2\strutdp
+ \fi\fi
+ \hbox to 0pt{\hss\VerySmall\color[kern:#2]{\expandafter\withoutpt\the\dimexpr#1sp}\hss}%
+ \egroup
+ \smashbox\scratchbox
+ \box\scratchbox
+ \endgroup
+ \par}
+
+\newbox\KernBox
+
+\unexpanded\def\ShowKerns#1%
+ {\global\setfalse
+ \showkernstate\ctxlua{moduledata.fonts.kerns.show("#1")}}
+
+\unexpanded\def\ShowKernedVBox#1%
+ {\global\setfalse\showkernstate
+ \setbox\KernBox\vbox{#1}%
+ \ShowKerns{KernBox}%
+ \unvbox\KernBox}
+
+\unexpanded\def\ShowKernedHBox#1%
+ {\global\setfalse\showkernstate
+ \setbox\KernBox\hbox{#1}%
+ \ShowKerns{KernBox}%
+ \unhbox\KernBox}
+
+\continueifinputfile{s-fonts-kerns.mkiv}
+
+\setupinterlinespace[1.5] % \setfalse\showexplicitkerns
+
+\definefontfeature[default][default][mode=node] % ,script=latn]
+
+\starttext
+
+% \enabletrackers[otf.kerns]
+
+\setuplayout[width=middle,height=middle]
+
+\usetypescript[modern] \setupbodyfont[modern]
+\setbox\KernBox\vbox{\input knuth } \ShowKerns{KernBox} \copy\KernBox \blank
+
+\ShowKernedHBox{Very often glyphs get very small spaces inserted horizontally.}
+
+\usetypescript[cambria] \setupbodyfont[cambria]
+\setbox\KernBox\vbox{\input knuth } \ShowKerns{KernBox} \copy\KernBox \blank
+
+\ShowKernedHBox{Very often glyphs get very small spaces inserted horizontally.}
+
+\usetypescript[palatino] \setupbodyfont[palatino]
+\setbox\KernBox\vbox{\input knuth } \ShowKerns{KernBox} \copy\KernBox \blank
+
+\ShowKernedHBox{Very often glyphs get very small spaces inserted horizontally.}
+
+\usetypescript[dejavu] \setupbodyfont[dejavu]
+\setbox\KernBox\vbox{\input knuth } \ShowKerns{KernBox} \copy\KernBox \blank
+
+\ShowKernedHBox{Very often glyphs get very small spaces inserted horizontally.}
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-fonts-ligatures.mkiv b/tex/context/modules/mkiv/s-fonts-ligatures.mkiv
index fc49ec5c5..6a5da48ea 100644
--- a/tex/context/modules/mkiv/s-fonts-ligatures.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-ligatures.mkiv
@@ -156,12 +156,12 @@
\stoptexdefinition
\starttexdefinition showotfligaturesexample #1#2
- \ctxlua{document.currentdiscexpansion = fonts.getdiscexpansion()}%
+ % \ctxlua{document.currentdiscexpansion = fonts.getdiscexpansion()}%
\showotfligaturescaptions {#1}
\showotfligatureslines {#2}
\showotfligaturesparagraphs{#2}
\showotfligaturesextremes {#2}
- \ctxlua{fonts.setdiscexpansion(document.currentdiscexpansion)}%
+ % \ctxlua{fonts.setdiscexpansion(document.currentdiscexpansion)}%
\stoptexdefinition
% todo: n -> and split in lua
diff --git a/tex/context/modules/mkiv/s-fnt-20.mkiv b/tex/context/modules/mkiv/s-fonts-steps.mkiv
index 584043099..6e11a6a77 100644
--- a/tex/context/modules/mkiv/s-fnt-20.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-steps.mkiv
@@ -1,5 +1,5 @@
%D \module
-%D [ file=s-fnt-20,
+%D [ file=s-fonts-steps, % was s-fnt-20
%D version=2009.01.10,
%D title=\CONTEXT\ Style File,
%D subtitle=Tracing Feature Application (1),
@@ -14,6 +14,8 @@
%D This file is used by Idris and me in the process of getting the
%D best arabic fonts getting rendered best. As such it might change.
+\startmodule[fonts-steps]
+
% \setvariables
% [otftracker]
% [title=Reverse Chaining,
@@ -39,21 +41,16 @@
liga=yes,dlig=yes,rlig=yes,clig=yes,
mark=yes,mkmk=yes,kern=yes,curs=yes]
-% \definefontfeature
-% [otftracker-husayni]
-% [analyze=yes,mode=node,
-% language=dflt,script=arab,ccmp=yes,
-% init=yes,medi=yes,fina=yes,isol=yes,
-% calt=yes,
-% mark=yes,mkmk=yes,kern=yes,curs=yes]
-
\definefontfeature
- [otftracker-husayni]
+ [otftracker-husayni-default]
[analyze=yes,mode=node,
language=dflt,script=arab,
init=yes,medi=yes,fina=yes,
+ spacekern=yes,
+ calt=yes,
rlig=yes,
ccmp=yes,
+ salt=yes,
ss01=yes, % full Allah, Muhammad, Allahumma
ss05=yes, % full Jiim stacking
ss09=yes, % full Haa stacking
@@ -78,6 +75,10 @@
mark=yes,mkmk=yes,kern=yes,curs=yes]
\definefontfeature
+ [otftracker-husayni]
+ [otftracker-husayni-default]
+
+\definefontfeature
[otftracker-simplenaskhi]
[analyze=yes,mode=node,
language=dflt,script=arab,
@@ -89,6 +90,7 @@
\setvalue{otftracker-direction-husayni}{r2l}
\setvalue{otftracker-direction-simplenaskhi}{r2l}
\setvalue{otftracker-direction-default}{}
+\setvalue{otftracker-direction-sbl-hbrw}{r2l}
\setvariables
[otftracker]
@@ -123,24 +125,47 @@
\setupcolors
[state=start]
+\startsetups otftracker-steps
+ \doifsomething {\getvariable{otftracker}{figure}} {
+ \startlinecorrection
+ \externalfigure[\getvariable{otftracker}{figure}][maxwidth=\hsize,frame=on]
+ \stoplinecorrection
+ }
+ \showotfcomposition
+ {\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}}
+ {\getvariable{otftracker}{direction}}
+ {\getvariable{otftracker}{sample}}
+\stopsetups
+
\startsetups otftracker
\setupbodyfont[tt,10pt]
\starttext
\normalexpanded{\startchapter[title={\getvariable{otftracker}{title}}]}
- \doifsomething {\getvariable{otftracker}{figure}} {
- \startlinecorrection
- \externalfigure[\getvariable{otftracker}{figure}][maxwidth=\hsize,frame=on]
- \stoplinecorrection
- }
- \showotfcomposition
- {\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}}
- {\getvariable{otftracker}{direction}}
- {\getvariable{otftracker}{sample}}
+ \directsetup{otftracker-steps}
+ \directsetup{otftracker-extra}
\stopchapter
+ \setvariables[otftracker][comment=]
\stoptext
\stopsetups
-\continueifinputfile{s-fnt-20.mkiv}
+%D For old times sake we keep this one:
+
+\unexpanded\def\ShowOtfTrackerSample#1%
+ {\doiffile{#1}
+ {\blank
+ \startlinecorrection
+ \vbox \bgroup
+ \forgetall
+ \setbox\scratchbox\hbox{\component #1 \relax}
+ \hbox{\copy\scratchbox\quad\lower\dp\scratchbox\hbox{\ruledhbox{\externalfigure[#1-volt.pdf][height=\htdp\scratchbox]}}}
+ \hbox{\strut\tttf#1}%
+ \egroup
+ \stoplinecorrection
+ \blank}}
+
+\stopmodule
+
+\continueifinputfile{s-fonts-steps.mkiv}
\usemodule[art-01]
diff --git a/tex/context/modules/mkiv/s-fonts-variable.mkiv b/tex/context/modules/mkiv/s-fonts-variable.mkiv
index 64348b324..5c9d53d33 100644
--- a/tex/context/modules/mkiv/s-fonts-variable.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-variable.mkiv
@@ -30,11 +30,11 @@
{\begingroup
\scratchskip \interwordspace plus \interwordstretch minus \interwordshrink
\normalexpanded{\hpack\bgroup
- \tttf
- sp: \the\scratchskip \hskip\emwidth
- es: \the\extraspace\hskip\emwidth
- ex: \the\exheight \hskip\emwidth
- em: \the\emwidth \hskip\emwidth
+ \tt\txx
+ sp: \the\scratchskip\hskip\emwidth
+ es: \the\extraspace \hskip\emwidth
+ ex: \the\exheight \hskip\emwidth
+ em: \the\emwidth \hskip\emwidth
\egroup}%
\endgroup}
@@ -46,8 +46,8 @@
\setuphead[section][before={\testpage[5]\blank[2*big]}]
-\enabletrackers[modules.fonts.variables.glyphs]
-\enabletrackers[modules.fonts.variables.kerns]
+% \enabletrackers[modules.fonts.variables.glyphs]
+% \enabletrackers[modules.fonts.variables.kerns]
\starttext
@@ -72,10 +72,6 @@
\char983040\relax\par
\stopbuffer
-% \showfontvariations
-% [font=file:VotoSerifGX.ttf,
-% max=6]
-
\showfontvariations
[font=file:adobevfprototype.otf]
@@ -85,9 +81,9 @@
\showfontvariations
[font=file:DecoVar-VF.ttf]
- \showfontvariations
- [font=file:VotoSerifGX.ttf,
- max=15]
+ % \showfontvariations
+ % [font=file:VotoSerifGX.ttf,
+ % max=15]
\showfontvariations
[font=file:Selawik-Variable.ttf]
@@ -108,4 +104,7 @@
% \showfontvariations
% [font=file:AmstelvarAlpha-VF.ttf]
+ \showfontvariations
+ [font=file:bahnschrift.ttf]
+
\stoptext
diff --git a/tex/context/modules/mkiv/s-mag-01.mkiv b/tex/context/modules/mkiv/s-magazine-basic.mkiv
index 7191d760c..267bf50d8 100644
--- a/tex/context/modules/mkiv/s-mag-01.mkiv
+++ b/tex/context/modules/mkiv/s-magazine-basic.mkiv
@@ -1,5 +1,5 @@
%D \module
-%D [ file=s-mag-01,
+%D [ file=s-magazine-basic, % was: s-mag-01
%D version=2016.09.12, % mkiv version of 2002.12.14,
%D title=\CONTEXT\ Style File,
%D subtitle=\CONTEXT\ Magazine Base Style,
diff --git a/tex/context/modules/mkiv/s-map-10.mkiv b/tex/context/modules/mkiv/s-maps.mkiv
index c7541babc..c7541babc 100644
--- a/tex/context/modules/mkiv/s-map-10.mkiv
+++ b/tex/context/modules/mkiv/s-maps.mkiv
diff --git a/tex/context/modules/mkiv/s-math-characters.lua b/tex/context/modules/mkiv/s-math-characters.lua
index 757e843da..1888dabb4 100644
--- a/tex/context/modules/mkiv/s-math-characters.lua
+++ b/tex/context/modules/mkiv/s-math-characters.lua
@@ -16,6 +16,8 @@ local lower = string.lower
local utfchar = utf.char
local round = math.round
+local context = context
+
local fontdata = fonts.hashes.identifiers
local chardata = characters.data
local blocks = characters.blocks
@@ -73,10 +75,11 @@ function moduledata.math.characters.showlist(specification)
sorted = table.sortedkeys(characters)
end
if virtual then
- for k, v in ipairs(tfmdata.fonts) do
- local id = v.id
+ local fonts = tfmdata.fonts
+ for i=1,#fonts do
+ local id = fonts[i].id
local name = fontdata[id].properties.name
- names[k] = (name and file.basename(name)) or id
+ names[i] = (name and file.basename(name)) or id
end
end
if check then
diff --git a/tex/context/modules/mkiv/s-math-ligatures.lua b/tex/context/modules/mkiv/s-math-ligatures.lua
new file mode 100644
index 000000000..5c888c088
--- /dev/null
+++ b/tex/context/modules/mkiv/s-math-ligatures.lua
@@ -0,0 +1,72 @@
+if not modules then modules = { } end modules['s-math-ligatures'] = {
+ version = 1.001,
+ comment = "companion to s-math-ligatures.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+moduledata.math = moduledata.math or { }
+moduledata.math.ligatures = moduledata.math.ligatures or { }
+
+local context = context
+
+local utfchar = utf.char
+local uformat = string.formatters["%U"]
+
+function moduledata.math.ligatures.showlist(specification)
+ -- specification = interfaces.checkedspecification(specification)
+
+ local function setlist(unicode,list,start,v,how)
+ if list[start] ~= 0x20 then
+ local t, u = { }, { }
+ for i=start,#list do
+ local li = list[i]
+ t[#t+1] = utfchar(li)
+ u[#u+1] = uformat(li)
+ end
+ context.NC() context(how)
+ context.NC() context("%U",unicode)
+ context.NC() context("%c",unicode)
+ context.NC() context("% t",u)
+ context.NC() context("%t",t)
+ context.NC() context("%t",t)
+ context.NC()
+ context.nohyphens()
+ context.veryraggedright()
+ local n = v.mathname
+ if n then
+ context.tex(n)
+ else
+ local c = v.mathspec
+ if c then
+ for i=1,#c do
+ local n = c[i].name
+ if n then
+ context.tex(n)
+ context.quad()
+ end
+ end
+ end
+ end
+ context.NC()
+ context.NR()
+ end
+ end
+
+ context.starttabulate { "|T|T|m|T|T|m|pl|" }
+ for unicode, v in table.sortedhash(characters.data) do
+ local vs = v.specials
+ if vs and #vs > 2 then
+ local kind = vs[1]
+ if (v.mathclass or v.mathspec) and (kind == "char" or kind == "compat") then
+ setlist(unicode,vs,2,v,"sp")
+ end
+ end
+ local ml = v.mathlist
+ if ml then
+ setlist(unicode,ml,1,v,"ml")
+ end
+ end
+ context.stoptabulate()
+end
diff --git a/tex/context/modules/mkiv/s-math-ligatures.mkiv b/tex/context/modules/mkiv/s-math-ligatures.mkiv
new file mode 100644
index 000000000..39fc4d2a3
--- /dev/null
+++ b/tex/context/modules/mkiv/s-math-ligatures.mkiv
@@ -0,0 +1,50 @@
+%D \module
+%D [ file=s-math-ligatures.mkiv,
+%D version=2017.08.03,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Math Ligature Checking,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[math-ligatures]
+
+\registerctxluafile{s-math-ligatures}{}
+
+\unprotect
+
+\unexpanded\def\showmathligatures
+ {\dosingleempty\module_math_ligatures_show}
+
+\def\module_math_ligatures_show[#1]%
+ {\begingroup
+ \ctxlua{moduledata.math.ligatures.showlist{ }}%
+ \endgroup}
+
+\protect
+
+\stopmodule
+
+\continueifinputfile{s-math-ligatures.mkiv}
+
+\setupbodyfont[dejavu,10pt]
+
+\setuplayout
+ [width=middle,
+ height=middle,
+ topspace=15mm,
+ backspace=15mm,
+ bottomspace=15mm,
+ header=1cm,
+ headerdistance=0.5cm,
+ footer=0pt]
+
+\starttext
+
+ \showmathligatures
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-math-repertoire.mkiv b/tex/context/modules/mkiv/s-math-repertoire.mkiv
index 91af45dfc..90d0b09d3 100644
--- a/tex/context/modules/mkiv/s-math-repertoire.mkiv
+++ b/tex/context/modules/mkiv/s-math-repertoire.mkiv
@@ -265,7 +265,7 @@
\unexpanded\def\showmathcharacterssetbodyfonts#1%
{\edef\showmathcharactersbodyfonts{#1}%
- \def\doshowmathcharacterssetbodyfonts##1{\setupbodyfont[##1,12pt]}%
+ \def\doshowmathcharacterssetbodyfonts##1{\setupbodyfont[##1,12pt]}% \usebodyfont[##1,12pt]%
\processcommacommand[\showmathcharactersbodyfonts]\doshowmathcharacterssetbodyfonts}
\unexpanded\def\showmathcharactersbodyfontschars#1%
@@ -453,7 +453,7 @@
\continueifinputfile{s-math-repertoire.mkiv}
-\showmathcharacterssetbodyfonts{lucidaot,cambria,xits,modern,pagella,termes,bonum,schola,dejavu}
+\showmathcharacterssetbodyfonts{lucidaot,cambria,xits,stixtwo,modern,pagella,termes,bonum,schola,dejavu}
\starttext
diff --git a/tex/context/modules/mkiv/s-mod-01.mkiv b/tex/context/modules/mkiv/s-module-basic.mkiv
index f1c8d4258..74621b2a3 100644
--- a/tex/context/modules/mkiv/s-mod-01.mkiv
+++ b/tex/context/modules/mkiv/s-module-basic.mkiv
@@ -25,11 +25,13 @@
%D him when you run into problems. Bugs in this style can be sent to
%D Hans.
-\usemodule
- [abr-00]
+\showframe
-\setvariables
- [document]
+\usemodule[abbreviations-words]
+
+\startmodule[modules-basics]
+
+\setupdocument
[ file=\jobname,
type=unknown,
version={\currentdate[\v!year,{.},\v!month,{.},\v!day]},
@@ -120,6 +122,11 @@
\setuppalet
[module:\documentvariable{type}]
+ \setuptyping
+ [definition]
+ [lines=yes,
+ option=\documentvariable{type}]
+
\startTEXpage
\useMPgraphic{page}
\stopTEXpage
@@ -181,20 +188,32 @@
\endgroup
\stoptexdefinition
-\definetyping [PL] [\c!option=PL]
-\definetyping [JV] [\c!option=JV]
-\definetyping [MP] [\c!option=MP]
-\definetyping [TEX] [\c!option=TEX]
-\definetyping [LUA] [\c!option=LUA]
+% \definetyping [PL] [\c!option=PL]
+% \definetyping [JV] [\c!option=JV]
+% \definetyping [MP] [\c!option=MP]
+% \definetyping [TEX] [\c!option=TEX]
+% \definetyping [LUA] [\c!option=LUA]
-\setuptyping [\v!typing] [\c!margin=\v!standard]
-\setuptyping [\v!file] [\c!margin=\v!standard]
-\setuptyping [definition] [\c!margin=0pt,\c!numbering=\v!line,\c!continue=\v!yes] % this continue wins
+\setuptyping
+ [\v!typing]
+ [\c!margin=\v!standard,
+ \c!lines=\v!yes]
+
+\setuptyping
+ [\v!file]
+ [\c!margin=\v!standard,
+ \c!lines=\v!yes]
+
+\setuptyping
+ [definition]
+ [\c!margin=0pt,
+ \c!numbering=\v!line,
+ \c!continue=\v!yes,
+ \c!lines=\v!yes]
\setuplinenumbering
[definition]
[\c!style=\ttx,
- \c!distance=\leftmargindistance,
\c!align=\v!flushright]
% This will be cleaned up.
@@ -206,7 +225,7 @@
\else
\index{#1{#2}}%
\fi
- #1{\doboundtext{#2}{\leftmarginwidth}{..}}}}
+ \dontleavehmode#1{\doboundtext{#2}{\leftmarginwidth}{..}}}}
\unexpanded\def\modulemarginstuff#1#2% to be renamed
{\processcommalist[#2]{\domodulemarginstuff#1}}
@@ -216,7 +235,7 @@
[left]
[stack=yes,
hoffset=2em,
- style=\ttxx]
+ style=\ttxx\setstrut]
\unexpanded\def\macros {\modulemarginstuff\tex }
\unexpanded\def\extras {\modulemarginstuff\relax}
@@ -257,11 +276,11 @@
% style (we use dejavu as it supports more characters)
-\switchtobodyfont
- [dejavu-condensed,10pt] % preload
+\usebodyfont
+ [dejavu-condensed,9pt] % preload
\setupbodyfont
- [dejavu,10pt] % main font
+ [dejavu,9pt] % main font
\mainlanguage
[en]
@@ -379,13 +398,6 @@
}
-% bonus
-
-\usemodule
- [abr-02]
-
-% another one
-
-\dontcomplain
+\protect
-\protect \endinput
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-pages-statistics.mkiv b/tex/context/modules/mkiv/s-pages-statistics.mkiv
index 375dd9949..54d49bb9f 100644
--- a/tex/context/modules/mkiv/s-pages-statistics.mkiv
+++ b/tex/context/modules/mkiv/s-pages-statistics.mkiv
@@ -82,9 +82,12 @@
}
\stopsetups
+\definecolor[system:page:otr:statistics][t=.8,a=1]
+
\defineoverlay
[system:page:otr:statistics]
- [{\framed
+ [{\starttransparent[system:page:otr:statistics]%
+ \framed
[\c!offset=\bodyfontsize,
\c!background=\v!color,
\c!strut=\v!no,
@@ -96,7 +99,8 @@
\c!align=\v!middle]
{\forgetall
\insidefloattrue
- \setups{system:page:otr:statistics}}}]
+ \setups{system:page:otr:statistics}}%
+ \stoptransparent}]
\unexpanded\def\page_one_command_package_show_state_indeed
{\scratchheight\ht\b_page_one_contents
diff --git a/tex/context/modules/mkiv/s-pre-30.mkiv b/tex/context/modules/mkiv/s-pre-30.mkiv
deleted file mode 100644
index 1be85d02b..000000000
--- a/tex/context/modules/mkiv/s-pre-30.mkiv
+++ /dev/null
@@ -1,257 +0,0 @@
-%D \module
-%D [ file=s-pre-30,
-%D version=2006.04.25,
-%D title=\CONTEXT\ Style File,
-%D subtitle=Presentation Environment 30,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\usemodule[streams]
-
-\setuppapersize
- [S6] [S6]
-
-\setupbodyfont
- [12pt,tt]
-
-\definemeasure[bleed][6pt]
-
-\definecolor[maincolor-3][r=.5,g=.2,b=.2]
-\definecolor[maincolor-1][r=.2,g=.5,b=.2]
-\definecolor[maincolor-2][r=.2,g=.2,b=.5]
-
-\definecolor[pagecolor] [s=.5]
-\definecolor[resultcolor][s=1,t=.85,a=1]
-\definecolor[maincolor] [maincolor-3]
-
-\definecolorgroup
- [maingroup]
- [.5:.2:.2,
- .2:.5:.2,
- .2:.2:.5]
-
-\definecolorgroup
- [resultgroup]
- [1:.85:.85,
- .85:1:.85,
- .85:.85:1]
-
-\def\CurrentColor{1}
-
-\definecolor[maincolor] [maingroup:\CurrentColor]
-\definecolor[resultcolor][resultgroup:\CurrentColor]
-
-\def\NextColor{\ifnum\CurrentColor=3 \def\CurrentColor{1}\else\doglobal\increment\CurrentColor\fi}
-
-\setuplayout
- [backspace=\measure{bleed},
- topspace=30pt,
- bottomdistance=\measure{bleed},
- bottom=\dimexpr30pt-\measure{bleed}\relax,
- header=0pt,
- footer=0pt,
- topdistance=\measure{bleed},
- top=\dimexpr30pt-\measure{bleed}\relax,
- width=middle,
- height=middle]
-
-\setuptop
- [before=\vfill,
- after=\vfill,
- strut=yes]
-
-\setupbackgrounds
- [text]
- [backgroundoffset=\measure{bleed},
- background=color,
- backgroundcolor=maincolor]
-
-\setupbackgrounds
- [page]
- [background=color,
- backgroundcolor=pagecolor]
-
-\setupcolors
- [state=start,
- textcolor=white]
-
-\setuphead
- [chapter]
- [style=\ttd]
-
-\setuphead
- [section]
- [style=\ttd]
-
-\defineviewerlayer
- [result]
- [state=stop]
-
-\definelayer
- [result]
-
-\setuplayer
- [result]
- [width=\textwidth,
- height=\textheight]
-
-\setupbackgrounds
- [text]
- [background={color,toggle,foreground,result}]
-
-\setupinteraction
- [state=start,
- click=no,
- menu=on,
- color=white,
- contrastcolor=white,
- closepageaction=HideLayer{result},
- openpageaction=HideLayer{result}]
-
-% We add a dummy color switch so that each page has at least one
-% transparency; else acrobat will render the pages differently
-% bug in 6 and 7).
-
-\startinteractionmenu[bottom]
-% \color[resultcolor]{ }%
- \hfill
- \got [content] content \\
- \got [previouspage] previous \\
- \got [nextpage] next \\
- \got [ToggleLayer{result}] result \\
- \got [CloseDocument] close \\
-\stopinteractionmenu
-
-\setuphead
- [section]
- [placehead=no,
- incrementnumber=list]
-
-\setuplist
- [section]
- [alternative=f]
-
-\defineoverlay
- [toggle]
- [\overlaybutton{ToggleLayer{result}}]
-
-\definestreamlayer
- [resultstream]
-
-\startsetups streamlayer:resultstream:flush
- \setlayer
- [result]
- [preset=middlebottom,
- hoffset=\measure{bleed},
-% voffset=-\measure{bleed}]
- voffset=\measure{bleed}]
- {\startviewerlayer[result]%
-% \framed
-% [offset=overlay,
-% frame=off,
-% background=color,
-% backgroundoffset=1\dimexpr\measure{bleed}\relax,
-% backgroundcolor=maincolor]
- {\framed
- [offset=overlay,
- frame=off,
- foregroundcolor=maincolor,
- background=color,
- backgroundoffset=1\dimexpr\measure{bleed}\relax,
- backgroundcolor=resultcolor]
- {\tightlayer[\currentstreamlayer]}}
- \stopviewerlayer}
-\stopsetups
-
-\startsetups show-definition
- \subject{definition}
- \typebuffer
- \getbuffer
- \page
-\stopsetups
-
-\startsetups show-result
- \startstreamlayer[resultstream]
- \subject{result}
- \getbuffer
- \stopstreamlayer
- \placestreamlayer[resultstream]
- \page
-\stopsetups
-
-\startsetups show-usage
- \subject{usage}
- \typebuffer
- \startstreamlayer[resultstream]
- \subject{result}
- \getbuffer
- \stopstreamlayer
- \placestreamlayer[resultstream]
- \page
-\stopsetups
-
-\startsetups show-usage-lines
- \subject{usage}
- \typebuffer
- \startstreamlayer[resultstream]
- \subject{result}
- \startlines
- \getbuffer
- \stoplines
- \stopstreamlayer
- \placestreamlayer[resultstream]
- \page
-\stopsetups
-
-\startsetups show-contents
- \startcolumns[n=3]
- \placelist[section][criterium=text]
- \stopcolumns
- \pagereference[content]
- \page
- \NextColor
-\stopsetups
-
-\def\TitlePage#1%
- {\title{#1}
- \setups{show-contents}}
-
-\def\StartSample#1%
- {\starttext
- \page
- \section{#1}
- \setuptoptexts[][\processedfile\enspace:\enspace\lowercase{#1}]}
-
-\def\StopSample
- {\page
- \setuptoptexts[][]
- \stoptext
- \NextColor}
-
-\endinput
-
-\usemodule[pre-30]
-
-% \TitlePage{Howling to the moon}
-
-\StartSample{Basics}
-
-\startbuffer
-\lua{a = 1.5 ; b = 1.8 ; c = a*b ; context(c) ;}
-
-\startlua
- a = 1
- b = 2
- c = a*b
- context(c)
-\stoplua
-\stopbuffer
-
-\setups{show-usage}
-
-\StopSample
diff --git a/tex/context/modules/mkiv/s-present-lines.mkiv b/tex/context/modules/mkiv/s-present-lines.mkiv
new file mode 100644
index 000000000..3a2fdae53
--- /dev/null
+++ b/tex/context/modules/mkiv/s-present-lines.mkiv
@@ -0,0 +1,172 @@
+%D \module
+%D [ file=s-present-lines,
+%D version=1017.09.01,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Presentation Environment Balls,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This style was made for the \CONTEXT\ 2017 meeting. According to Alan Braslau we
+%D should not display items that we discuss but for now I stick to it. As a
+%D compromise this is a simple and effective style.
+
+\startmodule[present-lines]
+
+\definecolor[backcolor][s=.6]
+\definecolor[pagecolor][s=.3]
+\definecolor[dotscolor][s=.2]
+\definecolor[maincolor][b=.6]
+
+\definecolor[maincolor][r=.6]
+
+\setuppapersize
+ [S6]
+
+\setuplayout
+ [header=0pt,
+ footer=0pt,
+ topspace=20mm,
+ backspace=20mm,
+ width=middle,
+ height=middle]
+
+\setupbackgrounds
+ [page]
+ [background=page]
+
+\defineoverlay
+ [page]
+ [\useMPgraphic{page}]
+
+\setupitemgroup
+% [color=dotscolor]
+ [color=maincolor]
+
+\definesymbol
+ [1][{\symbol[\char"25A0]}]
+
+\setupbodyfont
+ [dejavu]
+
+\startuseMPgraphic{page}
+ StartPage ;
+ numeric d ; d := 15pt ;
+ fill Page
+ enlarged 2d
+ withcolor "pagecolor" ;
+ fill Field[Text][Text]
+ enlarged 2d
+ withcolor "backcolor" ;
+ draw leftboundary Field[Text][Text]
+ bottomenlarged 3d
+ topenlarged -(d/10)
+ shifted (-d,0)
+ withpen pensquare scaled (d/5)
+ withcolor "maincolor" ;
+ draw bottomboundary Field[Text][Text]
+ leftenlarged 3d
+ rightenlarged -(d/10)
+ shifted (0,-d)
+ withpen pensquare scaled (d/5)
+ withcolor "maincolor" ;
+ draw rightboundary Field[Text][Text]
+ topenlarged 3d
+ bottomenlarged -(d/10)
+ shifted (d,0)
+ withpen pensquare scaled (d/5)
+ withcolor "maincolor" ;
+ draw topboundary Field[Text][Text]
+ rightenlarged 3d
+ leftenlarged -(d/10)
+ shifted (0,d)
+ withpen pensquare scaled (d/5)
+ withcolor "maincolor" ;
+ StopPage ;
+\stopuseMPgraphic
+
+\setuphead
+ [chapter,title]
+ [placehead=empty,
+ number=no,
+ after={\blank[disable]},
+ before=]
+
+\setuptext
+ [color=pagecolor,
+ style=\bfd]
+
+\setuptexttexts
+ [\directsetup{text:texts}]
+
+\startsetups text:texts
+ \vbox to \textheight {
+ \vfill
+ \hfill
+ \setstrut
+ \strut
+ \getmarking[chapter]
+ \getmarking[title]
+ \vskip-\strutdp
+ }
+\stopsetups
+
+\startsetups document:start
+ \startstandardmakeup
+ \startparagraph
+ % Per 01-02-2017 the Bold abstraction also makes sure that CurrentFont
+ % works well which in turn makes MixedCaps and such working.
+ \definedfont[Bold*default @ 42pt]
+ \setupinterlinespace
+ \startcolor[pagecolor]
+ \begstrut
+ \documentvariable{title}
+ \endstrut
+ \stopcolor
+ \stopparagraph
+ \blank[2*line]
+ \determinelistcharacteristics[chapter]
+ \ifnum\listlength>10\relax
+ \startcolumns
+ \placelist[chapter][alternative=f]
+ \stopcolumns
+ \else
+ \placelist[chapter][alternative=f]
+ \fi
+ \vfill
+ \hfill
+ \bfb
+ \setstrut
+ \strut
+ \startcolor[pagecolor]
+ \documentvariable{subtitle}
+ \stopcolor
+ \vskip-\strutdp
+ \stopstandardmakeup
+\stopsetups
+
+\setupinteraction
+ [state=start,
+ color=maincolor,
+ contrastcolor=maincolor,
+ style=]
+
+\setuptyping
+ [color=maincolor]
+
+\setuptype
+ [color=maincolor]
+
+\usemodule[abr-04]
+
+\stopmodule
+
+\continueifinputfile{s-present-lines.mkiv}
+
+% \usemodule[present-common]
+
+% \inputpresentationfile{examples/....} % todo, 2017 presentations
diff --git a/tex/context/modules/mkiv/s-present-original.mkiv b/tex/context/modules/mkiv/s-present-original.mkiv
index 809f7b2cb..1c5e94c85 100644
--- a/tex/context/modules/mkiv/s-present-original.mkiv
+++ b/tex/context/modules/mkiv/s-present-original.mkiv
@@ -57,7 +57,7 @@
% \definecolor [InteractionColor] [r=.1, g=.5, b=.8]
% \definecolor [ContrastColor] [r=.9, g=.5, b=.2]
-\definecolor [BackgroundColor] [r=.7, g=.7, b=.3]
+\definecolor [BackgroundColor] [r=.7, g=.7, b=.3]
\definecolor [InteractionColor] [r=.1, g=.5, b=.8]
\definecolor [ContrastColor] [r=.9, g=.5, b=.2]
diff --git a/tex/context/modules/mkiv/s-pre-17.mkiv b/tex/context/modules/mkiv/s-present-weird.mkiv
index 558d5afd2..27ef7b2c2 100644
--- a/tex/context/modules/mkiv/s-pre-17.mkiv
+++ b/tex/context/modules/mkiv/s-present-weird.mkiv
@@ -1,8 +1,8 @@
%D \module
-%D [ file=s-pre-17,
+%D [ file=s-present-weird, % s-pre-17,
%D version=1999.08.20,
%D title=\CONTEXT\ Style File,
-%D subtitle=Presentation Environment 17,
+%D subtitle=Presentation Environment Weird,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
@@ -11,6 +11,14 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+\startmodule[present-balls]
+
+%D This is a rather old style, adn I used it for a presentation about \MATHML\
+%D around the turn of the century. Unfortunately I can't find back that weird
+%D presentation. I didn't change the code apart from loading the body font. One can
+%D clock on an area and get it large. Clicking elsewhere brings back the main page.
+%D It was actualy a zoom test at that time.
+
\setupbodyfont
[dejavu,11pt,ss]
@@ -30,7 +38,7 @@
\setupinteraction
[state=start,
-% click=off,
+ % click=off,
color=TitleColor,
contrastcolor=TitleColor]
@@ -146,7 +154,7 @@
next=connection:\NextBlaBla
}
\hbox to 600pt \bgroup
- \setupinteraction[focus=fitr]
+ \setupinteraction[focus=frame]
\getrandomdimen\scratchdimen{50pt}{75pt}
\hskip0pt plus \scratchdimen minus \scratchdimen
\hpos {
@@ -196,7 +204,7 @@
\hbox to \wd\scratchbox
}
\bgroup
- \setupinteraction[focus=fitr]
+ \setupinteraction[focus=frame]
\hss
\switchtobodyfont[big]%
\bfd
@@ -238,8 +246,8 @@
[MasterPage]
[MasterPage]
\setuplayout [
- topspace=25pt,
- backspace=25pt,
+ topspace=50pt,
+ backspace=50pt,
width=middle,
header=0pt,
footer=0pt,
@@ -287,118 +295,8 @@
\endgroup
\stoptexdefinition
-\continueifinputfile{s-pre-17.mkiv}
-
-\starttext
-
-\nopdfcompression
-
-\TitlePage{About Text\\Today's Talk\\Hans Hagen}
-
-\StartPage{The First Page}
-
- \StartTopic{Some Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StartText \input knuth \StopText
- \StopTopic
-
- \StartTopic{Another Text}
- \StartText \input tufte \StopText
- \StartText \input zapf \StopText
- \StartText \input knuth \StopText
- \StopTopic
-
- \StartTopic{Some More Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StartText \input tufte \StopText
- \StopTopic
-
- \StartTopic{Some Text Again}
- \StartText \input tufte \StopText
- \StartText \input zapf \StopText
- \StartText \input knuth \StopText
- \StartText \input tufte \StopText
- \StopTopic
-
-\StopPage
-
-\StartPage{The Second Page}
-
- \StartTopic{Some Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StopTopic
-
- \StartTopic{Another Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StopTopic
-
- \StartTopic{Some Nice Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StartText \input tufte \StopText
- \StartText \input tufte \StopText
- \StopTopic
-
- \StartTopic{Some Funny Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StopTopic
-
- \StartTopic{Quite Some Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StopTopic
-
- \StartTopic{Even More Text}
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StopTopic
-
-\StopPage
-
-\StartPage{The Third Page}
-
- \StartTopic{Some Short Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StopTopic
-
- \StartTopic{Some Minimal Text}
- \StartText \input tufte \StopText
- \StartText \input zapf \StopText
- \StopTopic
-
- \StartTopic{Some More Text}
- \StartText \input tufte \StopText
- \StartText \input knuth \StopText
- \StartText \input zapf \StopText
- \StartText \input tufte \StopText
- \StartText \input tufte \StopText
- \StopTopic
+\stopmodule
-\StopPage
+\continueifinputfile{s-present-balls.mkiv}
-\stoptext
+\inputpresentationfile{examples/present-weird-001.tex}
diff --git a/tex/context/modules/mkiv/s-reg-01.mkiv b/tex/context/modules/mkiv/s-reg-01.mkiv
deleted file mode 100644
index 36434c30c..000000000
--- a/tex/context/modules/mkiv/s-reg-01.mkiv
+++ /dev/null
@@ -1,60 +0,0 @@
-%D \module
-%D [ file=s-reg-01,
-%D version=2005.04.25,
-%D title=\CONTEXT\ Style File,
-%D subtitle=Extra Regime Support,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D \macros
-%D {showregime}
-%D
-%D This code is moved from the kernel to here. (We could make it
-%D auto-loadable).
-
-\startluacode
---[[ldx--
-<p>The following code is rather <l n='context'/> specific.</p>
---ldx]]--
-
-function regimes.show(regime)
- regime = regimes.synonyms[regime] or regime
- local r = regimes.data[regime]
- if r then
- local chardata = characters.data
- context.starttabulate { "|rT|T|rT|lT|lT|lT|" }
- for k, v in ipairs(r) do
- local chr = chardata[v]
- if chr then
- context.NC() context(k)
- context.NC() context.getvalue(chr.contextname])
- context.NC() context("%U+05X",v)
- context.NC() context(chr.contextname)
- context.NC() context(chr.category)
- context.NC() context(chr.description)
- context.NC() context.NR()
- else
- -- can't happen
- end
- end
- context.stoptabulate()
- else
- context("unknown regime %s",regime)
- end
-end
-\stopluacode
-
-\unprotect
-
-\def\showregime
- {\dosingleempty\doshowregime}
-
-\def\doshowregime[#1]%
- {\ctxlua{regimes.show("#1")}}
-
-\protect \endinput
diff --git a/tex/context/modules/mkiv/s-regimes-list.mkiv b/tex/context/modules/mkiv/s-regimes-list.mkiv
new file mode 100644
index 000000000..0124b3023
--- /dev/null
+++ b/tex/context/modules/mkiv/s-regimes-list.mkiv
@@ -0,0 +1,74 @@
+%D \module
+%D [ file=s-regimes-list, % was: s-reg-01
+%D version=2005.04.25,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Extra Regime Support,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D \macros
+%D {showregime}
+%D
+%D This code is moved from the kernel to here.
+
+\startmodule[regimes-list]
+
+\startluacode
+
+moduledata.regimes = moduledata.regimes or { }
+moduledata.regimes.charts = moduledata.regimes.charts or { }
+
+local byte = string.byte
+
+function moduledata.regimes.charts.show(regime)
+ if regime and regime ~= "" then
+ local r = regimes.mapping[regime]
+ if r then
+ local chardata = characters.data
+ context.starttabulate { "|rT|rT|rT|cT|lT|lT|pT|" }
+ for k, v in table.sortedhash(r) do
+ local chr = chardata[v]
+ local num = byte(k)
+ local uni = utf.byte(v)
+ if chr then
+ context.NC() context(num)
+ context.NC() context("0x%02X",num)
+ context.NC() context("%U",uni)
+ context.NC() context.char(uni)
+ context.NC() context(chr.contextname)
+ context.NC() context(chr.category)
+ context.NC() context(chr.description)
+ context.NC() context.NR()
+ else
+ -- can't happen
+ end
+ end
+ context.stoptabulate()
+ else
+ context("unknown regime %s",regime)
+ end
+ else
+ context("available regimes: %, t",regimes.list())
+ end
+end
+
+\stopluacode
+
+\installmodulecommandluasingle \showregime {moduledata.regimes.charts.show}
+
+\stopmodule
+
+\continueifinputfile{s-regimes-list.mkiv}
+
+\usemodule[art-01]
+
+\starttext
+
+ \showregime[8859-1]
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-setups-macros.mkiv b/tex/context/modules/mkiv/s-setups-macros.mkiv
new file mode 100644
index 000000000..42c6b38a2
--- /dev/null
+++ b/tex/context/modules/mkiv/s-setups-macros.mkiv
@@ -0,0 +1,203 @@
+%D \module
+%D [ file=setups-macros,
+%D version=2018.01.15,
+%D title=\CONTEXT\ Setup Definitions,
+%D subtitle=Macro Properties,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startluacode
+
+ local find = string.find
+ local gsub = string.gsub
+ local topattern = string.topattern
+ local concat = table.concat
+ local sort = table.sort
+ local sortedkeys = table.sortedkeys
+ local sortedhash = table.sortedhash
+ local getmacro = tokens.getters.macro
+ local gethash = tex.hashtokens
+
+ local lpegmatch, P, R, C, S = lpeg.match, lpeg.P, lpeg.R, lpeg.C, lpeg.S
+
+ local macros = interfaces.macros or { }
+ interfaces.macros = macros
+
+ local hashtable = nil
+
+ -- table.save("temp.lua",gethash())
+
+ local prefix = P("??")
+ local initial = R("09")^1 * P(">")
+ local name = C(R("az","AZ") * (R("az","AZ","09")+S(" "))^0)
+ local parent = P(":parent")
+ local eos = P(-1)
+
+ local pattern1 = initial^0
+ * name
+ * parent^0
+ * eos
+ local pattern2 = prefix
+ * name
+ * eos
+ local pattern3 = C(initial^1)
+ * name
+ * parent^1 -- so no e.g. measure here
+ * eos
+
+
+ local function reload()
+ hashtable = gethash()
+ sort(hashtable)
+ end
+
+ interfaces.macros.reload = reload
+
+ function interfaces.macros.instances(str)
+ local namespace = getmacro("??"..str)
+ if namespace then
+ local found = { }
+ local pattern = P(namespace) * pattern1
+ if not hashtable then
+ reload()
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ local pi = lpegmatch(pattern,hi)
+ if pi then
+ found[pi] = true
+ end
+ end
+ return sortedkeys(found)
+ end
+ end
+
+ function interfaces.macros.namespaces()
+ local found = { }
+ if not hashtable then
+ reload()
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ local pi = lpegmatch(pattern2,hi)
+ if pi then
+ found[pi] = true
+ end
+ end
+ return sortedkeys(found)
+ end
+
+ function interfaces.macros.allinstances()
+ local found = { }
+ local reverse = { }
+ local all = { }
+ if not hashtable then
+ reload()
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ local pi = lpegmatch(pattern2,hi)
+ if pi then
+ found[pi] = true
+ reverse[getmacro("??"..pi)] = pi
+ end
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ local ni, pi = lpegmatch(pattern3,hi)
+ if ni and pi then
+ local ri = reverse[ni]
+ if ri and found[ri] then
+ local a = all[ri]
+ if a then
+ a[pi] = true
+ else
+ all[ri] = { [pi] = true }
+ end
+ end
+ end
+ end
+ return all
+ end
+
+ function interfaces.macros.collect(str)
+ local asked = gsub(str,"^\\","")
+ local found = { }
+ local pattern = "^" .. topattern(asked) .. "$"
+ if not hashtable then
+ reload()
+ end
+ for i=1,#hashtable do
+ local hi = hashtable[i]
+ if find(hi,pattern) then
+ found[hi] = true
+ end
+ end
+ return sortedkeys(found)
+ end
+
+ function commands.getinstances(str,separator)
+ local i = interfaces.macros.instances(str)
+ if i then
+ context(concat(i,separator or ", "))
+ end
+ end
+ function commands.getnamespaces(separator)
+ local i = interfaces.macros.namespaces()
+ if i then
+ context(concat(i,separator or ", "))
+ end
+ end
+
+ function commands.showallinstances()
+ local i = interfaces.macros.allinstances()
+ if i then
+ local ctxcmd = context.showoneinstance
+ for k, v in sortedhash(i) do
+ ctxcmd(k,concat(sortedkeys(v),", "))
+ end
+ end
+ end
+
+\stopluacode
+
+\unprotect
+
+\def\getinstances #1{\ctxlua{commands.getinstances("#1")}} % expandable
+\def\getnamespaces {\ctxlua{commands.getnamespaces()}} % expandable
+
+\unexpanded\def\showoneinstance#1#2%
+ {\begingroup
+ \hangindent\emwidth
+ \hangafter\plusone
+ \veryraggedright
+ \dontleavehmode
+ \ttbf#1:\space
+ \tttf#2\par
+ \endgroup}
+
+\unexpanded\def\showallinstances
+ {\ctxlua{commands.showallinstances()}}
+
+\protect
+
+\continueifinputfile{s-setups-macros.mkiv}
+
+\usemodule[art-01]
+
+\starttext
+
+% \getinstances{measure} \page
+% \getinstances{framed} \page
+% \getinstances{layout} \page
+%
+% \getnamespaces \page
+
+\showallinstances
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-tugboat.mkiv b/tex/context/modules/mkiv/s-tugboat.mkiv
new file mode 100644
index 000000000..2b3b07d11
--- /dev/null
+++ b/tex/context/modules/mkiv/s-tugboat.mkiv
@@ -0,0 +1,681 @@
+%D \module
+%D [ file=t-tugboat
+%D version=$Id: t-tugboat.tex 111 2013-02-25 17:56:22Z bnb $
+%D title=\CONTEXT\ Style File,
+%D subtitle=\TUGBOAT\ base style,
+%D author=Aditya Mahajan,
+%D date=\currentdate,
+%D copyright=Public Domain]
+
+%D This file is derived from \filename{s-tug-02} written by Hans Hagen
+%D and Steve Grathwohl. Karl Berry asked me for some changes in the
+%D \TUGBOAT\ style files. The original file had an option of typesetting
+%D on a grid. That was too clever for me to understand, and hence to
+%D modify. Since \TUGBOAT\ usually does not typeset on a grid, I redid the
+%D style, borrowing parts from \filename{s-tug-02} and redoing some
+%D parts from scratch.
+
+%D \section Variables %<<<1
+%D
+%D We store the information about the article in variables.
+
+\setvariables
+ [tugboat]
+ [type=article,
+ columns=no,
+ grid=yes
+ ]
+
+\setvariables
+ [tugboat]
+ [year=1900,
+ volume=0,
+ number=0,
+ page=900]
+
+\setvariables
+ [tugboat]
+ [title=ConTeXt style for TUGboat,
+ subtitle=,
+ keywords=,
+ author=T. Boat,
+ address=Pragmatically Advanced tugboats \\
+ 314 Pi Ave. \\
+ 8061GH Hasselt NL,
+ email={tugboat@tug.org}]
+
+%D \section Font Setup %<<<1
+%D
+%D \TUGBOAT\ uses slightly different interline space than the default.
+%D So we change the interline space.
+
+\definebodyfontenvironment [8pt] [interlinespace=9.5pt, big=9pt, small=7pt]
+\definebodyfontenvironment [9pt] [interlinespace=11pt, big=10pt, small=8pt]
+\definebodyfontenvironment [10pt] [interlinespace=12pt, big=12pt, small=9pt]
+\definebodyfontenvironment [12pt] [interlinespace=14pt,big=14.4pt,small=10pt]
+\definebodyfontenvironment [14.4pt] [interlinespace=18pt,big=14.4pt,small=12pt]
+\definebodyfontenvironment [9.8pt] % Because 9.8pt is used in typing environments
+
+%D \TUGBOAT\ uses Computer Modern fonts, and \CONTEXT\ uses Latin Modern
+%D by default. So, we just specify the font size.
+
+\setupbodyfont [10pt]
+
+% Italic rather than slanted for emphasis.
+\setupbodyfontenvironment[default][em=italic]
+
+% Break after these chars in urls, not before.
+\sethyphenatedurlafter /
+\sethyphenatedurlafter .
+\sethyphenatedurlafter _
+
+%D \section Layout Setup %<<<1
+%D
+%D The original layout used in the \LATEX\ style for \TUGBOAT\ is a bit
+%D ambiguous. It uses low|-|level \TEX\ syntax, rather than changing the
+%D layout in a human understandable way (for example, by using the
+%D \mono{geometry} package. I have tried to translate it to \CONTEXT\ as
+%D far as I understand.
+
+\setuppapersize[letter][letter]
+
+\setuplayout
+ [topspace=3.8pc,% was 3.5pc
+ header=1pc,
+ headerdistance=1.5pc,
+ height=middle,
+ footerdistance=2pc,
+ footer=1pc,
+ bottomspace=3pc,
+ %
+ backspace=6pc,
+ width=middle,
+ cutspace=6pc,
+ %
+ margin=4pc,
+ margindistance=1pc,
+ ]
+
+\setupcolumns[distance=1.5pc]
+
+\setuppagenumbering
+ [location=,
+ alternative=doublesided]
+
+%D In \TUGBOAT\ different articles are glued together to form the final
+%D journal, so we do not want each article to occupy even number of
+%D pages.
+
+\installpagebreakhandler {last} {}
+
+%D \section Indentation %<<<1
+%D
+%D We use automatic indentation control, that is: no
+%D indentation after titles and skips.
+
+\setupindenting[20pt,yes]
+
+%D We do not want indentation after lists.
+
+\setupenumerations [indentnext=no]
+
+\setupdescriptions [indentnext=no]
+
+%D \section Itemize
+%D
+%D And these. We typeset itemizations ragged right.
+
+\setupitemgroup
+ [itemize]
+ [indentnext=no,
+ align=right]
+
+%D We align them at the paragraph indentation and
+%D pack them by default.
+
+\setupitemgroup
+ [itemize]
+ [each]
+ [margin=1pc,
+ width=1em,
+ distance=0pt]
+
+\setupitemgroup
+ [itemize]
+ [1]
+ [packed]
+
+%D \section Section Headings %<<<1
+%D
+%D We follow the \TUGBOAT\ style for sections. I do not know if
+%D \type{align=right} also disables hyphenation. Lets wait and see on
+%D this. Rest all is straight forward. It took me a while to realize
+%D that in \LATEX\ \type{\@startsection} the absolute value of before
+%D skip (fourth argument) is important and not the sign.
+
+\setuphead
+ [section,subsection, subsubsection,
+ subject, subsubject, subsubsubject]
+ [style=bold,
+ align=right,
+ before={\blank[8pt]},
+ after={\blank[4pt]}]
+
+%D \section Spacing <<<1
+%D
+%D We define a logical skip. This is equal to the \tex{topsep} in latex,
+%D and most environments should have this skip.
+
+\defineblank[tugblank][3pt]
+\setupblank[3pt]
+
+
+\setupitemize[1][before={\blank[tugblank]},after={\blank[tugblank]},
+ inbetween={\blank[tugblank]}]
+
+\setuplines[before={\blank[tugblank]},after={\blank[tugblank]},
+ inbetween={\blank[tugblank]}]
+
+%D \section Typing %<<<1
+%D
+%D \TUGBOAT\ uses a smaller font size for verbatim typesetting.
+
+\setuptyping
+ [option=none,
+ % mkiv arbitrarily scales lm somehow randomly; 10pt gets 9pt back,
+ % we make it a little smaller.
+ bodyfont=9.8pt,
+ before={\blank[nowhite]}, % AM: If this is too small, use \blank[nowhite,tugblank]}
+ after={\blank[back,nowhite,tugblank]}]
+
+%D \section Footnotes %<<<1
+%D
+%D Not entirely a la \TUGBOAT:
+
+\setupfootnotes
+ [bodyfont=9pt,
+ location=columns%,
+% rule={\hrule width 5pc height .4pt depth 0pt\relax \kern \strutdepth}
+]
+
+\setupnotation[footnote]
+ [location=joinedup,
+ width=fit,
+ headstyle=normal,
+ distance=.5em]
+
+%>>>
+%D \section List %<<<
+%D
+%D We define a standard description and enumeration
+%D environment.
+
+\definedescription
+ [description]
+ [location=hanging,
+ width=broad,
+ before={\blank[tugblank]},
+ after={\blank[tugblank]}]
+
+\defineenumeration
+ [enumeration]
+ [location=hanging,
+ width=broad,
+ before={\blank[tugblank]},
+ after={\blank[tugblank]}]
+
+
+% >>>
+%D \section References %<<<
+%D
+%D The bib does not handle urls nicely. So we provide a stop gap solution.
+
+\definereferenceformat[cite][left={[},right={]}]
+\defineitemgroup [bibliography] [levels=1]
+\setupitemgroup [bibliography]
+ [symbol=n,
+ left={[},
+ right={]},
+ width=1.5em,
+ stopper=,
+ itemalign=flushright,
+ inbetween={\blank[small]}]
+
+%D Instead of color, we use weighted gray scales:
+\setupcolors
+ [conversion=always]
+
+%D English it is.
+\mainlanguage
+ [en]
+
+%D We define some logical skips
+
+\defineblank [tugbefore] [big]
+\defineblank [tuginbetween][big]
+\defineblank [tugafter] [tugbefore]
+
+%D Some real macros: <<<
+
+\def\StartAbstract
+ {\dostartbuffer[abstract][StartAbstract][StopAbstract]}
+
+\startsetups tugboat:abstract:setup
+
+ \setuptolerance
+ [horizontal, tolerant]
+
+ \setupnarrower
+ [before={\blank[.5\baselineskip]},
+% after={\blank[10pt plus4pt minus4pt]},
+ after={\blank[10pt]},
+ middle=4.875pc]
+
+\stopsetups
+
+%D Headers and footers are different for normal issues
+%D and proceedings.
+
+\startsetups tugboat:banner:text:article
+
+ {\sl TUGboat},\space
+ Volume \getvariable{tugboat}{volume}\space
+ (\getvariable{tugboat}{year}),\space
+ No.\space\getvariable{tugboat}{number}
+
+\stopsetups
+
+\def\postissno{Proceedings of the \tubyear\ Annual Meeting}
+
+\startsetups tugboat:banner:text:proceedings
+
+ \setups{tugboat:banner:text:article}
+ \thinspace---\thinspace
+ \postissno
+
+\stopsetups
+
+\startsetups tugboat:banner:setup:article
+
+ \setupheadertexts
+ [\setups{tugboat:banner:text:article}]
+ [\pagenumber]
+
+% no footer in regular articles
+% \setupfootertexts
+% [][\getvariable{tugboat}{author}]
+% [\getvariable{tugboat}{title}][]
+
+\stopsetups
+
+\startsetups tugboat:banner:setup:proceedings
+
+ \setupheadertexts
+ [][\getvariable{tugboat}{title}]
+ [\getvariable{tugboat}{author}][]
+
+ \setupfootertexts
+ [\setups{tugboat:banner:text:proceedings}]
+ [\pagenumber]
+
+\stopsetups
+
+%D article is default so,
+
+\setups{tugboat:banner:setup:article}
+
+%D It all starts here:
+
+\def\StartArticle{\setups{tugboat:\getvariable{tugboat}{type}:start}}
+\def\StopArticle {\setups{tugboat:article:stop}}
+
+\startsetups tugboat:grid:setup:settings:yes
+
+ \setupblank
+ [line]
+
+ \defineblank [tugbefore] [halfline]
+ \defineblank [tuginbetween] [halfline]
+
+\stopsetups
+
+\startsetups tugboat:grid:setup:no
+
+% \setupblank
+% [halfline]
+
+% \defineblank [medium] [halfline]
+% \defineblank [tugbefore] [halfline]
+% \defineblank [tuginbetween] [halfline]
+
+\stopsetups
+
+\startsetups tugboat:introduction:article
+
+% \blank[halfline]
+
+ \start
+ \def\\{\unskip\space\&\space\ignorespaces}
+ \hbox{\indent\getvariable{tugboat}{author}}
+ \par
+ \stop
+
+
+\stopsetups
+
+\startsetups tugboat:introduction:proceedings
+
+ \blank[20pt]
+
+ \start
+ \switchtobodyfont[12pt]
+ \def\\{\unskip\space\&\space\ignorespaces}
+ \getvariable{tugboat}{author}
+ \par
+ \stop
+
+ \start
+ \switchtobodyfont[9pt]
+ \def\\{\unskip,\space\ignorespaces}
+ \getvariable{tugboat}{address}
+ \par
+ {\tt\getvariable{tugboat}{email}}
+ \par
+ \stop
+
+
+\stopsetups
+
+\startsetups tugboat:article:start
+
+ \starttext
+
+ \setups{tugboat:columns:\getvariable{tugboat}{columns}}
+ \setups{tugboat:banner:setup:\getvariable{tugboat}{type}}
+
+ \doif{\getvariable{tugboat}{columns}}{yes}{\startcolumns}
+
+
+ % AM: Why set these again?
+ % \setupheadertexts
+ % [\setups{tugboat:banner:text:article}]
+ % [pagenumber]
+
+ % \setuppagenumber
+ % [number=\getvariable{tugboat}{page}]
+ \setcounter[userpage][\getvariable{tugboat}{page}]
+
+ % \setuplayout
+ % [grid=\getvariable{tugboat}{grid}]
+
+ % % instead of \startmode [*grid] ... \stopmode
+ % % instead of \startnotmode[*grid] ... \stopnotmode
+
+ \setups{tugboat:grid:setup:\getvariable{tugboat}{grid}}
+
+ \snaptogrid \vbox \bgroup
+
+ \forgetall
+\hrule height .6pt
+\blank[halfline]
+ \start
+ \let\\=\par
+ {\bf\getvariable{tugboat}{title}}
+ \par
+ \blank[halfline]
+ \hskip20pt\getvariable{tugboat}{author}
+ \stop
+
+% \setups{tugboat:introduction:\getvariable{tugboat}{type}}
+
+ \blank[line]
+
+ \doiftext{\getbuffer[abstract]}
+ {\let\\=\endgraf
+ \setups{tugboat:abstract:setup}
+ \subject{Abstract}
+ \getbuffer[abstract]}
+ \egroup
+\stopsetups
+
+\startsetups tugboat:proceedings:start
+
+ \starttext
+
+ \setups{tugboat:columns:\getvariable{tugboat}{columns}}
+ \setups{tugboat:banner:setup:\getvariable{tugboat}{type}}
+
+ \setupheader
+ [state=empty]
+
+ \setuppagenumber
+ [number=\getvariable{tugboat}{page}]
+
+ \setuplayout
+ [grid=\getvariable{tugboat}{grid}]
+
+ % instead of \startmode [*grid] ... \stopmode
+ % instead of \startnotmode[*grid] ... \stopnotmode
+ \doifmodeelse{*grid}{\setups{tugboat:grid:setup:yes}}{\setups{tugboat:grid:setup:no}}
+% \setups{tugboat:grid:setup:\systemmodevalue{grid}{yes}{no}}
+
+ \snaptogrid \vbox \bgroup
+
+ \forgetall
+
+ \start
+ \switchtobodyfont[14.4pt]
+ \let\\=\par
+ \getvariable{tugboat}{title}
+ \par
+ \stop
+
+ \setups{tugboat:introduction:\getvariable{tugboat}{type}}
+
+ \blank[9pt]% plus3pt minus3pt]
+
+ \let\\=\par
+ \setups{tugboat:abstract:setup}
+ \midaligned{\bf Abstract}
+
+ \startnarrower[middle]
+ \getbuffer[abstract]
+ \stopnarrower
+
+ % \blank[10pt plus4pt minus4pt]
+
+ \egroup
+
+ \doif{\getvariable{tugboat}{columns}}{yes}{\startcolumns}
+
+\stopsetups
+
+\def\signaturewidth{13pc}
+
+\definefontsynonym[LMSY][lmsy10]
+\def\mydiamond{\getglyph{LMSY}{\char5}}
+
+\startsetups tugboat:affiliation:article
+
+ \blank[line]
+
+ \snaptogrid \vbox \bgroup
+
+ \forgetall
+
+ \leftskip=\textwidth \advance\leftskip by -\signaturewidth
+
+ \let\\=\par
+ \leavevmode\llap{\mydiamond\enspace}\getvariable{tugboat}{author}
+ \par
+ \getvariable{tugboat}{address}
+ \par
+ {\tt\getvariable{tugboat}{email}}
+
+ \egroup
+
+\stopsetups
+
+\startsetups tugboat:affiliation:proceedings
+
+ % nothing fancy at the end
+
+\stopsetups
+
+\startsetups tugboat:article:stop
+
+ \setups{tugboat:affiliation:\getvariable{tugboat}{type}}
+
+ \doif{\getvariable{tugboat}{columns}}{yes}{\stopcolumns}
+
+ \page
+
+ \stoptext
+
+\stopsetups
+
+%D Normal word spacing, please.
+
+\setuptolerance
+ [strict]
+
+%D One can use the following setups (in the article) to
+%D collect settings specific to normal and/or multi
+%D column typesetting.
+
+\startsetups tugboat:columns:yes
+
+\stopsetups
+
+\startsetups tugboat:columns:no
+
+\stopsetups
+
+% >>> Logos, abbreviations: TODO: Clean up <<<
+\font\mflogo = logo10
+\def\MF{{\mflogo META\-FONT}}
+
+\def\ALEPH{Aleph}
+\def\API{\acro{API}}
+\def\CCODE{C}
+\def\CD{\acro{CD}}
+\def\CMYK{\acro{CMYK}}
+\def\CONTEXT{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt}
+\def\CPU{\acro{CPU}}
+\def\DVI{\acro{DVI}}
+\def\DVIPDFMX{dvipdfmx}
+\def\DVIPS{dvips}
+\def\ETEX{$\varepsilon$-\kern-.125em\TeX}
+\def\FTP{\acro{FTP}}
+\def\HTTP{\acro{HTTP}}
+\def\IO{\acro{I/O}}
+\def\ISO{\acro{ISO}}
+\def\KPSEWHICH{kpsewhich}
+\def\KPSE{\acro{KPSE}}
+\newcount\TestCount
+\newbox\TestBox
+\def\La{\TestCount=\the\fam \leavevmode L%
+ \setbox\TestBox=\hbox{$\fam\TestCount\scriptstyle A$}%
+ \kern-.5\wd\TestBox\raise.42ex\box\TestBox}
+\def\LATEX{\La\kern-.15em\TeX}
+\def\LATEXE{\LaTeX{}\kern.05em2$_{\textstyle\varepsilon}$}
+\def\LINUX{Linux}
+\def\LPEG{Lpeg}
+\def\LUAJIT{Lua\acro{JIT}}
+\def\LUATEX{Lua\-\TeX}
+\def\LUATOOLS{lua\-tools}
+\def\LUA{Lua}
+\def\MATHML{Math\acro{ML}}
+\def\METAFUN{Metafun}
+\def\METAPOST{MetaPost}
+\def\METATEX{Meta\TeX{}}
+\def\MKII{Mk\acro{II}}
+\def\MKIV{Mk\acro{IV}}
+\def\MPLIB{\acro{MP}lib}
+\def\MPTOPDF{mp\-to\-pdf}
+\def\MSWINDOWS{Windows}
+\def\MTXTOOLS{mtx\-tools}
+\def\NFSS{\acro{NFSS}}
+\def\OPENMATH{Open\-Math}
+\def\OPENTYPE{Open\-Type}
+\def\PASCAL{Pascal}
+\def\PDFTEX{pdf\/\-\TeX}
+\def\PDF{\acro{PDF}}
+\def\POSIX{\acro{POSIX}}
+\def\PRAGMA{Pragma \acro{ADE}}
+\def\POSTSCRIPT{Post\-Script}
+\def\RGB{\acro{RGB}}
+\def\RUBY{Ruby}
+\def\SCITE{Sci\acro{TE}}
+\def\TDS{\acro{TDS}}
+\def\TEXBOOK{{\sl The \TeX book}}
+\def\TEXEXEC{\TeX exec}
+\def\TEX{\TeX}
+\def\TFM{\acro{TFM}}
+\def\TRUETYPE{True\-Type}
+\def\TYPEONE{Type~1}
+\def\UTF{\acro{UTF}}
+\def\WEBC{Web2C}
+\def\XETEX{X\lower.5ex\hbox{\kern-.15em\mirror{E}}\kern-.1667em\TeX}
+\def\XML{\acro{XML}}
+\def\XPATH{\acro{XP}ath}
+\def\XSLT{\acro{XSLT}}
+\def\XSLTPROC{\acro{XSLTPROC}}
+\def\ZIP{zip}
+
+\def\Dash{\unskip\thinspace---\thinspace\ignorespaces}
+\def\slash{/\penalty0 \hskip0pt \relax}
+
+\definefont[AcroFont][Serif sa .91]
+\def\acro#1{{\AcroFont #1}}
+
+\lefthyphenmin=2 \righthyphenmin=3 % disallow x- or -xx breaks
+
+\hyphenation{Post-Script data-base data-bases}
+
+% hack to read tugboat.dates settings.
+\def\vol#1, #2.{\def\tubvol{#1}\def\tubnum{#2}}
+\def\issyear#1.{\def\tubyear{#1}}
+\newcount\issueseqno
+
+% >>>
+%D Good bye. <<<
+
+\doifnotmode{demo}{\endinput}
+
+\showgrid
+
+\starttext
+
+\StartArticle
+
+\StartAbstract
+ \input bryson
+\StopAbstract
+
+\dorecurse{30}{\input ward \endgraf} \page
+
+\startitemize
+\item \input ward
+\item \input ward
+\stopitemize
+
+\StopArticle
+
+\setvariables[tugboat][columns=yes]
+
+\StartArticle
+
+\StartAbstract
+ \input bryson
+\StopAbstract
+
+\dorecurse{30}{\input ward \endgraf} \page
+
+\StopArticle
+
+\stoptext
+
+% >>>
+
+% vim: foldmethod=marker foldmarker=<<<,>>>
diff --git a/tex/context/modules/mkiv/s-youless.mkiv b/tex/context/modules/mkiv/s-youless.mkiv
index e15973b9c..d8b6e2ff6 100644
--- a/tex/context/modules/mkiv/s-youless.mkiv
+++ b/tex/context/modules/mkiv/s-youless.mkiv
@@ -23,125 +23,165 @@
% in cronjob on one of the servers:
%
-% mtxrun --script youless --collect --host=192.168.2.50 --watt youless-watt.lua
-% mtxrun --script youless --collect --host=192.168.2.50 --kwk youless-kwh.lua
+% mtxrun --script youless --collect --host=192.168.2.50 --nobackup --electricity youless-electricity.lua
\startluacode
require("util-you")
- moduledata.youless = { }
+ local round = math.round
- function moduledata.youless.kwh(specification)
- -- todo
- end
+ moduledata.youless = { }
- function moduledata.youless.watt(specification)
+ local function process(specification)
- local year = tonumber(specification.year) or os.today().year
- local data = table.load(specification.filename or "youless-watt.lua")
+ local data, message = utilities.youless.analyze(specification.filename or "youless-electricity.lua")
- if not data or data.variant ~= "watt" then
- context("invalid variant")
+ if not data then
+ context(message)
return
end
- utilities.youless.analyze(data)
-
- -- for the moment no specific font scaling
-
- local years = data.years
-
- if not years then
- context("no years")
- return
+ local year = tonumber(specification.year) or os.today().year
+ local years = data.years
+ local variant = data.variant
+ local unit = specification.unit
+ local maxunit = specification.maxunit
+
+ local max = specification[maxunit]
+
+ if not max then
+ if unit == "watt" then
+ max = 10000
+ elseif unit == "liters" then
+ max = 1000
+ else
+ max = 5000 -- can't happen
+ end
end
- for y=year,year do
-
- local year = years[y]
- local scale = 20
- local mark = 3
- local maxwatt = specification.maxwatt or year.maxwatt
-
- for m=1,12 do
- local month = year.months[m]
- if month then
- context.startMPpage { offset = "10pt" }
- context("linecap := butt; pickup pencircle scaled .5")
+ local max = max
+ local delta = round(max/10)
+ local scale = round(delta/20)
+ local mark = 3
- for i=0,(math.div(maxwatt,1000)+1)*1000,100 do
- context("draw (%s,%s) -- (%s,%s) withcolor .6white ;",0,i/scale,31 * 24,i/scale)
- end
+ for y=year,year do
+ local year = years[y]
+ if year then
+ local grand = 0
+ for m=1,12 do
+ local month = year.months[m]
+ if month then
+ context.startMPpage { offset = "10pt" }
+ context("linecap := butt; pickup pencircle scaled .5")
+
+ for i=0,(math.div(max,delta)+1)*delta,delta/10 do
+ context("draw (%s,%s) -- (%s,%s) withcolor .6white ;",0,i/scale,31 * 24,i/scale)
+ end
- context("draw (0,%s) -- (31 * 24,%s) dashed dashpattern(on 6 off 6) withcolor darkgreen withpen pencircle scaled 1 ;",year.watt /scale,year.watt /scale)
- context("draw (0,%s) -- (31 * 24,%s) dashed dashpattern(off 6 on 6) withcolor darkred withpen pencircle scaled 1 ;",month.watt/scale,month.watt/scale)
-
- local days = month.days
- if days then
- local nd = os.nofdays(y,m)
- for d=1,nd do
- local day = days[d]
- local xoffset = (d-1) * 24
- local wd = os.weekday(d,m,y)
- local weekend = wd == 1 or wd == 7
- if not weekend then
- -- okay
- elseif mark == 1 then
- context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -17.5,xoffset, -32.5)
- context("draw (%s,%s) -- (%s,%s) ; ",xoffset+24,-17.5,xoffset+24,-32.5)
- elseif mark == 2 then
- context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -17.5,xoffset+24,-17.5)
- context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -32.5,xoffset+24,-32.5)
- elseif mark == 3 then
- context("draw unitsquare xysized (%s,%s) shifted (%s,%s) ; ",24,15,xoffset,-32.5)
- end
- context([[draw textext("%s") shifted (%s,%s) ; ]],d,xoffset + 12,-25)
- if day then
- for h=0,23 do
- local hours = day.hours
- if hours then
- local hour = hours[h]
- if hour then
- local dx = xoffset + h
- local dy = hour.watt/scale
- local dm = hour.maxwatt/scale
- context("draw (%s,%s) -- (%s,%s) withcolor %s ; ",dx, 0,dx,dy,weekend and "darkmagenta" or "darkblue")
- context("draw (%s,%s) -- (%s,%s) withcolor %s ; ",dx,dy,dx,dm,"darkgray")
+ context("draw (0,%s) -- (31 * 24,%s) dashed dashpattern(on 6 off 6) withcolor darkgreen withpen pencircle scaled 1 ;",year [unit]/scale,year [unit]/scale)
+ context("draw (0,%s) -- (31 * 24,%s) dashed dashpattern(off 6 on 6) withcolor darkred withpen pencircle scaled 1 ;",month[unit]/scale,month[unit]/scale)
+
+ local days = month.days
+ local total = 0
+ if days then
+ local nd = os.nofdays(y,m)
+ for d=1,nd do
+ local day = days[d]
+ local xoffset = (d-1) * 24
+ local wd = os.weekday(d,m,y)
+ local weekend = wd == 1 or wd == 7
+ if not weekend then
+ -- okay
+ elseif mark == 1 then
+ context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -17.5,xoffset, -32.5)
+ context("draw (%s,%s) -- (%s,%s) ; ",xoffset+24,-17.5,xoffset+24,-32.5)
+ elseif mark == 2 then
+ context("draw (%s,%s) -- (%s,%s) ;",xoffset, -17.5,xoffset+24,-17.5)
+ context("draw (%s,%s) -- (%s,%s) ;",xoffset, -32.5,xoffset+24,-32.5)
+ elseif mark == 3 then
+ context("draw unitsquare xysized (%s,%s) shifted (%s,%s) ;",24,15,xoffset,-32.5)
+ end
+ context([[draw textext("\strut%s") shifted (%s,%s) ;]],d,xoffset + 12,-25)
+ if day then
+ for h=0,23 do
+ local hours = day.hours
+ if hours then
+ local hour = hours[h]
+ if hour then
+ local dx = xoffset + h
+ local dy = hour[unit]/scale
+ local dm = hour[maxunit]/scale
+ context("draw (%s,%s) -- (%s,%s) withcolor %s ;",dx, 0,dx,dy,weekend and "darkmagenta" or "darkblue")
+ context("draw (%s,%s) -- (%s,%s) withcolor %s ;",dx,dy,dx,dm,"darkgray")
+ end
end
end
+ local use = day.total
+ if use then
+ context([[draw textext("\strut\small\small\small%0.1f") shifted (%s,%s) ;]],use/1000,xoffset + 12,-7.5)
+ total = total + use
+ end
end
end
+ for d=0,30 do
+ local xoffset = d * 24
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset+ 0,0,xoffset+ 0,-10)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset+ 6,0,xoffset+ 6,-2.5)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset+12,0,xoffset+12,-5)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset+18,0,xoffset+18,-2.5)
+ end
+ local xoffset = 31 * 24
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset,0,xoffset,-10)
end
- for d=0,30 do
- local xoffset = d * 24
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+ 0,0,xoffset+ 0,-10)
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+ 6,0,xoffset+ 6,-2.5)
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+12,0,xoffset+12,-5)
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+18,0,xoffset+18,-2.5)
- end
- local xoffset = 31 * 24
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset,0,xoffset,-10)
- end
- local max = (math.div(maxwatt,1000)+1)
+ grand = grand + total
- for i=0,max*1000,1000 do
- context([[draw textext.lft("%s") shifted (%s,%s) ; ]],i,-10,i/scale)
- context("draw (%s,%s) -- (%s,%s) withcolor .2white ;",0,i/scale,31 * 24,i/scale)
- end
+ local max = (math.div(max,delta))
+
+ for i=0,max*delta,delta do
+ if i > 0 then
+ context([[draw textext.lft("\hbox to 3.5em{\hss\strut%r}") shifted (%s,%s) ; ]],i,-10,i/scale)
+ end
+ context("draw (%s,%s) -- (%s,%s) withcolor .2white ;",0,i/scale,31 * 24,i/scale)
+ end
- context([[draw textext("\strut\month{%s}\enspace%s") shifted (%s,%s) ; ]],m, y, 31 * 24 / 2, -50)
- context([[draw textext.lft("watt") shifted (%s,%s) ; ]],-10,-25)
+ context([[draw textext ("\strut\Word{%s}\enspace\emdash\enspace\month{%s}\enspace%s") shifted (%s,%s) ; ]],variant, m, y, 31 * 24 / 2, -50)
+ context([[draw textext.lft("\hbox to 3.5em{\hss\strut%s}") shifted (%s,%s) ; ]],unit,-10,-25)
+ context([[draw textext.lft("\hbox to 3.5em{\hss\strut\small\small\small%0.1f %s}") shifted (%s,%s) ;]],total/1000,unit == "watt" and "kWh" or [[m\high{3}]],-10, -7.5)
+ context([[draw textext.lft("\hbox to 3.5em{\hss\strut\small\small\small\Sigma\nbsp%0.1f %s}") shifted (%s,%s) ;]],grand/1000,unit == "watt" and "kWh" or [[m\high{3}]],-10,-50.0)
- context.stopMPpage()
- else
- -- maybe placeholder
+ context.stopMPpage()
+ else
+ -- maybe placeholder
+ end
end
end
-
end
+ end
+
+ function moduledata.youless.kwh(specification)
+ -- todo
+ end
+
+ function moduledata.youless.electricity(specification)
+ specification.unit = "watt"
+ specification.maxunit = "maxwatt"
+ process(specification)
+ end
+
+ moduledata.youless.watt = moduledata.youless.electricity
+
+ function moduledata.youless.gas(specification)
+ specification.unit = "liters"
+ specification.maxunit = "maxliters"
+ process(specification)
+ end
+ function moduledata.youless.pulse(specification)
+ specification.unit = "watt"
+ specification.maxunit = "maxwatt"
+ process(specification)
end
\stopluacode
@@ -160,11 +200,11 @@
\startluacode
- -- os.execute([[mtxrun --script youless --collect --watt "c:/data/system/youless/data/youless-watt.lua"]])
- -- os.execute([[mtxrun --script youless --collect --watt --nobackup "c:/data/system/youless/data/youless-watt.lua"]])
- -- moduledata.youless.watt { year = 2013, filename = "c:/data/system/youless/data/youless-watt.lua" }
+ -- os.execute([[mtxrun --script youless --collect --electricity "c:/data/system/youless/data/youless-electricity.lua"]])
+ -- os.execute([[mtxrun --script youless --collect --electricity --nobackup "c:/data/system/youless/data/youless-electricity.lua"]])
+ -- moduledata.youless.electricity { year = 2017, filename = "c:/data/system/youless/data/youless-electricity.lua" }
- moduledata.youless.watt { year = 2013, filename = "youless-watt.lua" }
+ moduledata.youless.electricity { year = 2017, filename = "youless-electricity.lua" }
\stopluacode
diff --git a/tex/context/modules/mkiv/x-asciimath.lua b/tex/context/modules/mkiv/x-asciimath.lua
index 677d3519b..7785d5587 100644
--- a/tex/context/modules/mkiv/x-asciimath.lua
+++ b/tex/context/modules/mkiv/x-asciimath.lua
@@ -35,7 +35,7 @@ if not characters then
require("char-ent")
end
-local type, rawget = type, rawget
+local rawget, next, type = rawget, next, type
local concat, insert, remove = table.concat, table.insert, table.remove
local rep, gmatch, gsub, find = string.rep, string.gmatch, string.gsub, string.find
local utfchar, utfbyte = utf.char, utf.byte
@@ -103,14 +103,18 @@ local reserved = {
["max"] = { false, "\\max" },
["ln"] = { false, "\\ln" },
- ["atan"] = { false, "\\atan" }, -- extra
- ["acos"] = { false, "\\acos" }, -- extra
- ["asin"] = { false, "\\asin" }, -- extra
+ -- ["atan"] = { false, "\\atan" }, -- extra
+ -- ["acos"] = { false, "\\acos" }, -- extra
+ -- ["asin"] = { false, "\\asin" }, -- extra
["arctan"] = { false, "\\arctan" }, -- extra
["arccos"] = { false, "\\arccos" }, -- extra
["arcsin"] = { false, "\\arcsin" }, -- extra
+ ["arctanh"] = { false, "\\arctanh" }, -- extra
+ ["arccosh"] = { false, "\\arccosh" }, -- extra
+ ["arcsinh"] = { false, "\\arcsinh" }, -- extra
+
["and"] = { false, "\\text{and}" },
["or"] = { false, "\\text{or}" },
["if"] = { false, "\\text{if}" },
@@ -121,8 +125,9 @@ local reserved = {
["frac"] = { false, "\\frac", "binary" },
["stackrel"] = { false, "\\asciimathstackrel", "binary" },
["hat"] = { false, "\\widehat", "unary" },
- ["bar"] = { false, "\\overbar", "unary" },
- ["overbar"] = { false, "\\overbar", "unary" },
+ ["bar"] = { false, "\\overline", "unary" },
+ ["overbar"] = { false, "\\overline", "unary" },
+ ["overline"] = { false, "\\overline", "unary" },
["underline"] = { false, "\\underline", "unary" },
["ul"] = { false, "\\underline", "unary" },
["vec"] = { false, "\\overrightarrow", "unary" },
@@ -797,14 +802,18 @@ local isstupid = {
["\\max"] = true,
["\\ln"] = true,
- ["\\atan"] = true,
- ["\\acos"] = true,
- ["\\asin"] = true,
- true,
+ -- ["\\atan"] = true,
+ -- ["\\acos"] = true,
+ -- ["\\asin"] = true,
+
["\\arctan"] = true,
["\\arccos"] = true,
["\\arcsin"] = true,
+ ["\\arctanh"] = true,
+ ["\\arccosh"] = true,
+ ["\\arcsinh"] = true,
+
["f"] = true,
["g"] = true,
}
@@ -834,7 +843,8 @@ local issimplified = {
--
--- special mess
+-- special mess (we have a generic one now but for the moment keep this)
+-- special mess (we have a generic one now but for the moment keep this)
local d_one = R("09")
local d_two = d_one * d_one
@@ -894,6 +904,8 @@ local symbolmethod = nil
local digitseparator = utfchar(0x2008)
local digitsymbol = "."
+local v_yes_digits = interfaces and interfaces.variables.yes or true
+
function asciimath.setup(settings)
splitmethod = splitmethods[tonumber(settings.splitmethod) or 0]
if splitmethod then
@@ -902,7 +914,8 @@ function asciimath.setup(settings)
digitsymbol = "."
end
local separator = settings.separator
- if separator == true or not interfaces or interfaces.variables.yes then
+ -- if separator == true or not interfaces or interfaces.variables.yes then
+ if separator == true or separator == nil or separator == v_yes_digits then
digitseparator = utfchar(0x2008)
elseif type(separator) == "string" and separator ~= "" then
digitseparator = separator
@@ -1277,7 +1290,8 @@ local function collapse_bars(t)
-- problem: we can have a proper nesting
local d = false
for i=1,m do
- if find(t[i],"\\left") then
+ local ti = t[i]
+ if type(ti) == "string" and find(ti,"\\left",1,true) then
d = true
break
end
@@ -1791,6 +1805,14 @@ local p = (
+ p_utf_base
)^0
+-- faster:
+--
+-- local p = (
+-- (S("{[(") + P("\\left" )) * Cc(function() n = n + 1 end)
+-- + (S("}])") + P("\\right")) * Cc(function() n = n - 1 end)
+-- + p_utf_base
+-- )^0
+
local function invalidtex(str)
n = 0
lpegmatch(p,str)
@@ -1933,7 +1955,7 @@ local uncrapped = {
}
local function convert(str,nowrap)
- if #str > 0 then
+ if str ~= "" then
local unicoded = lpegmatch(u_parser,str) or str
if lpegmatch(p_onechar,unicoded) then
ctx_mathematics(uncrapped[unicoded] or unicoded)
diff --git a/tex/context/modules/mkiv/x-asciimath.mkiv b/tex/context/modules/mkiv/x-asciimath.mkiv
index 5c96d4f8a..1b0567dbd 100644
--- a/tex/context/modules/mkiv/x-asciimath.mkiv
+++ b/tex/context/modules/mkiv/x-asciimath.mkiv
@@ -165,6 +165,7 @@
\appendtoks
\enableautofences
+ \enableautofencemode
\to \everyasciimath
\unexpanded\def\asciimath
diff --git a/tex/context/modules/mkiv/x-calcmath.lua b/tex/context/modules/mkiv/x-calcmath.lua
index c96d8d0ac..41a43cacd 100644
--- a/tex/context/modules/mkiv/x-calcmath.lua
+++ b/tex/context/modules/mkiv/x-calcmath.lua
@@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['x-calcmath'] = {
-- this really needs to be redone
+local next, type = next, type
local format, lower, upper, gsub, sub = string.format, string.lower, string.upper, string.gsub, string.sub
local concat = table.concat
local lpegmatch = lpeg.match
diff --git a/tex/context/modules/mkiv/x-cals.lua b/tex/context/modules/mkiv/x-cals.lua
index 3af6106d8..9d54733b8 100644
--- a/tex/context/modules/mkiv/x-cals.lua
+++ b/tex/context/modules/mkiv/x-cals.lua
@@ -6,9 +6,9 @@ if not modules then modules = { } end modules ['x-cals'] = {
license = "see context related readme files"
}
-local next = next
+local next, type = next, type
local format, lower = string.format, string.lower
-local xmlsprint, xmlcprint, xmlcollected, xmlelements = xml.sprint, xml.cprint, xml.collected, xml.elements
+local xmlcprint, xmlcollected, xmlelements = xml.cprint, xml.collected, xml.elements
local n_todimen, s_todimen = number.todimen, string.todimen
-- there is room for speedups as well as cleanup (using context functions)
diff --git a/tex/context/modules/mkiv/x-ct.lua b/tex/context/modules/mkiv/x-ct.lua
index 9c647e8e7..d9d474825 100644
--- a/tex/context/modules/mkiv/x-ct.lua
+++ b/tex/context/modules/mkiv/x-ct.lua
@@ -37,7 +37,7 @@ local function roottemplate(root)
if template then
return template
else
- if not find(rt,"|") then
+ if not find(rt,"|",1,true) then
rt = gsub(rt,",","|")
end
if not find(rt,"^|") then rt = "|" .. rt end
diff --git a/tex/context/modules/mkiv/x-html.mkiv b/tex/context/modules/mkiv/x-html.mkiv
index 723872dfd..9fdbe38fd 100644
--- a/tex/context/modules/mkiv/x-html.mkiv
+++ b/tex/context/modules/mkiv/x-html.mkiv
@@ -148,7 +148,7 @@
%
% we can also use \xmlmap for border etc
-% \registerctxluafile{lxml-css}{1.001}
+% \registerctxluafile{lxml-css}{}
\starttexdefinition cssgetsinglepadding #1
\ctxlua {
diff --git a/tex/context/modules/mkiv/x-ldx.lua b/tex/context/modules/mkiv/x-ldx.lua
index e88c4c797..775c9a16d 100644
--- a/tex/context/modules/mkiv/x-ldx.lua
+++ b/tex/context/modules/mkiv/x-ldx.lua
@@ -80,7 +80,7 @@ function ldx.load(filename)
end
local str = sub(data, i, #data)
str = gsub(str, "^%s*(.-)%s*$", "%1")
- if #str > 0 then
+ if str ~= "" then
t[#t+1] = { code = str }
end
return t
diff --git a/tex/context/modules/mkiv/x-lmx-demo.mkiv b/tex/context/modules/mkiv/x-lmx-demo.mkiv
new file mode 100644
index 000000000..619af97e0
--- /dev/null
+++ b/tex/context/modules/mkiv/x-lmx-demo.mkiv
@@ -0,0 +1,143 @@
+% last page less markup
+
+\usemodule
+ [article]
+
+\setupbottomtexts
+ [\directsetup{document:comment}]
+
+\setuplayout
+ [bottom=1cm]
+
+\setupbottom
+ [style=\small\tt]
+
+\usemodule
+ [lmx-html]
+
+% \startxmlsetups exa:variables
+%
+% \xmlfilter{#1}{/exa:variable/command(exa:variable)}
+%
+% % todo: fontkerns
+%
+% \xmldoif {#1} {/exa:variable[@name='bodyfont']} {
+% \setupbodyfont
+% [\xmltext{#1}{/exa:variable[@name='bodyfont']}]
+% }
+% \xmldoif {#1} {/exa:variable[@name='cutmarks' and text()='yes']} {
+% \setuppapersize
+% [A4]
+% [oversized]
+% \setuplayout
+% [marking=on,
+% location=middle]
+% }
+% \xmldoif {#1} {/exa:variable[@name='spelling' and text()='yes']} {
+% % \loadspellchecklist[en][spell-en.txt]
+% % \setupspellchecking[state=start,method=1]
+% }
+% \xmldoif {#1} {/exa:variable[@name='frame' and text()='yes']} {
+% \showframe
+% }
+% \xmldoif {#1} {/exa:variable[@name='markup' and text()='yes']} {
+% \showmakeup
+% }
+% \xmldoif {#1} {/exa:variable[@name='request' and text()='yes']} {
+% \enablemode[showrequest]
+% }
+%
+% \stopxmlsetups
+
+\startxmlsetups exa:variable:cutmarks
+ \xmldoif {#1} {.[text() = 'yes']} {
+ \setuppapersize
+ [A4]
+ [oversized]
+ \setuplayout
+ [marking=on,
+ location=middle]
+ }
+\stopxmlsetups
+
+\startxmlsetups exa:variable:bodyfont
+ \setupbodyfont
+ [\xmltext{#1}{.}]
+\stopxmlsetups
+
+\startxmlsetups exa:variable:frame
+ \xmldoif {#1} {.[text() = 'yes']} {
+ \showframe
+ }
+\stopxmlsetups
+
+\startxmlsetups exa:variable:markup
+ \xmldoif {#1} {.[text() = 'yes']} {
+ \showmakeup
+ }
+\stopxmlsetups
+
+\startxmlsetups exa:variable:request
+ \xmldoif {#1} {.[text() = 'yes']} {
+ \enablemode[showrequest]
+ }
+\stopxmlsetups
+
+\startxmlsetups exa:variable
+ \xmlsetup{#1}{exa:variable:\xmlatt{#1}{name}}
+\stopxmlsetups
+
+\startxmlsetups exa:variables
+ \xmlfilter{#1}{/exa:variable/command(exa:variable)}
+\stopxmlsetups
+
+\startsetups document:comment
+ \xmlfilter{main}{/exa:selection/exa:variables/exa:variable[@name='comment']/html()}
+\stopsetups
+
+\startxmlsetups exa:entry
+
+ \startchapter[title=\xmlatt{#1}{title}]
+ \samplefile{\xmlatt{#1}{id}}
+ \stopchapter
+
+\stopxmlsetups
+
+\startxmlsetups exa:selection
+
+ \xmlfirst{#1}{/exa:variables}
+
+ \starttitle[title={Contents}]
+ \placelist[chapter][criterium=all]
+ \stoptitle
+
+ \xmlfilter{#1}{/exa:selectors/exa:selector/exa:tree/exa:entry/exa:entry/command(exa:entry)}
+
+\stopxmlsetups
+
+\startxmlsetups xml:request
+ \xmlsetsetup {#1} {
+ exa:variables|exa:selection
+ } {exa:*}
+\stopxmlsetups
+
+\xmlregistersetup{xml:request}
+
+\starttext
+
+ \xmlprocess{main}{\inputfilename}{}
+
+ \page
+
+ \doifelsemode {showrequest} {
+
+ \usemodule[scite]
+
+ \start
+ \switchtobodyfont[small]
+ \scitefile[\inputfilename]
+ \stop
+
+ }
+
+\stoptext
diff --git a/tex/context/modules/mkiv/x-lmx-html.mkiv b/tex/context/modules/mkiv/x-lmx-html.mkiv
new file mode 100644
index 000000000..3195ef40e
--- /dev/null
+++ b/tex/context/modules/mkiv/x-lmx-html.mkiv
@@ -0,0 +1,122 @@
+%D \module
+%D [ file=x-lmx-html,
+%D version=2018.03.10,
+%D title=\CONTEXT\ Modules,
+%D subtitle=Simple LMX HTML rendering (from text fields),
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is old code that we used in several places so it qualifies as a
+%D proper module. It is means for generating simple \HTML\ from filled
+%D in forms. It's not a general purpose \HTML\ rendering.
+
+\startmodule[lmx-html]
+
+\startxmlsetups lmx:html:setup
+ \xmlsetsetup{#1}{*}{lmx:html:*}
+ \xmlflush{#1}
+\stopxmlsetups
+
+\startxmlsetups lmx:html:ul
+ \startitemize[packed]
+ \xmlflush{#1}
+ \stopitemize
+\stopxmlsetups
+
+\startxmlsetups lmx:html:ol
+ \startitemize[packed,n]
+ \xmlflush{#1}
+ \stopitemize
+\stopxmlsetups
+
+\startxmlsetups lmx:html:li
+ \startitem
+ \xmlflush{#1}
+ \stopitem
+\stopxmlsetups
+
+\startxmlsetups lmx:html:p
+ \xmlflush{#1}\par
+\stopxmlsetups
+
+\startxmlsetups lmx:html:br
+ \par
+\stopxmlsetups
+
+\startxmlsetups lmx:html:a
+ \dontleavehmode
+ \begingroup
+ \tttf
+ \xmldoifelsetext {#1} {.} {
+ \goto{\hyphenatedurl{\xmlflush{#1}}}[url(\xmlatt{#1}{href})]
+ } {
+ \goto{\hyphenatedurl{\xmlatt{#1}{href}}}[url(\xmlatt{#1}{href})]
+ }
+ \endgroup
+\stopxmlsetups
+
+\startxmlsetups lmx:html:em
+ \dontleavehmode
+ \begingroup\em\xmlflush{#1}\endgroup
+\stopxmlsetups
+
+\startxmlsetups lmx:html:b
+ \dontleavehmode
+ \begingroup\bf\xmlflush{#1}\endgroup
+\stopxmlsetups
+
+\startxmlsetups lmx:html:i
+ \dontleavehmode
+ \begingroup\it\xmlflush{#1}\endgroup
+\stopxmlsetups
+
+\startxmlsetups lmx:html:strong
+ \dontleavehmode
+ \begingroup\bf\xmlflush{#1}\endgroup
+\stopxmlsetups
+
+\startxmlsetups lmx:html:tt
+ \dontleavehmode
+ \begingroup\tt\xmlflush{#1}\endgroup
+\stopxmlsetups
+
+% \startxmlsetups lmx:html:span
+% \dontleavehmode
+% \ctxcommand{doifelse(string.find([[ \xmlatt{#1}{style} ]],"underline"))} {
+% \underbar{\xmlflush{#1}}
+% } {
+% \xmlflush{#1}
+% }
+% \stopxmlsetups
+
+\xmlmapvalue{text-decoration}{underline}{\directsetbar{underbar}}
+\xmlmapvalue{text-decoration}{overline} {\directsetbar{overbar}}
+
+\startxmlsetups lmx:html:span
+ \dontleavehmode
+ \begingroup
+ \xmlcssmappedstylevalue{#1}{text-decoration}{text-decoration}
+ \xmlflush{#1}
+ \endgroup
+\stopxmlsetups
+
+\startxmlsetups lmx:html:html
+ \xmlflush{#1}% should not be needed but we self tag .. needs checking
+\stopxmlsetups
+
+\startluacode
+ local texfinalizers = xml.finalizers.tex
+
+ function texfinalizers.html(collected,setup)
+ texfinalizers.xml(collected,"html",setup)
+ end
+\stopluacode
+
+% \xmlfilter{...}{/.../html()}
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/x-mathml.lua b/tex/context/modules/mkiv/x-mathml.lua
index 9650afab8..05feecf47 100644
--- a/tex/context/modules/mkiv/x-mathml.lua
+++ b/tex/context/modules/mkiv/x-mathml.lua
@@ -113,8 +113,8 @@ local o_replacements = { -- in main table
["$"] = "\\mmlchar{36}", -- $
["%"] = "\\mmlchar{37}",
["&"] = "\\mmlchar{38}",
- ["^"] = "\\mmlchar{94}{}", -- strange, sometimes luatex math sees the char instead of \char
- ["_"] = "\\mmlchar{95}{}", -- so we need the {}
+ ["^"] = "\\mmlchar{94}{}", -- strange, sometimes luatex math sees the char instead of \char so we
+ ["_"] = "\\mmlchar{95}{}", -- need the {} ... has to do with active mess feedback into scanner
["~"] = "\\mmlchar{126}",
[" "] = "",
["°"] = "^\\circ", -- hack
diff --git a/tex/context/modules/mkiv/x-mathml.mkiv b/tex/context/modules/mkiv/x-mathml.mkiv
index 50d31da0e..ea7f7d2e9 100644
--- a/tex/context/modules/mkiv/x-mathml.mkiv
+++ b/tex/context/modules/mkiv/x-mathml.mkiv
@@ -66,9 +66,13 @@
\xmlmapvalue {mml:math:dir} {ltr} {\setfalse\c_math_right_to_left\math_basics_synchronize_direction}
\xmlmapvalue {mml:math:dir} {rtl} {\settrue \c_math_right_to_left\math_basics_synchronize_direction}
+\edef\mmlconstantone {1}
+\edef\mmlconstantfalse{false}
+
\startxmlsetups mml:math
\begingroup
\enableautofences
+ \enableautofencemode
\xmlval {mml:math:dir} {\xmlatt{#1}{dir}} {}
\xmlval {mml:math:display} {\xmlatt{#1}{display}} {
\xmlval {mml:math:mode} {\xmlatt{#1}{mode}} {
@@ -87,6 +91,7 @@
\startxmlsetups mml:imath
\inlinemathematics {
\enableautofences
+ \enableautofencemode
%\math_fences_checked_start
%\MMLhack
\xmlflush{#1}
@@ -97,6 +102,7 @@
\startxmlsetups mml:dmath
\displaymathematics {
\enableautofences
+ \enableautofencemode
%\math_fences_checked_start
%\MMLhack
\xmlflush{#1}
@@ -107,8 +113,9 @@
%D First we define some general formula elements.
\startxmlsetups mml:formula
- \edef\mmlformulalabel {\xmlatt{#1}{label}\xmlatt{#1}{id}}
- \edef\mmlformulasublabel{\xmlatt{#1}{sublabel}\xmlatt{#1}{id}}
+ \edef\mmlformulaid {\xmlatt{#1}{id}}
+ \edef\mmlformulalabel {\xmlatt{#1}{label}\mmlformulaid}
+ \edef\mmlformulasublabel{\xmlatt{#1}{sublabel}\mmlformulaid}
\doifsomething\mmlformulalabel{\placeformula[\mmlformulalabel]{\mmlformulasublabel}}
\startformula
%\MMLhack
@@ -1934,12 +1941,28 @@
% spacing between - and 2 is taken care of by tex itself
\startxmlsetups mml:mo
- \doif {\xmlatt{#1}{maxsize}} {1} {\settrue\mmlignoredelimiter}
- \doif {\xmlatt{#1}{stretchy}} {false} {\settrue\mmlignoredelimiter}
+ \edef\mmlattvalue{\xmlatt{#1}{maxsize}}
+ \ifx\mmlattvalue\mmlconstantone
+ \settrue\mmlignoredelimiter
+ \else
+ \edef\mmlattvalue{\xmlatt{#1}{stretchy}}
+ \ifx\mmlattvalue\mmlconstantfalse
+ \settrue\mmlignoredelimiter
+ \fi
+ \fi
+ \edef\mmlattvalue{\xmlatt{#1}{lspace}}
+ \ifx\mmlattvalue\empty\else
+ \hskip\mmlattvalue\relax % todo: check for dimension
+ \fi
\ctxmodulemathml{mo("#1")}
+ \edef\mmlattvalue{\xmlatt{#1}{rspace}}
+ \ifx\mmlattvalue\empty\else
+ \hskip\mmlattvalue\relax % todo: check for dimension
+ \fi
\setfalse\mmlignoredelimiter
\stopxmlsetups
+
% \startxmlsetups mml:mfenced % {} around separator is needed for spacing
% \def\MMLleft {\left }% weird
% \def\MMLright {\right}
@@ -2030,7 +2053,8 @@
\vcenter {
\framed
[frame=off,strut=no,background={\mmlmenclosenotation}] % offset is kind of undefined
- {\startimath
+ {
+ \startpickupmath
\expanded{\doifelseinset {mml:enclose:longdiv} {\mmlmenclosenotation}} {
\overline{\left)\strut\xmlflush{#1}\right.}
} {
@@ -2048,7 +2072,8 @@
}
}
}
- \stopimath}
+ \stoppickupmath
+ }
}
}
}
diff --git a/tex/context/modules/mkiv/x-setups-basics.mkiv b/tex/context/modules/mkiv/x-setups-basics.mkiv
index 1c0eb8346..be96466b8 100644
--- a/tex/context/modules/mkiv/x-setups-basics.mkiv
+++ b/tex/context/modules/mkiv/x-setups-basics.mkiv
@@ -15,6 +15,14 @@
%D We can make this module a bit cleaner using more recent features or we go \LUA\
%D completely but as this style evolved over 15 years it's a waste of time.
%D
+%D
+%D Thanks to Wolfgang these descriptions have become quite complete! In the process
+%D of covering more commands and expecially different instances of the same command,
+%D either or not generated, the supporting macros became more complex. I must admit
+%D that it's not the nicest code base and whenever I have to add or patch something
+%D I have to suppress the urge to rewrite this file. It needs watching a few
+%D energetic videos (for instance with Simon Phillips drumming) to get going.
+%D
%D As we also have a help server we can make a common framework for this \unknown\
%D but even then, this file is also a test for the the \XML\ processor.
%D
@@ -25,7 +33,36 @@
%D Currently we load the \XML\ file and when not in the english interface we just
%D remap the relevant words to their translation.
-%D Todo: use lua instead of synonyms
+%D \startbuffer
+%D \usemodule[x-setups-basics]
+%D
+%D \loadsetups[context-en]
+%D
+%D \starttext
+%D
+%D \showsetup[starttyping:instance:LUA]
+%D
+%D \showsetup[starttyping:instance:typing]
+%D
+%D \showsetup[starttyping:instance:argument]
+%D
+%D \showsetup [completelistoffloats:instance:chemicals] \blank
+%D \shortsetup[completelistoffloats:instance:chemicals] \blank
+%D \basicsetup[completelistoffloats:instance:chemicals] \blank
+%D
+%D \cmdfullsetup [completelistoffloats:instance:chemicals] \blank
+%D \cmdshortsetup[completelistoffloats:instance:chemicals] \blank
+%D \cmdbasicsetup[completelistoffloats:instance:chemicals] \blank
+%D
+%D % \cmdinternal{...}
+%D
+%D \page \placeeverysetup \page
+%D \page \placeeverysetupname \page
+%D
+%D \stoptext
+%D \stopbuffer
+
+% Todo: use lua instead of synonyms
\unprotect
@@ -34,6 +71,8 @@
\definesorting
[texcommand]
+ [texcommands]
+ [\v!none]
\setupsorting
[texcommand]
@@ -71,7 +110,6 @@
\unexpanded\def\setupalwcolor{}
\unexpanded\def\setupoptcolor{darkgray}
-% \unexpanded\def\setupvarword#1{{\sl\detokenize{#1}}}
\unexpanded\def\setupvarword#1{\detokenize{#1}}
\unexpanded\def\setupintword#1{\WORD{\detokenize{#1}}}
\unexpanded\def\setuptxtword#1{\detokenize{#1}}
@@ -108,7 +146,6 @@
\let\currentSETUPprefix\empty
}
\edef\currentSETUPname{\xmlatt{#1}{name}}
- \let\currentSETUPgenerated\empty
\doifelsenothing {\xmlatt{#1}{variant}} {
\let\currentSETUPvariant\empty
} {
@@ -118,7 +155,6 @@
\currentSETUPprefix
\currentSETUPname
\currentSETUPvariant
- \currentSETUPgenerated
}
\stopxmlsetups
@@ -132,8 +168,7 @@
} {
\let\currentSETUPprefix\empty
}
-% \edef\currentSETUPname{\xmlatt{#1}{name}}
- \let\currentSETUPgenerated\empty
+ \edef\currentSETUPname{\xmlatt{#1}{name}}
\doifelsenothing {\xmlatt{#1}{variant}} {
\let\currentSETUPvariant\empty
} {
@@ -143,34 +178,19 @@
\currentSETUPprefix
\currentSETUPname
\currentSETUPvariant
- \currentSETUPgenerated
}
\stopxmlsetups
-% \startxmlsetups xml:setups:register
-% \doifelse {\xmlatt{#1}{variant}} {instance} {
-% \def\docommand##1%
-% {\def\currentSETUPname{##1}%
-% \xmlsetup{#1}{xml:setups:assemblename:instance}
-% \expanded{\texcommand[stp:x:\currentSETUPfullname]{{#1}{##1}}}}%
-% \processcommacommand[\clf_getinstances{#1}]\docommand
-% } {
-% \xmlsetup{#1}{xml:setups:assemblename}
-% % not really needed if we just use setups
-% \expanded{\texcommand[stp:x:\currentSETUPfullname]{{#1}{}}}
-% }
-% \stopxmlsetups
-
\startxmlsetups xml:setups:register
- \doif {\xmlatt{#1}{variant}} {instance} {
- \def\docommand##1%
- {\xmlsetup{#1}{xml:setups:assemblename:instance}
- \expanded{\texcommand[stp:x:\currentSETUPfullname:##1]{{#1}{##1}}}}%
+ \doifcommon {\xmlatt{#1}{variant}} {instance,instance:assignment,instance:ownnumber,instance:argument} {
+ \def\docommand##1{
+ \xmlsetup{#1}{xml:setups:assemblename:instance}
+ \expanded{\texcommand[\currentSETUPfullname:##1]{{#1}{##1}}}
+ }%
\processcommacommand[\clf_getinstances{#1}]\docommand
}
\xmlsetup{#1}{xml:setups:assemblename}
- % not really needed if we just use setups
- \expanded{\texcommand[stp:x:\currentSETUPfullname]{{#1}{}}}
+ \expanded{\texcommand[\currentSETUPfullname]{{#1}{}}}
\stopxmlsetups
\startluacode
@@ -200,6 +220,9 @@
local definitions = { }
setups.definitions = definitions
+ local report = logs.reporter("command setup")
+ local report_known = logs.reporter("command setup","known")
+
function xml.functions.setups_define(id)
local x = lxmlgetid(id)
for c in xmlcollected(x,"cd:interface/cd:define") do
@@ -271,9 +294,9 @@
if resolved then
e.__p__.dt[e.ni] = resolved
resolve(resolved)
- -- logs.report("setups","resolved: %a",name)
+ -- report("resolved: %a",name)
else
- logs.report("setups","unable to resolve: %a",name)
+ report("unable to resolve: %a",name)
end
end
end
@@ -282,7 +305,8 @@
for e in xml.collected(xmlroot,"cd:interface/cd:define") do
e.__p__.dt[e.ni] = ""
end
- xml.delete(xmlroot,"/cd:interface/cd:interface/cd:interface/..")
+ --
+ xml.delete(xmlroot,"/cd:interface/cd:interface[@file='i-common-definitions.xml']")
--
xmlblob = xml.tostring(xmlroot)
io.savedata(filename,xmlblob)
@@ -379,6 +403,30 @@
overload = true,
arguments = { "string" },
}
+
+ if structures then
+ local synonyms = structures.synonyms
+ if synonyms then
+ local collected = synonyms.collected
+ if collected then
+ local texcommand = collected.texcommand
+ if texcommand then
+ local entries = texcommand.entries
+ if entries then
+ local t = { }
+ local n = #entries
+ for i=1,n do
+ t[i] = entries[i].definition.tag
+ end
+ table.sort(t)
+ for i=1,n do
+ report_known(t[i])
+ end
+ end
+ end
+ end
+ end
+ end
\stopluacode
% <?xml version="1.0" encoding="UTF-8"?>
@@ -413,6 +461,7 @@
\ifx\m_cmd_asked_setups\empty \else
\doonlyonce{setups:#1}
{\doglobal\prependtocommalist{setups:#1}\loadedsetups
+ \edef\currentloadedsetup{#1}%
\doiffileexistselse{#1}
{\xmlloadonly{setups:#1}{#1}{setups}}%
{\xmlloadonly{setups:#1}{#1.xml}{setups}}%
@@ -441,10 +490,17 @@
{%(#1)(#2)(#3)\par
\edef\m_cmd_instance{\secondoftwoarguments#3}%
\c_cmd_kind\plustwo
- \xmlsetup{\firstoftwoarguments#3}{xml:setups:typeset}
+ \xmlsetup{\firstoftwoarguments#3}{xml:setups:typeset}%
\let\m_cmd_instance\empty
\par}
+\unexpanded\def\showsetupnameonly#1#2#3%
+ {\edef\m_cmd_instance{\secondoftwoarguments#3}%
+ \c_cmd_kind\plustwo
+ \xmlsetup{\firstoftwoarguments#3}{xml:setups:assemblename}%
+ \let\m_cmd_instance\empty
+ \texescape\currentSETUPfullname}
+
\installtextracker
{cmd.showsetup}
{\settrue\c_cmd_show_setup}
@@ -461,17 +517,21 @@
\fi}
\def\cmd_show_setup_nop#1% this will trigger 'used'
- {\registersort[texcommand][stp:x:#1]%
+ {\registersort[texcommand][#1]%
\ifconditional\c_cmd_show_setup
- \writestatus{setup}{#1 / \rawsynonymname{texcommand}{stp:x:#1}}%
+ \writestatus{setup}{#1 / \rawsynonymname{texcommand}{#1}}%
\fi
\startelement[setup][name=#1]%
\startelement[noexport][comment={setup definition #1}]%
- \edef\cmd_id{\rawsynonymname{texcommand}{stp:x:#1}}%
+ \edef\cmd_id{\rawsynonymname{texcommand}{#1}}%
\ifx\cmd_id\empty
- missing: stp:x:#1
+ missing: #1
\else
+ \ifx\m_cmd_instance\empty
+ \edef\m_cmd_instance{\expandafter\secondoftwoarguments\cmd_id}%
+ \fi
\xmlsetup{\expandafter\firstoftwoarguments\cmd_id}{xml:setups:typeset}
+ \let\m_cmd_instance\empty
\fi
\stopelement
\stopelement}
@@ -483,6 +543,17 @@
\let\placeeverysetup\placeallsetups
+\unexpanded\def\cmd_show_setup_list_basic#1#2#3%
+ {\NC\tttf#2\NC\basicsetup[#2]\NC\NR}
+
+\unexpanded\def\placeeverysetupname
+ {\placelistofsorts
+ [texcommand]
+ [\c!before={\starttabulate[|||]},
+ \c!after=\stoptabulate,
+ \c!criterium=\v!all,
+ \c!command=\cmd_show_setup_list_basic]}
+
%D Typesetting:
\startxmlsetups xml:setups:typeset
@@ -620,7 +691,8 @@
\setfalse\c_cmd_doing_line
\global\c_cmd_current_argument\zerocount
%\blank[\v!line] % packed mode (we could do \startunpacked ...)
- \godown[.75\lineheight]
+% \godown[.75\lineheight]
+ \blank[\v!samepage,\v!medium]
\switchtobodyfont[\v!small]
\ignorespaces\xmlfilter{#1}{/arguments/text()}\endgraf
\egroup
@@ -638,7 +710,8 @@
\startxmlsetups xml:setups:typeset:instances
\ifx\m_cmd_instance\empty
\xmldoif{#1}{/instances} {
- \godown[.75\lineheight]
+% \godown[.75\lineheight]
+ \blank[\v!samepage,\v!medium]
{\ttbf instances:}
\enspace
\xmlfilter{#1}{/instances/(constant|resolve)/command(xml:setups:instance)}
@@ -647,22 +720,31 @@
\fi
\stopxmlsetups
+\startsetups xml:setups:start
+ \csname\e!start setuptext\endcsname
+\stopsetups
+
+\startsetups xml:setups:stop
+ \csname\e!stop setuptext\endcsname
+\stopsetups
+
\startxmlsetups xml:setups:typeset:yes
+ \forgetparskip
\glet\m_cmd_current_file\empty
\ifcase\c_cmd_kind
\xmlsetup{#1}{xml:setups:typeset:line}
\or
- \getvalue{\e!start setuptext}
+ \directsetup{xml:setups:start}
\xmlsetup{#1}{xml:setups:typeset:raw}
- \getvalue{\e!stop setuptext}
+ \directsetup{xml:setups:stop}
\or
- \getvalue{\e!start setuptext}
+ \directsetup{xml:setups:start}
\xmlsetup{#1}{xml:setups:typeset:raw}
\endgraf
\xmlsetup{#1}{xml:setups:typeset:detail}
\endgraf
\xmlsetup{#1}{xml:setups:typeset:instances}
- \getvalue{\e!stop setuptext}
+ \directsetup{xml:setups:stop}
\fi
\glet\m_cmd_current_file\empty
\stopxmlsetups
@@ -713,24 +795,25 @@
\ignorespaces
\stopxmlsetups
+\startxmlsetups xml:setups:csname \show_setup_component{#1}{csname} \stopxmlsetups
\startxmlsetups xml:setups:content \show_setup_component{#1}{content} \stopxmlsetups
-\startxmlsetups xml:setups:displaymath \show_setup_component{#1}{displaymath}\stopxmlsetups
-\startxmlsetups xml:setups:index \show_setup_component{#1}{index} \stopxmlsetups
-\startxmlsetups xml:setups:math \show_setup_component{#1}{math} \stopxmlsetups
-\startxmlsetups xml:setups:nothing \show_setup_component{#1}{nothing} \stopxmlsetups
-\startxmlsetups xml:setups:file \show_setup_component{#1}{file} \stopxmlsetups
\startxmlsetups xml:setups:position \show_setup_component{#1}{position} \stopxmlsetups
-\startxmlsetups xml:setups:reference \show_setup_component{#1}{reference} \stopxmlsetups
-\startxmlsetups xml:setups:csname \show_setup_component{#1}{csname} \stopxmlsetups
-\startxmlsetups xml:setups:destination \show_setup_component{#1}{destination}\stopxmlsetups
-\startxmlsetups xml:setups:triplet \show_setup_component{#1}{triplet} \stopxmlsetups
-\startxmlsetups xml:setups:word \show_setup_component{#1}{word} \stopxmlsetups
+\startxmlsetups xml:setups:index \show_setup_component{#1}{index} \stopxmlsetups
+\startxmlsetups xml:setups:text \show_setup_component{#1}{text} \stopxmlsetups
+\startxmlsetups xml:setups:apply \show_setup_component{#1}{apply} \stopxmlsetups
\startxmlsetups xml:setups:template \show_setup_component{#1}{template} \stopxmlsetups
+\startxmlsetups xml:setups:triplet \show_setup_component{#1}{triplet} \stopxmlsetups
\startxmlsetups xml:setups:angles \show_setup_component{#1}{angles} \stopxmlsetups
-\startxmlsetups xml:setups:apply \show_setup_component{#1}{apply} \stopxmlsetups
-\startxmlsetups xml:setups:twowords \show_setup_component{#1}{twowords} \stopxmlsetups
-\startxmlsetups xml:setups:threewords \show_setup_component{#1}{threewords} \stopxmlsetups
-\startxmlsetups xml:setups:text \show_setup_component{#1}{text} \stopxmlsetups
+
+%startxmlsetups xml:setups:displaymath \show_setup_component{#1}{displaymath}\stopxmlsetups
+%startxmlsetups xml:setups:math \show_setup_component{#1}{math} \stopxmlsetups
+%startxmlsetups xml:setups:nothing \show_setup_component{#1}{nothing} \stopxmlsetups
+%startxmlsetups xml:setups:file \show_setup_component{#1}{file} \stopxmlsetups
+%startxmlsetups xml:setups:reference \show_setup_component{#1}{reference} \stopxmlsetups
+%startxmlsetups xml:setups:destination \show_setup_component{#1}{destination}\stopxmlsetups
+%startxmlsetups xml:setups:word \show_setup_component{#1}{word} \stopxmlsetups
+%startxmlsetups xml:setups:twowords \show_setup_component{#1}{twowords} \stopxmlsetups
+%startxmlsetups xml:setups:threewords \show_setup_component{#1}{threewords} \stopxmlsetups
% todo: cd:par => \par
% todo: cd:sep => \\
@@ -788,7 +871,8 @@
\unknown
}
\cmd_column_one_stop
- \godown[.75\lineheight]
+% \godown[.75\lineheight]
+ \blank[\v!samepage,\v!medium]
\ignorespaces
\fi
\stopxmlsetups
@@ -805,7 +889,8 @@
\ignorespaces
\xmlflush{#1}
\cmd_column_one_stop
- \godown[.75\lineheight]
+% \godown[.75\lineheight]
+ \blank[\v!samepage,\v!medium]
\ignorespaces
\fi
\stopxmlsetups
@@ -881,12 +966,12 @@
\stopxmlsetups
\startxmlsetups xml:setups:inherit
-% \cmd_column_two_start{}{}
+ % \cmd_column_two_start{}{}
\rawsetupstring{cd:inherits}:
\enspace
\letterbackslash
\xmlatt{#1}{name}
-% \cmd_column_two_stop
+ % \cmd_column_two_stop
\ignorespaces
\stopxmlsetups
@@ -894,7 +979,8 @@
{\cmd_column_one_start
\cmd_internal_value{#1}%
\cmd_column_one_stop
- \godown[.75\lineheight]
+ % \godown[.75\lineheight]
+ \blank[\v!samepage,\v!medium]
\ignorespaces}
%D Auxiliary.
@@ -965,26 +1051,25 @@
% arguments
-\unexpanded\def\show_setup_displaymath#1{\show_setup_any {#1}{displaymath}}
-\unexpanded\def\show_setup_index #1{\show_setup_any {#1}{index}}
-\unexpanded\def\show_setup_math #1{\show_setup_any {#1}{math}}
-\unexpanded\def\show_setup_nothing #1{\show_setup_any {#1}{nothing}}
-\unexpanded\def\show_setup_file #1{\show_setup_any {#1}{file}}
-\unexpanded\def\show_setup_position #1{\show_setup_any {#1}{position}}
-\unexpanded\def\show_setup_template #1{\show_setup_any {#1}{template}}
-\unexpanded\def\show_setup_angles #1{\show_setup_any {#1}{angle}}
-\unexpanded\def\show_setup_reference #1{\show_setup_any {#1}{reference}}
-\unexpanded\def\show_setup_apply #1{\show_setup_any {#1}{apply}}
-\unexpanded\def\show_setup_twowords #1{\show_setup_any {#1}{twowords}}
-\unexpanded\def\show_setup_threewords #1{\show_setup_any {#1}{threewords}}
-\unexpanded\def\show_setup_csname #1{\show_setup_any {#1}{noargument}}
-\unexpanded\def\show_setup_destination#1{\show_setup_any {#1}{destination}}
-\unexpanded\def\show_setup_triplet #1{\show_setup_any {#1}{triplet}}
-\unexpanded\def\show_setup_word #1{\show_setup_any {#1}{word}}
-\unexpanded\def\show_setup_content #1{\show_setup_any {#1}{content}}
-\unexpanded\def\show_setup_text #1{\show_setup_any {#1}{textual}}
-\unexpanded\def\show_setup_to #1{\show_setup_line{#1}{to}}
-\unexpanded\def\show_setup_macro #1{\show_setup_any {#1}{macro}}
+\unexpanded\def\show_setup_csname #1{\show_setup_any{#1}{noargument}}
+\unexpanded\def\show_setup_content #1{\show_setup_any{#1}{content}}
+\unexpanded\def\show_setup_position #1{\show_setup_any{#1}{position}}
+\unexpanded\def\show_setup_index #1{\show_setup_any{#1}{index}}
+\unexpanded\def\show_setup_text #1{\show_setup_any{#1}{textual}}
+\unexpanded\def\show_setup_apply #1{\show_setup_any{#1}{apply}}
+\unexpanded\def\show_setup_template #1{\show_setup_any{#1}{template}}
+\unexpanded\def\show_setup_triplet #1{\show_setup_any{#1}{triplet}}
+\unexpanded\def\show_setup_angles #1{\show_setup_any{#1}{angle}}
+
+%unexpanded\def\show_setup_displaymath#1{\show_setup_any{#1}{displaymath}}
+%unexpanded\def\show_setup_math #1{\show_setup_any{#1}{math}}
+%unexpanded\def\show_setup_nothing #1{\show_setup_any{#1}{nothing}}
+%unexpanded\def\show_setup_file #1{\show_setup_any{#1}{file}}
+%unexpanded\def\show_setup_reference #1{\show_setup_any{#1}{reference}}
+%unexpanded\def\show_setup_destination#1{\show_setup_any{#1}{destination}}
+%unexpanded\def\show_setup_word #1{\show_setup_any{#1}{word}}
+%unexpanded\def\show_setup_twowords #1{\show_setup_any{#1}{twowords}}
+%unexpanded\def\show_setup_threewords #1{\show_setup_any{#1}{threewords}}
% A prelude to a rewrite and some more:
@@ -1026,7 +1111,7 @@
\stopxmlsetups
\startxmlsetups xml:setups:parameters:values
- \blank[\v!big]
+ \blank[\v!big,\v!samepage]
\expanded {
\parametercommand {
\currentsetupparametercommand
@@ -1039,7 +1124,7 @@
}
}
\blank[\v!big,\v!samepage]
- \starttabulate[|l|p|]
+ \starttabulate[|l|pl|]
% no /interface here
\xmlall
{#1}
diff --git a/tex/context/modules/mkiv/x-setups-overview.mkiv b/tex/context/modules/mkiv/x-setups-overview.mkiv
index c0047f13a..f6dff12f5 100644
--- a/tex/context/modules/mkiv/x-setups-overview.mkiv
+++ b/tex/context/modules/mkiv/x-setups-overview.mkiv
@@ -1,5 +1,5 @@
%D \module
-%D [ file=setups-basics, % x-set-12,
+%D [ file=setups-overview, % x-set-12,
%D version=2016.04.05, % 2004.10.31,
%D remark=setupx.tex: 1998.07.20 and later,
%D title=\CONTEXT\ Setup Definitions,
@@ -12,10 +12,13 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% context --interface=en --global --result=setup-en x-setups-overview.mkiv
+% context --interface=en --global --result=setup-en x-setups-overview.mkiv --mode=setups:save
+% context --interface=en --global --result=setup-mapping-en x-setups-overview.mkiv --mode=setups:mapping
% \enablemode[setups:save]
+% \enablemode[setups:mapping]
+
\usemodule[setups-basics]
\unprotect
@@ -80,7 +83,12 @@
\definecolor [darkgray] [s=.1]
\usetypescript[palatino]
-\setupbodyfont[palatino,9pt]
+
+\doifelsemode {setups:mapping} {
+ \setupbodyfont[palatino,8pt]
+} {
+ \setupbodyfont[palatino,9pt]
+}
\defineoverlay
[cover]
@@ -91,28 +99,42 @@
[\hbox to \paperwidth{\reuseMPgraphic{cover+back}\hss}]
\startreusableMPgraphic{cover+back}
- numeric h, w ; path p, q, r ; color f, d ; pair s ;
+ numeric h, w; boolean mapping ; path p, q, r ; color f, d ; pair s ;
h := OverlayHeight ; w := 2*OverlayWidth ;
r := unitsquare xyscaled (w,h) ;
fill r withcolor \MPcolor{lightgray} ;
- set_grid(w,h,w/8,w/16) ;
+ mapping := lua.mp.processingmode("setups:mapping") ;
+ if mapping :
+ set_grid(w,h,w/8,w/160) ;
+ pickup pensquare yscaled (w/80) ;
+ else :
+ set_grid(w,h,w/8,w/16) ;
+ pickup pencircle scaled (w/100) ;
+ fi ;
forever :
s := center r randomized (w,h) ;
if new_on_grid(xpart s, ypart s) :
- s := (dx,dy) ;
- p := fullsquare xyscaled(w/4,w/8) ;
- q := (-4w,ypart ulcorner p) -- .5[ulcorner p, urcorner p] -- (4w,ypart urcorner p) ;
- q := q shifted (0,-w/24) ;
- p := p randomized (w/40,w/40) ;
- q := q randomized (0,w/100) ;
- q := q cutafter (p cutafter point 3 of p) ;
- q := q cutbefore (p cutbefore point 3 of p) ;
d := .5[\MPcolor{LocalColor},\MPcolor{lightgray}] randomized (.5,.9) ;
f := \MPcolor{lightgray} randomized (.5,.9) ;
- pickup pencircle scaled (w/100) ;
- fill p shifted s withcolor f ;
- draw p shifted s withcolor d ;
- draw q shifted s withcolor d ;
+ s := (dx,dy) ;
+ if mapping :
+ p := (-w/4,0) -- (w/4,0) ;
+ p := (-w/4,0) -- origin ;
+ q := origin -- ( w/4,0) ;
+ draw p shifted s withcolor d ;
+ draw q shifted s withcolor f ;
+ else :
+ p := fullsquare xyscaled(w/4,w/8) ;
+ q := (-4w,ypart ulcorner p) -- .5[ulcorner p, urcorner p] -- (4w,ypart urcorner p) ;
+ q := q shifted (0,-w/24) ;
+ p := p randomized (w/40,w/40) ;
+ q := q randomized (0,w/100) ;
+ q := q cutafter (p cutafter point 3 of p) ;
+ q := q cutbefore (p cutbefore point 3 of p) ;
+ fill p shifted s withcolor f ;
+ draw p shifted s withcolor d ;
+ draw q shifted s withcolor d ;
+ fi ;
fi ;
exitif grid_full ;
endfor ;
@@ -137,6 +159,11 @@
\c!width=\v!middle,
\c!height=\v!middle]
+\doifmode {setups:mapping} {
+ \setuplayout
+ [\c!backspace=1cm]
+}
+
\setuppagenumbering
[\c!location=\v!footer,
\c!alternative=\v!doublesided]
@@ -234,7 +261,11 @@
\protect
-\placeeverysetup
+\doifelsemode {setups:mapping} {
+ \placeeverysetupname
+} {
+ \placeeverysetup
+}
\unprotect