org-export-as-blosxom-story Programming Notes <p>I like to use GNU Emacs's org mode for simply formatted text files. However, the vanilla configuration of the Blosxom blogging engine renders everything after the first line title as one run-together paragraph. I have tried adapting more than one Blosxom formatting plugin to make org files minimally attractive, but without success. I have decided to take another approach by exploiting the HTML generation capability already in org mode. </p> <div id="outline-container-1" class="outline-4"> <h4 id="sec-1">Purpose</h4> <div class="outline-text-4" id="text-1"> <p> Convert org files to Blosxom story format. </p> </div> </div> <div id="outline-container-2" class="outline-4"> <h4 id="sec-2">Advantages</h4> <div class="outline-text-4" id="text-2"> <ul> <li>Uses existing org mode functionality. </li> <li>Avoids ad hoc programming in Blosxom plugins. </li> <li>Saves page rendering time for Web viewers. </li> </ul> </div> </div> <div id="outline-container-3" class="outline-4"> <h4 id="sec-3">Disadvantages</h4> <div class="outline-text-4" id="text-3"> <ul> <li>Maintaining separate org and story files doubles required storage. </li> <li>Must rename all org files to *.org. </li> </ul> </div> </div> <div id="outline-container-4" class="outline-4"> <h4 id="sec-4">Existing functions</h4> <div class="outline-text-4" id="text-4"> <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"> <colgroup><col class="left" /><col class="left" /> </colgroup> <thead> <tr><th scope="col" class="left">org-export-as-html</th><th scope="col" class="left">Export and overwrite <filename>.html.</th></tr> <tr><th scope="col" class="left"></th><th scope="col" class="left">Master function for org-to-HTML export.</th></tr> </thead> <tbody> <tr><td class="left">org-export-as-html-to-buffer</td><td class="left">Export to buffer. Calls org-export-as-html.</td></tr> </tbody> <tbody> <tr><td class="left">org-export-region-as-html</td><td class="left">Export region to buffer.</td></tr> <tr><td class="left"></td><td class="left">Prefix arg. causes org header and</td></tr> <tr><td class="left"></td><td class="left">footer to be omitted.</td></tr> <tr><td class="left"></td><td class="left">Calls. org-export-as-html.</td></tr> </tbody> <tbody> <tr><td class="left">org-replace-region-by-html</td><td class="left">EUREKA!</td></tr> <tr><td class="left"></td><td class="left">HTMLizes ALL text in region without header</td></tr> <tr><td class="left"></td><td class="left">or footer.</td></tr> <tr><td class="left"></td><td class="left">Perfect export for Blosxom if region</td></tr> <tr><td class="left"></td><td class="left">set from second line of file (to exclude</td></tr> <tr><td class="left"></td><td class="left">title) to end of file.</td></tr> </tbody> </table> <p> Org export functions ignore text before first heading unless variable org-export-skip-text-before-1st-heading is nil. However, text before first heading is exported as-is without HTML tags inserted. </p> <p> (org-replace-region-by-html has problems on Zaurus. Need to update org mode software?) </p> </div> </div> <div id="outline-container-5" class="outline-4"> <h4 id="sec-5">Org file format</h4> <div class="outline-text-4" id="text-5"> <ol> <li>First line is story title in plain text. </li> <li>Second and succeeding lines are story body with org mode markup inserted as desired. </li> </ol> </div> </div> <div id="outline-container-6" class="outline-4"> <h4 id="sec-6">Blosxom story format</h4> <div class="outline-text-4" id="text-6"> <ol> <li>First line is story title in plain text. </li> <li>Second and succeeding lines are story body, which may optoonally be formatted with HTML tags. </li> </ol> </div> </div> <div id="outline-container-7" class="outline-4"> <h4 id="sec-7">Tricks</h4> <div class="outline-text-4" id="text-7"> <p> Problem: When org export doesn't ignore text before first heading, it considers it to be part of the document header, and therefore omits it when exporting "body-only". </p> <p> Solution: Insert a null org heading "* " on line after story title during export processing. This will generate a "body" division containing all text between the title and first actual heading with an empty heading that won't be displayed. (Will not need to process "initial text" as such since all text before first explicit hading will be under dummy preamble heading.) </p> <p> Problem: org-replace-region-by-html converts <, > to &lt;, &gt;, so defeats more plugin. </p> <p> Solution: Lines starting with "#+HTML:" are exported verbatim without conversion. </p> </div> </div>