From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/81110 Path: news.gmane.org!not-for-mail From: Philipp Gesang Newsgroups: gmane.comp.tex.context Subject: Re: reStructuredText module Date: Tue, 12 Mar 2013 21:23:55 +0100 Message-ID: <20130312202355.GA8066@phlegethon> References: <513E68B9.4040608@meahan.net> <20130312003116.GA7509@phlegethon> <513F1F60.4020003@meahan.net> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0249875880==" X-Trace: ger.gmane.org 1363119864 18786 80.91.229.3 (12 Mar 2013 20:24:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Mar 2013 20:24:24 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Mar 12 21:24:49 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UFVkb-0003rh-8T for gctc-ntg-context-518@m.gmane.org; Tue, 12 Mar 2013 21:24:45 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 50FA6101E8; Tue, 12 Mar 2013 21:24:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AVkR3G0WsdJk; Tue, 12 Mar 2013 21:24:18 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id AA608101E3; Tue, 12 Mar 2013 21:24:18 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 5156C101E3 for ; Tue, 12 Mar 2013 21:24:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id HrzncE8ldzk9 for ; Tue, 12 Mar 2013 21:24:15 +0100 (CET) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id A75FD101E2 for ; Tue, 12 Mar 2013 21:24:15 +0100 (CET) Original-Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by filter2-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r2CKO5KZ016069 for ; Tue, 12 Mar 2013 21:24:10 +0100 Original-Received: from ix.urz.uni-heidelberg.de (cyrus-portal.urz.uni-heidelberg.de [129.206.100.176]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id r2CKO3Rh022567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Mar 2013 21:24:04 +0100 Original-Received: from extmail.urz.uni-heidelberg.de (extmail.urz.uni-heidelberg.de [129.206.100.140]) by ix.urz.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r2CKO38b017572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Mar 2013 21:24:03 +0100 Original-Received: from localhost (p508466BA.dip.t-dialin.net [80.132.102.186]) (authenticated bits=0) by extmail.urz.uni-heidelberg.de (8.13.4/8.13.1) with ESMTP id r2CKO2pO030560 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 12 Mar 2013 21:24:02 +0100 Mail-Followup-To: mailing list for ConTeXt users In-Reply-To: <513F1F60.4020003@meahan.net> X-Operating-System: Linux phlegethon 3.7.9-2-ARCH User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=129.206.100.212; country=DE; region=01; city=Heidelberg; postalcode=69115; latitude=49.4167; longitude=8.7000; http://maps.google.com/maps?q=49.4167,8.7000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0TJaIo5mp - c685f40b5cc3 - 20130312 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:81110 Archived-At: --===============0249875880== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="liOOAslEiF7prFVr" Content-Disposition: inline --liOOAslEiF7prFVr Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7 > Philipp Gesang wrote: > >=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7 > >>Am I correct in thinking the rst module does not process the "class" > >>and "container" directives? > >When I wrote the module I was working with the reST spec [0] and > >the syntax reference [1]. It=E2=80=99s been a while, but afair I > >implemented the spec completely (with the limitations described > >in the manual). It does not, to my knowledge, define the > >directives you mention and I don=E2=80=99t know what they=E2=80=99re sup= posed to > >do. > > > >(Btw. like much of the spec, =E2=80=9Ccontainer=E2=80=9D and =E2=80=9Ccl= ass=E2=80=9D sound > >suspiciously HTML-specific. If that is true, they address one > >output markup which happens to be -- not Context! I might find > >the time to add a simple wrapper for the container thingy (to > >boxes or framed?). However, I doubt that it=E2=80=99s possible to > >replicate the behavior of HTML divs + CSS without a larger effort > >[2]. In this case it might be preferable to have docutils > >generate some XML and directly typeset the result with Context.) > > > >Best regards > >Philipp >=20 > The .class and .container direectives are certainly there with *ML in min= d but I think there might be analog situatins in ConTeXt. >=20 > .. class:: classname >=20 > blah, blah, blah >=20 > exists to stick a class name on the following element for styling with an= external stylesheet of some sort. CSS/CSS3 are probably the primary examle= s but other XML-bases markus apply just as well >=20 > .. class::classname >=20 > blab, blab, blab >=20 > could yield >=20 >

