From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/24147 Path: news.gmane.org!not-for-mail From: Nikolai Weibull Newsgroups: gmane.comp.tex.context Subject: Re: An idea Date: Mon, 5 Dec 2005 21:48:09 +0100 Message-ID: <20051205204809.GD19534@puritan.petwork> References: <20051201162914.GA14497@fly.srk.fer.hr> <20051202165636.GA8858@puritan.petwork> <20051202174653.GB3376@fly.srk.fer.hr> <20051202184337.GB8858@puritan.petwork> <20051203194557.GA8903@puritan.petwork> <43933C98.20107@wxs.nl> <20051204191439.GA12372@puritan.petwork> <439353D5.4070704@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="SUOF0GtieIMvvwua" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1133815804 11105 80.91.229.2 (5 Dec 2005 20:50:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 5 Dec 2005 20:50:04 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Dec 05 21:50:01 2005 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1EjNFx-0006Es-Mm for gctc-ntg-context-518@m.gmane.org; Mon, 05 Dec 2005 21:48:17 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4907A12814; Mon, 5 Dec 2005 21:48:17 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 22265-04-3; Mon, 5 Dec 2005 21:48:11 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4452C12819; Mon, 5 Dec 2005 21:48:11 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 3FC9212819 for ; Mon, 5 Dec 2005 21:48:10 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 22265-04-2 for ; Mon, 5 Dec 2005 21:48:08 +0100 (CET) Original-Received: from mxfep01.bredband.com (mxfep01.bredband.com [195.54.107.70]) by ronja.ntg.nl (Postfix) with ESMTP id A41DB12814 for ; Mon, 5 Dec 2005 21:48:08 +0100 (CET) Original-Received: from puritan.petwork ([213.112.43.250] [213.112.43.250]) by mxfep01.bredband.com with ESMTP id <20051205204807.TTJM676.mxfep01.bredband.com@puritan.petwork> for ; Mon, 5 Dec 2005 21:48:07 +0100 Original-Received: by puritan.petwork (Postfix, from userid 1000) id BD18110226D; Mon, 5 Dec 2005 21:48:09 +0100 (CET) Original-To: ntg-context@ntg.nl Content-Disposition: inline In-Reply-To: <439353D5.4070704@wxs.nl> User-Agent: Mutt/1.5.11 X-Virus-Scanned: 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: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:24147 Archived-At: --SUOF0GtieIMvvwua Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hans Hagen wrote: > Nikolai Weibull wrote: > > Is there (going to be) any support for this export format in ConTeXt > > so that I can just generate this kind of XML instead so that we only > > do things once? I found this in mscite-p.pdf: =E2=80=9CThe exporter = will be > > descibed as soon as there are styles for processing the XML code. > > For the moment we stick to showing the schema.=E2=80=9D Am I to take= it > > that there are plans for handling this, but that nothing has been > > written yet? I=E2=80=99ll gladly help out if I can. I was hoping to= make > > an article out of this, but now it seems that a lot of groundwork > > has already been done. (I really need to write some articles if I=E2= =80=99m > > going to be accepted for a postgraduate position.) > see attached zip =20 > this is what is produced, writing an xml mapping to context code (i mus= t=20 > have an example somewhere but cannot find it now) (I come off quite negative in this response, but I am not trying to place blame here, just trying to come up with something better.) That=E2=80=99s just horrendous. The =E2=80=98n=E2=80=99 attribute on =E2= =80=98line=E2=80=99 is useless (and why are empty lines unnumbered?). You can just as easily use XSLT=E2=80=99s to get that effect: . Furthermore, the =E2=80=98n=E2=80=99 attribute on =E2=80=98t=E2=80=99 is = equally useless. How am I to know what =E2=80=9C3=E2=80=9D stands for when converting? Finally, what=E2=80=99s the reason for having =E2=80=98s=E2=80=99? It ju= st complicates matters immensely: 0"> The problem is that the =E2=80=98n=E2=80=99 attribute has a default of 1,= but as there=E2=80=99s no way to express default values for attributes in Relax-NG (and there=E2= =80=99s no schema at the bogus url http://www.scintila.org/scite.rng) we=E2=80=99= d have to hack it even more. Could you enlighten me on the merits of having a tag for representing (sequences of) whitespace? Here=E2=80=99s a suggestion for a better grammar: ID.datatype =3D xsd:ID LanguageCode.datatype =3D xsd:language id.attrib =3D attribute id { ID.datatype }? xmlbase.attrib =3D attribute xml:base { text }? Core.attrib =3D id.attrib, xmlbase.attrib lang.attrib =3D attribute xml:lang { LanguageCode.datatype }? I18n.attrib =3D lang.attrib Common.attrib =3D Core.attrib, I18n.attrib start =3D file | line | segment | whitespace file =3D element file { file.attlist, file.content } file.attlist =3D Common.attrib, attribute path { text }, attribute type {= text } file.content =3D line* line =3D element line { line.attlist, line.content } line.attlist =3D Common.attrib line.content =3D (segment | whitespace)* segment =3D element segment { segment.attlist, text } segment.attlist =3D Common.attrib, attribute type { text } whitespace =3D element whitespace { whitespace.attlist, empty } whitespace.attlist =3D Common.attrib I=E2=80=99m sure that there are things missing and that it can be improve= d further, but it=E2=80=99s a good start in my opinion. What I can=E2=80=99t decide is whether to write things like inta; or inta; The first scheme is easier to extend with more types, if we don=E2=80=99t validate the value of segment=E2=80=99s =E2=80=98type=E2=80=99 attribute = (if we do, then both schemes are equally =E2=80=9Ceasy=E2=80=9D to extend), but the second sch= eme has the benefit that as much validation as possible can go into the schema and can thus ease translation. I envision that the XSLT ConTeXt-converter for this scheme would have code in one of these two formats: \highlight[]{} or \highlight[]{} I really don=E2=80=99t know what I prefer. The first means that only the= source and destination need to worry about dealing with new types (the stylesheet can be used unchanged). > about an article ... it would be interesting to combine thsi with a kin= d=20 > of literate programming Yes, that=E2=80=99s true. I used a simple hack to my code written in lit= erate programming into my master=E2=80=99s thesis. It worked quite well actual= ly. I=E2=80=99m sure that this could be combined with the method I used there= . > (if cweb would produce better output then it may have become a bit > more popular) Yes. I see three problems with CWEB: 1. The syntax is too complicated 2. The output is not great 3. The input isn=E2=80=99t compilable in the source programming language What my literate programming system did was allow for embedding comments in the source instead of the other way around (much like how ConTeXt sources are documented). This worked very well actually, especially in the parts of my code that were written in Ruby where one can do things like # =C2=B6 OK, so now that we have all the other methods done, it=E2=80=99s= time to # write our final method \Ruby{method}. It will simply tie together the # other methods found in \Ruby{Class}: def Class.method =E2=8B=AE end (A sequence of comments where the first comment began with a pilcrow sign are processed as stuff to send to ConTeXt and the following code block (basically everything up to the next pilcrow-endowned comment) was set inside a verbatim environment.) Anyway, I=E2=80=99ve attached the Relax-NG schema that I deviced. Tomorr= ow I=E2=80=99m going to work on writing an exporter that exports to this format and a stylesheet that transforms this to ConTeXt code. If I have time I=E2=80=99= ll also try to set up some environment for this and some generic preprocessing directives for texexec. nikolai --=20 Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="syntax-export.rnc" ID.datatype = xsd:ID LanguageCode.datatype = xsd:language id.attrib = attribute id { ID.datatype }? xmlbase.attrib = attribute xml:base { text }? Core.attrib = id.attrib, xmlbase.attrib lang.attrib = attribute xml:lang { LanguageCode.datatype }? I18n.attrib = lang.attrib Common.attrib = Core.attrib, I18n.attrib start = file | line | segment | whitespace file = element file { file.attlist, file.content } file.attlist = Common.attrib, attribute path { text }, attribute type { text } file.content = line* line = element line { line.attlist, line.content } line.attlist = Common.attrib line.content = (segment | whitespace)* segment = element segment { segment.attlist, text } segment.attlist = Common.attrib, attribute type { text } whitespace = element whitespace { whitespace.attlist, empty } whitespace.attlist = Common.attrib --SUOF0GtieIMvvwua Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --SUOF0GtieIMvvwua--