From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/17530 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: mag-0008 Date: Wed, 15 Dec 2004 18:14:00 +0100 Message-ID: <41C070D8.7060601@wxs.nl> References: <41BA1753.9080206@wxs.nl> <20041213180232.18842@news.comp.lancs.ac.uk> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1103130876 10002 80.91.229.6 (15 Dec 2004 17:14:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Dec 2004 17:14:36 +0000 (UTC) Cc: mailing list for ConTeXt users , Bruce D'Arcus Original-X-From: ntg-context-bounces@ntg.nl Wed Dec 15 18:14:22 2004 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CecjG-00070f-00 for ; Wed, 15 Dec 2004 18:14:22 +0100 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4E567127A9; Wed, 15 Dec 2004 18:14:21 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 29903-04; Wed, 15 Dec 2004 18:14:17 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 28E1512799; Wed, 15 Dec 2004 18:14:17 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0165F12799 for ; Wed, 15 Dec 2004 18:14:16 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30000-05 for ; Wed, 15 Dec 2004 18:14:14 +0100 (CET) Original-Received: from mailrelay02.solcon.nl (unknown [212.45.32.200]) by ronja.ntg.nl (Postfix) with ESMTP id 2084D1278D for ; Wed, 15 Dec 2004 18:14:14 +0100 (CET) Original-Received: from server-1.pragma-net.nl (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by mailrelay02.solcon.nl (8.12.11/SQL-8.12.11-5/8.12.11) with ESMTP id iBFHDxTj021140; Wed, 15 Dec 2004 18:13:59 +0100 Original-Received: by server-1.pragma-net.nl (Postfix, from userid 65534) id 028CA17C1A; Wed, 15 Dec 2004 18:13:47 +0100 (CET) Original-Received: from [10.100.1.191] (unknown [10.100.1.191]) by server-1.pragma-net.nl (Postfix) with ESMTP id B0C1FF6E1; Wed, 15 Dec 2004 17:13:46 +0000 (UTC) User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en Original-To: Adam Lindsay In-Reply-To: <20041213180232.18842@news.comp.lancs.ac.uk> X-Virus-Scanned: ClamAV 0.80/540/Tue Oct 19 14:59:23 2004 clamav-milter version 0.80j on mailrelay02 X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: by amavisd-new at ntg.nl Xref: main.gmane.org gmane.comp.tex.context:17530 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:17530 Adam Lindsay wrote: > h h extern said this at Fri, 10 Dec 2004 22:38:27 +0100: > > >>>Also, what's the status of contml? I like the idea of it as a simple, >>>structural, basic markup that ConTeXt handles with zero effort, but is >>>anyone actually using it? >> >>we sometimes mix it into other xml docs; i have no problem with > > extending it; > >>actualy, (see mag-0008.pdf), i want to map most context directly onto xml so >>that we have a rather complete xml input syntax > > > Yes, indeed. I took a look at the magazine again last night, and it was > put in an entirely new light. I'm very curious to work with x-fx now... see below > I've been working on a general-ish conversion script from a new Mac > application. I'd like to offer most of ContML as basic level constructs, > but it should be possible for a user to add their own tags. If they can > tap into fx:anything tags, it should make people (hi, Bruce!) fairly happy. > > My first reaction/critique of the approach was: why not fix at least one > of the problems of TeX: that it's "a mixture between typesetting and > programming features" as you say? indeed, but, it al depends on the 'to be written' manuals then: - code in xml and then - use xslt to generate an (structured) instance that - calls templates that implement typographical solutions - using the xml interface to context in practice it means trading in some context funtionality by xslt functionality the interesting thing is that the whole machinery is still there > What I propose is clearly a debatable XML-design issue, but it seemed > strange that fx:definelayout and fx:p were put into the same namespace. > Why do the formatting definitions share the same (theoretical) schema as > markup? Your documents keep these categories separate, as one would > expect. Why not encourage people to put them in separate files, as with > "normal" ConTeXt workflows? The designer and author are more clearly > divorced when you don't assume an XSLT-centric flow, right? > (or, is this already planned with this tidbit from foxet: fs = setup) sure, definitions should become 'styles' but that's hard to demo in a magazine -) in principle it could also mean that one could predefine page masters and have multiple variants instead of the five-area-fo-thing > I'm curious about how the namespacing would work, though, because I want > to use (and enable the use of) these nice fs:setuphead -like > configurations with my hybrid ContML++ documents. Will: context\high{fx} > > correctly (in my mind) affect a ContML element like this? > something indeed, or something a matter of taste; i'm open to any suggestion (more a discussion for the foxet list) > Curious, well, here 's an version of x-fx. It demonstrates that it's relaively easy to map the context interface to xml; actually, if things get dirty i can provide a more low level context support which then makes the mapping clean -) %D \module %D [ file=x-fx, %D version=2004.11.12, %D title=\FOXET, %D subtitle=Style Processor, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \chardef\XMLtokensreduction = 2 \chardef\XMLcdatamethod = 2 \usemodule[mathml] \setupcolors[state=start] % these will be speed up by few step expansion \def\foxarguments {\theXMLarguments{fox}} \def\initializefox{\expanded{\getrawparameters[fox][\theXMLarguments{fox}]}} \def\foxaction #1{\expanded{#1[\theXMLarguments{fox}]}} % layers \defineXMLcommand [fx:definelayer] [fox] [label=default] {\initializefox \expanded{\definelayer[\foxlabel]}% \expanded{\setuplayer[\foxlabel][\foxarguments]}} \defineXMLcommand [fx:setuplayer] [fox] [label=default] {\initializefox \expanded{\setuplayer[\foxlabel][\foxarguments]}} \defineXMLenvironment [fx:setlayer] [fox] [label=default] {\initializefox \expanded{\setlayer[\foxlabel][\foxarguments]}\bgroup\ignorespaces} {\removeunwantedspaces\egroup} \defineXMLcommand [fx:flushlayer] [fox] [label=default] {\initializefox \tightlayer[\foxlabel]} % framed \defineXMLenvironment [fx:framed] [fox] [] {\initializefox \expanded{\framed[\foxarguments]}\bgroup\ignorespaces} {\removeunwantedspaces\egroup} % layout \defineXMLcommand [fx:definelayout] [fox] [label=default] {\initializefox \expanded{\definelayout[\foxlabel][\foxarguments]}} \defineXMLcommand [fx:setuplayout] [fox] [label=default] {\initializefox \expanded{\setuplayout[\foxlabel][\foxarguments]} }% \expanded{\setuplayout[\foxlabel]}} % todo: only when no further arguments \defineXMLcommand [fx:enablelayout] [fox] [label=default] {\initializefox \expanded{\setuplayout[\foxlabel]}} % heads / we need a stupid, not list/ref variant \defineXMLcommand [fx:definehead] [fox] [label=default,level=1] {\initializefox \expanded{\definehead[fx:head:\foxlabel][section=section-\foxlevel,incrementnumber=no]}% \expanded{\setuphead[fx:head:\foxlabel][\foxarguments,alternative=command]}} \defineXMLcommand [fx:setuphead] [fox] [label=default] {\initializefox \expanded{\setuphead[fx:head:\foxlabel][\foxarguments,alternative=command]}} \defineXMLenvironmentsave [fx:head] [fox] [label=default] {\bgroup} {\initializefox \expanded{\setuphead[fx:head:\foxlabel][\foxarguments,alternative=command]}% \getvalue{fx:head:\foxlabel}{\vbox{\forgetall\XMLflush{fx:head}}}% \egroup} % page \defineXMLcommand [fx:page] [fox] [command=yes] {\initializefox \expanded{\page[\foxcommand]}} % tabulate / todo: in context preamble also definable this way, then direct map \setuptabulate[before=,after=] \startsetups fox:tabulate \defineXMLenvironment [fx:preamble] {\scratchtoks\emptytoks} {\appendetoks|\to\scratchtoks} \defineXMLpickup [fx:tbody] {\expanded{\starttabulate[\the\scratchtoks]}} {\stoptabulate} \defineXMLcommand [fx:e] [fox] [width=,align=,type=line,style=] % line|paragraph {\initializefox \appendetoks|\to\scratchtoks \doifelse{\foxtype}{paragraph}{\appendetoks p\to\scratchtoks}{\appendetoks w\to\scratchtoks}% \doifsomething{\foxwidth}{\appendetoks(\foxwidth)\to\scratchtoks}% \appendetoks\XMLval{fox:tab:style}{\foxstyle}{}\to\scratchtoks \appendetoks\XMLval{fox:tab:align}{\foxalign}{}\to\scratchtoks} \defineXMLenvironment [fx:r] {} {\NC \NR} \defineXMLenvironment [fx:c] {\NC} {} \defineXMLenvironment [fx:tr] {} {\NC \NR} \defineXMLenvironment [fx:td] {\NC} {} \stopsetups \mapXMLvalue {fox:tab:align} {flushleft} {l} \mapXMLvalue {fox:tab:align} {flushright} {r} \mapXMLvalue {fox:tab:align} {center} {c} \mapXMLvalue {fox:tab:style} {italic} {I} \mapXMLvalue {fox:tab:style} {bold} {B} \mapXMLvalue {fox:tab:style} {slanted} {S} \defineXMLenvironment [fx:tabulate] [fox] [] {} {} \defineXMLenvironment [fx:tabulate] [fox] [] {\bgroup \directsetup{fox:tabulate}} {\egroup} % itemize \defineXMLcommand [fx:defineitemize] [fox] [label=default] % maybe also \defineitemgroup as synonym {\initializefox \expanded{\defineitemgroup[\foxlabel]}% \expanded{\setupitemgroup[\foxlabel][\foxarguments]}} \defineXMLcommand [fx:setupitemize] [fox] [label=default] {\initializefox \expanded{\setupitemgroup[\foxlabel][\foxarguments]}} \defineXMLenvironment [fx:itemize] [fox] [label=default] {\initializefox \expanded{\startitemgroup[\foxlabel]}\ignorespaces} {\stopitemgroup} \defineXMLenvironment [fx:item] [fox] [type=normal,symbol=] {\initializefox \XMLval{fox:item:type}{\foxtype}{normal}} {\par} \mapXMLvalue {fox:item:type} {normal} {\item} \mapXMLvalue {fox:item:type} {margin} {\mar{\foxsymbol}} \mapXMLvalue {fox:item:type} {symbol} {\sym{\foxsymbol}} % table % first last odd even row column header each \startsetups fox:table \defineXMLprocess [fx:preamble] \defineXMLcommand [fx:c] [fox] [r=each] {\initializefox\expanded{\setupTABLE[r][\foxr][\foxarguments]}} \defineXMLcommand [fx:r] [fox] [c=each] {\initializefox\expanded{\setupTABLE[c][\foxc][\foxarguments]}} \defineXMLcommand [fx:h] [fox] [c=each] {\initializefox\expanded{\setupTABLE[header][\foxc][\foxarguments]}} \defineXMLcommand [fx:e] [fox] [type=,c=each,r=each] {\initializefox \doifelse{\foxtype}{row} {\expanded{\setupTABLE[r][\foxr][\foxarguments]}} {\doifelse{\foxtype}{column} {\expanded{\setupTABLE[c][\foxc][\foxarguments]}} {\expanded{\setupTABLE[\foxc][\foxr][\foxarguments]}}}} \defineXMLnested [fx:thead] [fox] [] {\expanded{\bTABLEhead[\foxarguments]}} {\eTABLEhead} \defineXMLnested [fx:tfoot] [fox] [] {\expanded{\bTABLEfoot[\foxarguments]}} {\eTABLEfoot} \defineXMLnested [fx:tnext] [fox] [] {\expanded{\bTABLEnext[\foxarguments]}} {\eTABLEnext} \defineXMLnested [fx:tbody] [fox] [] {\expanded{\bTABLEbody[\foxarguments]}} {\eTABLEbody} \defineXMLnested [fx:tr] [fox] [] {\expanded{\bTR[\foxarguments]}} {\eTR} \defineXMLnested [fx:td] [fox] [] {\expanded{\bTD[\foxarguments]}} {\eTD} \stopsetups \defineXMLnested [fx:table] [fox] [] {\bgroup \directsetup{fox:table} \expanded{\bTABLE[\foxarguments]}} {\eTABLE \egroup} % misc \defineXMLenvironment [fx:narrower] [fox] [left=0em,right=0em] {\expanded{\setupnarrower[\foxarguments]}% \startnarrower[middle]} {\stopnarrower} \defineXMLenvironment [fx:text] [fox] [] {\starttext} {\stoptext} % paragraphs \newcount \paragraphdepth \defineXMLenvironment [fx:p] [fox] [strut=no] {\advance\paragraphdepth\plusone \initializefox \doifelse{\foxstrut}{yes} {\setvalue{fx:p:strut:\the\paragraphdepth}{1}} {\setvalue{fx:p:strut:\the\paragraphdepth}{0}}% \ifcase\getvalue{fx:p:strut:\the\paragraphdepth}\or\begstrut\fi} {\ifcase\getvalue{fx:p:strut:\the\paragraphdepth}\or\endstrut\fi \endgraf \advance\paragraphdepth\minusone} % fonts \def\startfont[#1]{\bgroup\getvalue{#1}} \def\stopfont {\egroup} \defineXMLcommand [fx:definefont] [fox] [label=fallbackfont,spec=lmtt10] % todo: more efficient (no spec/label in third arg) {\initializefox \expanded{\definefont[fx:font:\foxlabel][\foxspec][spec=,label=,\foxarguments]}} \defineXMLnested [fx:font] [fox] [label=fallbackfont] {\initializefox \startfont[fx:font:\foxlabel]} {\stopfont} % color \defineXMLcommand [fx:definecolor] [fox] [label=fallbackcolor] {\initializefox \expanded{\definecolor[fx:color:\foxlabel][\foxarguments]}} \defineXMLnested [fx:color] [fox] [label=fallbackfont] {\initializefox \startcolor[fx:color:\foxlabel]} {\stopcolor} % margin things \setupinmargin[style=,color=] \defineXMLargument [fx:margintext] [fox] [label=default] {\margintext} % so far \doifnotmode{demo}{\endinput} % test \startbuffer[demo] Left Top Right Bottom A bit of text! A bit of text! A bit of text! A bit of text! 12 The Title

Some text!

test 1test 2test 3test 4 test 11test 22test 33test 44 test 111test 222test 333test 444 test 1test 2test 3test 4 test 11test 22test 33test 44 test 111test 222test 333test 444 first first second third second third a b c a b c a b c a b c a b c a b c a b c \stopbuffer \starttext \showframe \typebuffer[demo] \processXMLbuffer[demo] \relax \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------