|
Some experience reports on how we generate web pages and PDF documents from simple and yet expressive and extensive plain source text using a Ruby based programming library. What role should Deplate play in our data processing system? |
|
Table of Contents
1 Situation – Why Deplate?Deplate is a central part of our production system and we have created an RPM package as well as a set of macros for it. At A2E.de and FFII.org we used to write web pages in
The former was easy to use but very limited in its capabilities, e.g. unable to produce good PDF output. The latter required too much learning for most people and became bloated over time. Using wikis directly was also not an alternative, because
We have found Apache Forrest an web-based document managment system to be quite close to what we need. However, to really be able to tailor Forrest to our more complex needs, we will need to work in the Cocoon framework. While this looks powerful, it may well, in some respects, be less powerful than the shell environment, in which the Makefiles operate which currently are used to generate our object documents. We can not know when we will master the Cocoon/Forrest framework well enough to be confident to migrate content to it on a large scale. We know the limitations of XML/SGML/XSL. We moreover can not be sure that the FO project will produce a full-value replacement for LaTeX. Deplate works in our shell-based production environment. It produces high-quality PDF files through LaTeX. It has capabilities for extension which are similar to the lisp-based system which we used. Beginners can immediately feel confident to edit the source texts. At least for mainly static websites, Deplate seems to provide the best of our previously separate worlds. It surpasses all the other text converters which we have tried, and it can be conveniently extended with a very powerful language. Combinability with PHP and similar languages (e.g. Embperl, Eruby) for dynamic content is also quite good. It is fairly trivial to set up a wiki-like webform input system which uses Deplate as its backend. 2 Problems and SolutionsTo be worked out, see also the Deplate documentation and forum. 2.1 Deplate inserts unwanted linebreaksWhen converting long lines to input for LaTeX and HTML, Deplate inserts linebreaks. This is not needed and the results can contravene the intentions of the author. In some cases of cumulated macros execution, several linefeeds are inserted in one place so that a paragraph break is created which will lead not only to unwanted results but sometimes also to failure of LaTeX compilation. I encountered an example of this in this document when trying to insert a footnote which was supposed to point to a local copy, using a macro for the reference (hyperlink). The phrase ‘lokale Kopie’ was split and a paragraph boundary inserted in the middle. Also, in the Quote region long lines are split according to Deplate’s rules, and the linebreaks are doubled, as can be observed from the Quote of Borsellino on that same page. Deplate should leave wrapping and typesetting to LaTeX. My temporary solution is to avoid the Quote region and certain cumulations of macros. Another solution is to patch Deplate so as to disable the invocation of The author encourages this approach. Moreover, the author hints that setting the variable wrapMargin to 0 may also do the job. We’ve integrated this into the default template in our hypertext generation system. Currently our RPM package does not contain the patch because we haven’t figured out how to patch a Ruby gem. 2.2 LaTeX inputWe have written a pre-processor to make up for some of the insufficiencies of current multibyte (CJK) utf8-based text processing. Without this pre-processor, which is invoked by our Makefile system, LaTeX would not compile the deplate output. The preprocessor also makes up for non-functioning of the 2.2.1 heading=plain does not work for LaTeXThe LaTeX output still has numbered headings even if this variable is set #VAR: headings = plain in the source text. This can be compensated by simple postprocessing. 2.2.2 LaTeX tables buggyDeplate has a very intuitive source format for tables which works great for HTML but not only to a limited extent for LaTeX. Bugs, to be documented in more detail, include the following
2.3 Reduced Capability of Regions in 0.8.1In certain self-defined regions, such as BlogRek as defined in etc/lib/blog.dpl, starting from v 0.8.1, the macros of my mod/a2e.rb package were no longer accessible when I switched from Deplate V 0.8 to 0.8.1. This needs further research. My temporary solution is to use the Perl Template Toolkit for the macro programming for which I previously used Deplate. 2.4 Macro Programming LanguageThe documentation seems very sparse on this subject. You have to learn by a lot of trying and even poking at source code. 2.5 Development processThe sources are in a CVS archive. Subversion would be better nowadays. 2.6 Site-wide configurationI’d like to put configuration files for Deplate into /etc/deplate/, not just ~/.deplate/. As far as I can see from the documentation, this is not possible at the moment. 2.7 Variable settings in deplate.iniThe documentation at http://deplate.sourceforge.net/Variables.html doesn’t seem to give any examples of how the listed variables are actually set. Nor does the file deplate.ini itself. E.g. it says ; encoding :: The default encoding; dependent on the output format (STRING) ; HTML :: ISO-8859-1 ; LaTeX :: latin1 ; XML :: UTF-8 Now is the following OK encoding = 'utf-8' or the following encoding html='utf-8' I find no hint in the docs. 2.8 Literary ProgrammingI’d like to write programs as deplate source documents, such that the program code is placed in special regions which are extracted when compiling the document. Currently this can be done with the Write macro, but I can’t combine this macro with anything else. Once I write text into a file, it is lost in that file and I can only insert the file later with another command. I can’t chose to both write to the file and display the text in a certain form at the same time. 3 Resources
4 To Do4.1 Learning, Adaptionsee Deplate Macros dossier. 4.2 Future Extension WorkIn some cases we can hopefully write clear specifications first and then pay someone to do the programming:
5 Chronology
|
|