blab, blab, blab

>

blab. blab, blab

>=20 > or anything else that can take a class name attribute. =46rom its description [0], the =E2=80=9Cclass=E2=80=9D directive appears t= o be next to meaningless outside an HTML context. It=E2=80=99s supposed to set =E2=80=9Cclasses=E2=80=9D. The doctree spec [1] explicitly states that =E2= =80=9CThe classes attribute's contents should be ignorable.=E2=80=9D To my knowledge, the closest thing in Context to CSS classes is the =E2=80=9Csetups=3D=E2=80=9D parameter. All macros don=E2=80=99t accept = it, though, so I can=E2=80=99t think of a general way of handling it. The list of macros where it applies would have to be hardcoded ... Docutils=E2=80=99 latex2 writer -- the reference implementation, mind you -- btw. doesn=E2=80=99t take the =E2=80=9Cclass=E2=80=9D directive seri= ously at all: it handles paragraphs but ignores it e.g. for section heads. > .. container:: containername >=20 > Foo, bar, baz >=20 > bunch of stuff >=20 > yields >=20 >
>=20 > foo, bar, baz >=20 > bunch of stuff >=20 >
>=20 > .. container:: probably maps to something like > \frame[containername] > although frames as such cannot cross page boundaries. Perhaps > there is (or could be) a more suitable construct. I'm trying to > be exemplary not directive. :) Fyi [2]: =E2=80=9Ccontainer=E2=80=9D is docutils for =E2=80=9Cdiv=E2=80=9D.= How=E2=80=99s a =E2=80=9Cdiv=E2=80=9D supposed to look? That depends on your browser (not the spec!), and the HTML version being used (XHTML 1.1 for python2-docutils). What does that mean for non-HTML targets? Apparently nothing: again, docutils ignore the directive when writing LaTeX (and man pages, for that matter). Nevertheless, I added some code to handle container directives: at the moment they simply map to macros of the same name. Existence of the macro is tested for at runtime, so you can place the definitions in your preamble. Example: =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=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C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7= =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7 \startparagraph This is a paragraph. \stopparagraph \ifcsname xyzzy\endcsname% \csname xyzzy\endcsname% {whatever foo {\sc bar} baz}% \else {whatever foo {\sc bar} baz}% \fi \startparagraph This is another paragraph. \stopparagraph =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7= =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7= =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2= =B7=C2=B7=C2=B7 So if there=E2=80=99s no \xyzzy, the contents are treated as a simple group. Unnamed containers default to \framed. Let me know what you think. The code is at: https://bitbucket.org/phg/context-rst/get/0df50df9c8fb.zip > ConTeXt environment files are certainly analogus to CSS files and are use= d with the same end goals in mind. >=20 > "styling" markup elements through "class=3D" or equivalent is > rapidly becoming the order of the day for a wide variety of > documents. Certainly (X)HTML, epub2, epub3, ODT, DOCX and an > increasing horde of others are either there or heading there very > soon. Sure. I have no problem with that as long as it stays implementation-agnostic. Thanks for the feedback. Philipp [0] http://docutils.sourceforge.net/docs/ref/rst/directives.html#class [1] http://docutils.sourceforge.net/docs/ref/doctree.html#classes [2] http://docutils.sourceforge.net/docs/ref/rst/directives.html#container >=20 --=20 () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments --liOOAslEiF7prFVr Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlE/jtsACgkQ02lYlJYWs9ITsQCeKc696q31qbLXQJcJpIQDaJeR K/cAnjQ4qQKaCzKHWOHA3SezqMbtNLXE =Pyl3 -----END PGP SIGNATURE----- --liOOAslEiF7prFVr-- --===============0249875880== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============0249875880==--