From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/85279 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: EPUB woes Date: Sat, 16 Nov 2013 12:37:42 -0500 (EST) Message-ID: References: <52878C67.90007@meahan.net> <5287A29B.6010302@meahan.net> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-276798713-1384622973=:18673" X-Trace: ger.gmane.org 1384623506 9553 80.91.229.3 (16 Nov 2013 17:38:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 Nov 2013 17:38:26 +0000 (UTC) To: lists@meahan.net, mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Nov 16 18:38:29 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VhjpD-0007Wd-H7 for gctc-ntg-context-518@m.gmane.org; Sat, 16 Nov 2013 18:38:27 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7BD52101FE; Sat, 16 Nov 2013 18:38:26 +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 ptf0jNjob2bW; Sat, 16 Nov 2013 18:38:24 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 2F643101F9; Sat, 16 Nov 2013 18:38:24 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 225A8101F9 for ; Sat, 16 Nov 2013 18:38:23 +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 qJ7RKnLwHKHX for ; Sat, 16 Nov 2013 18:38:21 +0100 (CET) Original-Received: from filter3-utr.mf.surf.net (filter3-utr.mf.surf.net [195.169.124.154]) by balder.ntg.nl (Postfix) with ESMTP id 76357101E3 for ; Sat, 16 Nov 2013 18:38:21 +0100 (CET) Original-Received: from hackers.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.81]) by filter3-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id rAGHcB8T019643 for ; Sat, 16 Nov 2013 18:38:19 +0100 Original-Received: FROM adi-thinkpad.local ((null) [135.0.226.162]) By hackers.mr.itd.umich.edu ID 5287AD68.45043.21782 ; Authuser adityam; 16 Nov 2013 12:37:44 EST In-Reply-To: <5287A29B.6010302@meahan.net> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) Content-ID: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.14.81; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 08KOhCcdv - 514e8e2f888c - 20131116 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.154 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:85279 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-276798713-1384622973=:18673 Content-Type: TEXT/PLAIN; CHARSET=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: On Sat, 16 Nov 2013, Bill Meahan wrote: > I would /expect/ to get a valid EPUB file, or so I'm lead to believe. > > At the moment, I'm simply trying it out using Hans' "export-example.tex" = file=20 > that comes as part of the standard ConTeXt distribution, either Standalon= e or=20 > part of one of the other distributions. I haven't even opened the=20 > export-example.tex file in an editor (yet) in this round of trials and I'= ve=20 > even run the script against it right in the ..../base/ directory where it= is=20 > found in the distribution so I don't understand why it is not producing a= =20 > valid EPUB. Once I've got that sorted out, I can try applying the lessons= =20 > learned to my own documents. ConTeXt provides two types of exports. The first is an XML export.=20 Consider a sample file: ~~~ {test.tex} \setupbackend[export=3Dyes] \starttext \startsection[title=3D{This is a test}] \startparagraph Some random text \startitemize \item First \item Second \stopitemize \stopparagraph \stopsection \stoptext ~~~ Running `context test.tex` generates a `test.export` file that looks as=20 follows: ~~~ {test.export}
1 This is a test Some random text =E2=80=A2First=20 =E2=80=A2Second<= /paragraph>
~~~ which is simply an XML representation of the document. In prinicple, if one adds an appropriate CSS file with that XML, any=20 recent browser will be able to display it. So, if you change the first=20 line of `test.tex` to ~~~ \setupbackend[export=3Dyes, xhtml=3Dyes, css=3Dyes] ~~~ and run `context test.tex`, you will get four additional files:=20 `test.xhtml`, `test-styles.css`, `test-images.css`, and=20 `test.specification`. The `test.xhtml` file look as follows: ~~~{test.xhtml}
1 This is a test Some random text =E2=80=A2First=20 =E2=80=A2Second<= /paragraph>
~~~ Notice that apart from the three lines specifying the CSS files, the rest= =20 of the document is the same as in XML export. The two css files,=20 `test-styles.css` and `test-images.css` include the relevant code for the= =20 style modifications and images in the document. The css file=20 `export-example.css` comes with the ConTeXt distribution and has the=20 default values for most ConTeXt elements. If you open the `test.xhtml` file in any browser, it will work correctly=20 (because an XHTML markup is extensible and can use any XML tags as long as= =20 the behavior of the tag is specified in a CSS file). This is, however, not= =20 a XHTML file that includes the default XHTML markup (

,

,

    ,=20 etc.) Now, lets come back to the last file generated by the export:=20 `test.specification`. This is a lua file that contains: ~~~{test.specification} return { ["files"]=3D{ "test-styles.css", "test-images.css", "export-example.css",= =20 "test.xhtml" }, ["identifier"]=3D"e6a91a13-4e08-9494-3817-bfffe872be2c", ["images"]=3D{}, ["language"]=3D"en", ["name"]=3D"test", ["root"]=3D"test.xhtml", } ~~~~ When you run `mtxrun --script epub --make test`, it just takes the files=20 specificied in the "files" field, and zips them in as a epub file. Now, in principle, any epub reader should support the any XHTML file; in=20 practice, they only support the default XHTML tags. The XML+CSS file that= =20 ConTeXt generates are not handled correctly by most (all?) EPUB readers. So there are three options: 1. Wait until the EPUB readers catch up. It took almost 10-15 years for=20 the browsers to catch up with the HTML standards, and I don't have much=20 hope for EPUB readers here. Last I checked, none of them supported=20 even MATHML-2. 2. Write a script (either using xmlproc, or using you favorite XML parser= =20 in your favorite language) that converts the XML generated by ConTeXt into= =20 a "standard" XHTML file. This is the easiest and the least time consuming= =20 alternative. 3. Modify the way in which ConTeXt generates the XML files. Ideally, I=20 should be able to write something like ~~~ \setupparagraph[tag=3Dp, class=3Ddefault] ~~~ to tell context that \startparagraph ... \stopparagraph should translate=20 to `

    ...

    ". Last I checked the code that generates= =20 the XML file, there was no easy way to change the tags and classes. I hope that the above description clarifies the situation. Aditya --8323329-276798713-1384622973=:18673 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 ___________________________________________________________________________________ --8323329-276798713-1384622973=:18673--