]> pere.pagekite.me Git - homepage.git/blobdiff - blog/index.rss
Generated.
[homepage.git] / blog / index.rss
index 63c588c714aa2ba5250f000e114efaace0d61210..12f1ce1906a9cba837e281967602c90d3d0cc8df 100644 (file)
@@ -6,6 +6,130 @@
                 <link>http://people.skolelinux.org/pere/blog/</link>
                 <atom:link href="http://people.skolelinux.org/pere/blog/index.rss" rel="self" type="application/rss+xml" />
        
+       <item>
+               <title>Typesetting a short story using docbook for PDF, HTML and EPUB</title>
+               <link>http://people.skolelinux.org/pere/blog/Typesetting_a_short_story_using_docbook_for_PDF__HTML_and_EPUB.html</link>
+               <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Typesetting_a_short_story_using_docbook_for_PDF__HTML_and_EPUB.html</guid>
+                <pubDate>Sun, 24 Mar 2013 17:30:00 +0100</pubDate>
+               <description>&lt;p&gt;A few days ago, during a discussion in
+&lt;a href=&quot;http://www.efn.no/&quot;&gt;EFN&lt;/a&gt; about interesting books to read
+about copyright and the data retention directive, a suggestion to read
+the 1968 short story Kodémus by
+&lt;a href=&quot;http://web2.gyldendal.no/toraage/&quot;&gt;Tore Åge Bringsværd&lt;/a&gt;
+came up.  The text was only available in old paper books, and thus not
+easily available for current and future generations.  Some of the
+people participating in the discussion contacted the author, and
+reported back 2013-03-19 that the author was OK with releasing the
+short story using a &lt;a href=&quot;http://www.creativecommons.org/&quot;&gt;Creative
+Commons&lt;/a&gt; license.  The text was quickly scanned and OCR-ed, and we
+were ready to start on the editing and typesetting.&lt;/p&gt;
+
+&lt;p&gt;As I already had some experience formatting text in my project to
+provide a Norwegian version of the Free Culture book by Lawrence
+Lessig, I chipped in and set up a
+&lt;a href=&quot;http://www.docbook.org/&quot;&gt;DocBook&lt;/a&gt; processing framework to
+generate PDF, HTML and EPUB version of the short story.  The tools to
+transform DocBook to different formats are already in my Linux
+distribution of choice, &lt;a href=&quot;http://www.debian.org/&quot;&gt;Debian&lt;/a&gt;, so
+all I had to do was to use the
+&lt;a href=&quot;http://dblatex.sourceforge.net/&quot;&gt;dblatex&lt;/a&gt;,
+&lt;a href=&quot;http://docbook.sourceforge.net/release/xsl/current/epub/README&quot;&gt;dbtoepub&lt;/a&gt;
+and &lt;a href=&quot;https://fedorahosted.org/xmlto/&quot;&gt;xmlto&lt;/a&gt; tools to do the
+conversion.  After a few days, we decided to replace dblatex with
+xsltproc/fop (aka
+&lt;a href=&quot;http://wiki.docbook.org/DocBookXslStylesheets&quot;&gt;docbook-xsl&lt;/a&gt;),
+to get the copyright information to show up in the PDF and to get a
+nicer &amp;lt;variablelist&amp;gt; typesetting, but that is just a minor
+technical detail.&lt;/p&gt;
+
+&lt;p&gt;There were a few challenges, of course.  We want to typeset the
+short story to look like the original, and that require fairly good
+control over the layout.  The original short story have three
+parts/scenes separated by a single horizontally centred star (*), and
+the paragraphs do not contain only flowing text, but dialogs and text
+that started on a new line in the middle of the paragraph.&lt;/p&gt;
+
+&lt;p&gt;I initially solved the first challenge by using a paragraph with a
+single star in it, ie &amp;lt;para&amp;gt;*&amp;lt;/para&amp;gt;, but it made sure a
+placeholder indicated where the scene shifted.  This did not look too
+good without the centring.  The next approach was to create a new
+preprocessor directive &amp;lt;?newscene?&amp;gt;, mapping to &quot;&amp;lt;hr/&amp;gt;&quot;
+for HTML and &quot;&amp;lt;fo:block text-align=&quot;center&quot;&amp;gt;&amp;lt;fo:leader
+leader-pattern=&quot;rule&quot; rule-thickness=&quot;0.5pt&quot;/&amp;gt;&amp;lt;/fo:block&amp;gt;&quot;
+for FO/PDF output (did not try to implement this in dblatex, as we had
+switched at this time).  The HTML XSL file looked like this:&lt;/p&gt;
+
+&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
+&amp;lt;?xml version=&#39;1.0&#39;?&amp;gt; 
+&amp;lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&#39;1.0&#39;&amp;gt;
+  &amp;lt;xsl:template match=&quot;processing-instruction(&#39;newscene&#39;)&quot;&amp;gt;
+    &amp;lt;hr/&amp;gt;
+  &amp;lt;/xsl:template&amp;gt;
+&amp;lt;/xsl:stylesheet&amp;gt; 
+&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
+
+&lt;p&gt;And the FO/PDF XSL file looked like this:&lt;/p&gt;
+
+&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
+&amp;lt;?xml version=&#39;1.0&#39;?&amp;gt; 
+&amp;lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&#39;1.0&#39;&amp;gt;
+  &amp;lt;xsl:template match=&quot;processing-instruction(&#39;newscene&#39;)&quot;&amp;gt;
+    &amp;lt;fo:block text-align=&quot;center&quot;&amp;gt;
+      &amp;lt;fo:leader leader-pattern=&quot;rule&quot; rule-thickness=&quot;0.5pt&quot;/&amp;gt;
+    &amp;lt;/fo:block&amp;gt;
+  &amp;lt;/xsl:template&amp;gt;
+&amp;lt;/xsl:stylesheet&amp;gt; 
+&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
+
+&lt;p&gt;Finally, I came across the &amp;lt;bridgehead&amp;gt; tag, which seem to be
+a good fit for the task at hand, and I replaced &amp;lt;?newscene?&amp;gt;
+with &amp;lt;bridgehead&amp;gt;*&amp;lt;/bridgehead&amp;gt;.  It isn&#39;t centred, but we
+can fix it with some XSL rule if the current visual layout isn&#39;t
+enough.&lt;/p&gt;
+
+&lt;p&gt;I did not find a good DocBook compliant way to solve the
+linebreak/paragraph challenge, so I ended up creating a new processor
+directive &amp;lt;?linebreak?&amp;gt;, mapping to &amp;lt;br/&amp;gt; in HTML, and
+&amp;lt;fo:block/&amp;gt; in FO/PDF.  I suspect there are better ways to do
+this, and welcome ideas and patches on github.  The HTML XSL file now
+look like this:&lt;/p&gt;
+
+&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
+&amp;lt;?xml version=&#39;1.0&#39;?&amp;gt; 
+&amp;lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&#39;1.0&#39;&amp;gt;
+  &amp;lt;xsl:template match=&quot;processing-instruction(&#39;linebreak)&quot;&amp;gt;
+    &amp;lt;br/&amp;gt;
+  &amp;lt;/xsl:template&amp;gt;
+&amp;lt;/xsl:stylesheet&amp;gt; 
+&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
+
+&lt;p&gt;And the FO/PDF XSL file looked like this:&lt;/p&gt;
+
+&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
+&amp;lt;?xml version=&#39;1.0&#39;?&amp;gt; 
+&amp;lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&#39;1.0&#39;
+  xmlns:fo=&quot;http://www.w3.org/1999/XSL/Format&quot;&amp;gt;
+  &amp;lt;xsl:template match=&quot;processing-instruction(&#39;linebreak)&quot;&amp;gt;
+    &amp;lt;fo:block/&amp;gt;
+  &amp;lt;/xsl:template&amp;gt;
+&amp;lt;/xsl:stylesheet&amp;gt; 
+&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
+
+&lt;p&gt;One unsolved challenge is our wish to expose different ISBN numbers
+per publication format, while keeping all of them in some conditional
+structure in the DocBook source.  No idea how to do this, so we ended
+up listing all the ISBN numbers next to their format in the colophon
+page.&lt;/p&gt;
+
+&lt;p&gt;If you want to check out the finished result, check out the
+&lt;a href=&quot;https://github.com/sickel/kodemus&quot;&gt;source repository at
+github&lt;/a&gt;
+(&lt;a href=&quot;https://github.com/EFN/kodemus&quot;&gt;future/new/official
+repository&lt;/a&gt;).  We expect it to be ready and announced in a few
+days.&lt;/p&gt;
+</description>
+       </item>
+       
        <item>
                <title>Regjeringen, FAD og DIFI går inn for å fjerne ODF som obligatorisk standard i det offentlige</title>
                <link>http://people.skolelinux.org/pere/blog/Regjeringen__FAD_og_DIFI_g_r_inn_for___fjerne_ODF_som_obligatorisk_standard_i_det_offentlige.html</link>
@@ -620,90 +744,5 @@ map you can just edit the
 </description>
        </item>
        
-       <item>
-               <title>&quot;Electronic&quot; paper invoices - using vCard in a QR code</title>
-               <link>http://people.skolelinux.org/pere/blog/_Electronic__paper_invoices___using_vCard_in_a_QR_code.html</link>
-               <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/_Electronic__paper_invoices___using_vCard_in_a_QR_code.html</guid>
-                <pubDate>Tue, 12 Feb 2013 10:30:00 +0100</pubDate>
-               <description>&lt;p&gt;Here in Norway, electronic invoices are spreading, and the
-&lt;a href=&quot;http://www.anskaffelser.no/e-handel/faktura&quot;&gt;solution promoted
-by the Norwegian government&lt;/a&gt; require that invoices are sent through
-one of the approved facilitators, and it is not possible to send
-electronic invoices without an agreement with one of these
-facilitators.  This seem like a needless limitation to be able to
-transfer invoice information between buyers and sellers.  My preferred
-solution would be to just transfer the invoice information directly
-between seller and buyer, for example using SMTP, or some HTTP based
-protocol like REST or SOAP.  But this might also be overkill, as the
-&quot;electronic&quot; information can be transferred using paper invoices too,
-using a simple bar code.  My bar code encoding of choice would be QR
-codes, as this encoding can be read by any smart phone out there.  The
-content of the code could be anything, but I would go with
-&lt;a href=&quot;http://en.wikipedia.org/wiki/VCard&quot;&gt;the vCard format&lt;/a&gt;, as
-it too is supported by a lot of computer equipment these days.&lt;/p&gt;
-
-&lt;p&gt;The vCard format support extentions, and the invoice specific
-information can be included using such extentions.  For example an
-invoice from SLX Debian Labs (picked because we
-&lt;a href=&quot;http://www.linuxiskolen.no/slxdebianlabs/donations.html&quot;&gt;ask
-for donations to the Debian Edu project&lt;/a&gt; and thus have bank account
-information publicly available) for NOK 1000.00 could have these extra
-fields:&lt;/p&gt;
-
-&lt;p&gt;&lt;pre&gt;
-X-INVOICE-NUMBER:1
-X-INVOICE-AMOUNT:NOK1000.00
-X-INVOICE-KID:123412341234
-X-INVOICE-MSG:Donation to Debian Edu
-X-BANK-ACCOUNT-NUMBER:16040884339
-X-BANK-IBAN-NUMBER:NO8516040884339
-X-BANK-SWIFT-NUMBER:DNBANOKKXXX
-&lt;/pre&gt;&lt;/p&gt;
-
-&lt;p&gt;The X-BANK-ACCOUNT-NUMBER field was proposed in a stackoverflow
-answer regarding
-&lt;a href=&quot;http://stackoverflow.com/questions/10045664/storing-bank-account-in-vcard-file&quot;&gt;how
-to put bank account information into a vCard&lt;/a&gt;.  For payments in
-Norway, either X-INVOICE-KID (payment ID) or X-INVOICE-MSG could be
-used to pass on information to the seller when paying the invoice.&lt;/p&gt;
-
-&lt;p&gt;The complete vCard could look like this:&lt;/p&gt;
-
-&lt;p&gt;&lt;pre&gt;
-BEGIN:VCARD
-VERSION:2.1
-ORG:SLX Debian Labs Foundation
-ADR;WORK:;;Gunnar Schjelderups vei 29D;OSLO;;0485;Norway
-URL;WORK:http://www.linuxiskolen.no/slxdebianlabs/
-EMAIL;PREF;INTERNET:sdl-styret@rt.nuug.no
-REV:20130212T095000Z
-X-INVOICE-NUMBER:1
-X-INVOICE-AMOUNT:NOK1000.00
-X-INVOICE-MSG:Donation to Debian Edu
-X-BANK-ACCOUNT-NUMBER:16040884339
-X-BANK-IBAN-NUMBER:NO8516040884339
-X-BANK-SWIFT-NUMBER:DNBANOKKXXX
-END:VCARD
-&lt;/pre&gt;&lt;/p&gt;
-
-&lt;p&gt;The resulting QR code created using
-&lt;a href=&quot;http://fukuchi.org/works/qrencode/&quot;&gt;qrencode&lt;/a&gt; would look
-like this, and should be readable (and thus checkable) by any smart
-phone, or for example the &lt;a href=&quot;http://zbar.sourceforge.net/&quot;&gt;zbar
-bar code reader&lt;/a&gt; and feed right into the approval and accounting
-system.&lt;/p&gt;
-
-&lt;p&gt;&lt;img src=&quot;http://people.skolelinux.org/pere/blog/images/2013-02-12-qr-invoice.png&quot;&gt;&lt;/p&gt;
-
-&lt;p&gt;The extension fields will most likely not show up in any normal
-vCard reader, so those parts would have to go directly into a system
-handling invoices.  I am a bit unsure how vCards without name parts
-are handled, but a simple test indicate that this work just fine.&lt;/p&gt;
-
-&lt;p&gt;&lt;strong&gt;Update 2013-02-12 11:30&lt;/strong&gt;: Added KID to the proposal
-based on feedback from Sturle Sunde.&lt;/p&gt;
-</description>
-       </item>
-       
         </channel>
 </rss>