diff options
Diffstat (limited to 'tex/context/base/x-ldx.tex')
-rw-r--r-- | tex/context/base/x-ldx.tex | 282 |
1 files changed, 170 insertions, 112 deletions
diff --git a/tex/context/base/x-ldx.tex b/tex/context/base/x-ldx.tex index 0d9350c1c..140413e7d 100644 --- a/tex/context/base/x-ldx.tex +++ b/tex/context/base/x-ldx.tex @@ -1,133 +1,191 @@ -\defineregister[function][functions] -\defineregister[variable][variables] +\doifnotmode{mkiv}{\endinput} -\definehead[source][subject] -\definehead[extra] [subsubject] -\definehead[topic] [subsubsubject] +\setupxml[method=mkiv,default=hidden] + +\usemodule[mathml] + +\xmlregisterdocumentsetup{ldx}{xml:mml:define} +\xmlregisterdocumentsetup{ldx}{xml:ldx:define} + +\xmlregisterns{ldx}{ldx} + +\startxmlsetups xml:ldx:define + \xmlgrab {\xmldocument} {ldx:*} {*} +\stopxmlsetups + +% % % + +\startxmlsetups ldx:p + \xmlflush{#1}\par +\stopxmlsetups + +\startxmlsetups ldx:source + \source{\xmlflush{#1}} +\stopxmlsetups + +\startxmlsetups ldx:key + \dontleavehmode{\bf\xmlflush{#1}} +\stopxmlsetups -\setuphead[source][style=\bfb] -\setuphead[extra] [style=\bfa] -\setuphead[topic] [style=\bf] - -\def\LDXkey #1{\bold{#1}} -\def\LDXfunction#1{\LDXkey{function} #1\function{#1}} -\def\LDXvariable#1{#1\variable{#1}} -\def\LDXcomment #1{{\tt--#1}} -\def\LDXsource #1{\source{#1}} - -\defineXMLenvironment - [ldx:document] - {\page} - {\determineregistercharacteristics[function] - \startmode[*register] +\startxmlsetups ldx:variable + \xmlflush{#1} + \expanded{\variable{\xmlflush{#1}}} +\stopxmlsetups + +\startxmlsetups ldx:function + \dontleavehmode{\bf function}\space\xmlflush{#1} + \expanded{\function{\xmlflush{#1}}} +\stopxmlsetups + +\startxmlsetups ldx:com + \dontleavehmode{\tt--\xmlflush{#1}} +\stopxmlsetups + +\startxmlsetups ldx:document + \page + \xmlflush{#1} + \determineregistercharacteristics[function] + \startmode[*register] + \testpage[4] \extra{Functions} \placeregister[function] - \stopmode - \determineregistercharacteristics[variable] - \startmode[*register] + \stopmode + \determineregistercharacteristics[variable] + \startmode[*register] + \testpage[4] \extra{Variables} \placeregister[variable] - \stopmode} - -\defineXMLargument [ldx:source] \LDXsource -\defineXMLargument [ldx:key] \LDXkey -\defineXMLargument [ldx:variable] \LDXvariable -\defineXMLargument [ldx:function] \LDXfunction -\defineXMLargument [ldx:com] \LDXcomment + \stopmode +\stopxmlsetups \newcounter\CommentCounter -\defineXMLenvironment[ldx:comment] - {\endgraf - \blank - \doglobal\increment\CommentCounter - \margintitle{\bf\CommentCounter}} - {\blank - \endgraf} - -\defineXMLenvironment[ldx:dqs] - {\bgroup\tt"} - {"\egroup} - -\defineXMLenvironment[ldx:sqs] - {\bgroup\tt'} - {'\egroup} - -\defineXMLenvironment[ldx:code] - {\startpacked} - {\stoppacked} - -\defineXMLenvironment[ldx:line][n=0,comment=] % maybe hangindent or leftskip - {\dontleavehmode - \hbox to \hsize\bgroup - \strut\hskip\dimexpr\XMLop{n}em/4\relax\relax - \doif {\XMLop{comment}} {yes} {\tt}} - {\hss - \egroup - \endgraf} - -\defineXMLsingular[ldx:line] - {\crlf} - -\defineXMLargument [source] \LDXsource -\defineXMLargument [key] \LDXkey - -\defineXMLsingular[logo][label=,name=] - {\uppercasestring\XMLop{label}\XMLop{label}\to\ascii - \getvalue{\ascii}} - -\defineXMLsingular[l][l=,n=] - {\uppercasestring\XMLop{l}\XMLop{l}\to\ascii - \getvalue{\ascii}} - -\defineXMLenvironment - [typing] - {\blank - \startpacked \tt - \obeyspaces} - {\stoppacked - \blank} - -\defineXMLentity[amp]{\&} -\defineXMLentity[lt] {<} -\defineXMLentity[gt] {>} +\startxmlsetups ldx:comment + \blank + \doglobal\increment\CommentCounter + \margintitle{\bf\CommentCounter} + \xmlflush{#1} + \blank +\stopxmlsetups + +\startxmlsetups ldx:dqs + \dontleavehmode\bgroup\tt"\xmlflush{#1}"\egroup +\stopxmlsetups + +\startxmlsetups ldx:sqs + \dontleavehmode\bgroup\tt'\xmlflush{#1}'\egroup +\stopxmlsetups + +\startxmlsetups ldx:code + \startpacked + \xmlflush{#1} + \stoppacked +\stopxmlsetups + +\startxmlsetups ldx:lines + \startpacked + \xmlflush{#1} + \stoppacked +\stopxmlsetups + +\startxmlsetups ldx:line + \doifelsenothing {\xmlflush{#1}} { + \xmlflush{#1}\crlf + } { + \dontleavehmode \hbox to \hsize \bgroup + \strut + \hskip.25\dimexpr\xmlattdef{#1}{n}{0}em\relax + \xmldoif {\xmlatt{#1}{comment}} {yes} {\tt} + \xmlflush{#1} + \hss + \egroup + \endgraf + } +\stopxmlsetups + +\startxmlsetups ldx:logo + \uppercasestring\xmlatt{#1}{label}\xmlatt{#1}{name}\to\ascii + \ifx\ascii\empty\else\getvalue{\ascii}\fi +\stopxmlsetups + +\startxmlsetups ldx:l + \uppercasestring\xmlatt{#1}{l}\xmlatt{#1}{n}\to\ascii + \ifx\ascii\empty\else\getvalue{\ascii}\fi +\stopxmlsetups + +\startxmlsetups ldx:typing + \blank + \startpacked \tt + \xmlverbatim{#1} + \stoppacked + \blank +\stopxmlsetups + +\startxmlsetups ldx:type + \dontleavehmode{\tt\xmlflush{#1}} +\stopxmlsetups + +\startxmlsetups ldx:t + \dontleavehmode{\tt\xmlflush{#1}} +\stopxmlsetups + +% + +\def\xmldocument{ldx} + +% \processXMLfileMKIV[ldx] \usemodule[abr-02] -\startnotmode[atpragma] - \definetypeface[mainfacenormal] [ss][sans] [iwona] [default] - \definetypeface[mainfacenormal] [rm][serif][palatino] [default] - \definetypeface[mainfacenormal] [tt][mono] [modern] [default][rscale=1.1] - \definetypeface[mainfacenormal] [mm][math] [iwona] [default][encoding=default] +% key -> kw +% dqs -> dq +% sqs -> sq +% line -> ln +% code -> cd +% comment -> tx (text) + +\definetypeface[mainfacenormal] [ss][sans] [iwona] [default] +\definetypeface[mainfacenormal] [rm][serif][palatino] [default] +\definetypeface[mainfacenormal] [tt][mono] [modern] [default][rscale=1] % 1.1 +\definetypeface[mainfacenormal] [mm][math] [iwona] [default][encoding=default] + +\definetypeface[mainfacemedium] [ss][sans] [iwona-medium][default] +\definetypeface[mainfacenormal] [rm][serif][palatino] [default] +\definetypeface[mainfacemedium] [tt][mono] [modern] [default][rscale=1] % 1.1 +\definetypeface[mainfacemedium] [mm][math] [iwona-medium][default][encoding=default] + +\definetypeface[mainfacenarrowtt][tt][mono] [modern-cond] [default][rscale=1] % 1.1 - \definetypeface[mainfacemedium] [ss][sans] [iwona-medium][default] - \definetypeface[mainfacenormal] [rm][serif][palatino] [default] - \definetypeface[mainfacemedium] [tt][mono] [modern] [default][rscale=1.1] - \definetypeface[mainfacemedium] [mm][math] [iwona-medium][default][encoding=default] +\setupbodyfont + [mainfacenormal,11pt] - \definetypeface[mainfacenarrowtt][tt][mono] [modern-cond] [default][rscale=1.1] -\stopnotmode +\setupwhitespace + [big] -\startmode[atpragma] - \usetypescriptfile[type-ghz] +\defineregister[function][functions] +\defineregister[variable][variables] + +\definehead[source][subject] +\definehead[extra] [subsubject] +\definehead[topic] [subsubsubject] - \definetypeface[mainfacenormal] [ss][sans] [optima-nova] [default] - \definetypeface[mainfacenormal] [rm][serif][palatino] [default] - \definetypeface[mainfacenormal] [tt][mono] [modern] [default][rscale=1.1] - \definetypeface[mainfacenormal] [mm][math] [palatino] [default][encoding=default] +\setuphead + [source] + [style=\bfb] - \definetypeface[mainfacemedium] [ss][sans] [optima-nova] [default] - \definetypeface[mainfacenormal] [rm][serif][palatino] [default] - \definetypeface[mainfacemedium] [tt][mono] [modern] [default][rscale=1.1] - \definetypeface[mainfacemedium] [mm][math] [palatino] [default][encoding=default] +\setuphead + [extra] + [style=\bfa] - \definetypeface[mainfacenarrowtt][tt][mono] [modern-cond] [default][rscale=1.1] -\stopmode +\setuphead + [topic] + [style=\bf] -\setupbodyfont[mainfacenormal,11pt] +\setuplayout + [width=middle, + height=middle, + backspace=2cm, + topspace=2cm] -\setupwhitespace[big] +\endinput -% \starttext -% \processXMLfilegrouped{\inputfilename} -% \stoptext |