#2296: Export wiki pages to latex
--------------------------+-------------------------------------------------
 Reporter:  [EMAIL PROTECTED]  |        Owner:  athomas 
     Type:  enhancement   |       Status:  assigned
 Priority:  normal        |    Milestone:          
Component:  wiki          |      Version:  devel   
 Severity:  normal        |   Resolution:          
 Keywords:  converter     |  
--------------------------+-------------------------------------------------
Comment (by Trent Apted <[EMAIL PROTECTED]>):

 I've done some refinements to [attachment:wikilatex.3.py wikilatex.py]. To
 be honest, I am still essentially hacking -- I'm not yet familiar with
 inner-workings of Trac. When I have some more time I'll delve in to the
 Trac code, cleanup this stuff and see how this should fit in with the
 proposed IMIMETypeConverter.

 Some comments on the LaTeX converter, as it currently stands (with
 reference to [attachment:WikiFormatting.pdf]):
  * I think the typeset stuff looks pretty good
    * but I'm biased -- does anyone else have an opinion?
  * Keep in mind that the current idea is that each wiki page exported will
 probably be incorporated into some larger document
    * However, this should be an option flag to be passed '''''somehow'''''
 to the exporter
    * cgi request? LaTeX conversion staging page?
    * Hence:
  * Handling section/subsection/subsubesction
    * Currently the page ''name'' is put into the \section{} at the start,
 but convention might mean that this is not right
    * Maybe we should rely on the wiki page to have a =Heading= at the
 start, to be promoted to \section{}
    * Otherwise =h1= now maps to \subsection{}, ==h2== to \subsubsection{}
 and >= ===h3=== to \subsubsection*{}
  * Handling hyperlinks
    * since the Wiki is inherently hyperlinked, it makes sense to carry
 this over to the PDF
    * hence, hyperref is now part of the preamble, with some sensible
 options set
      * pdfauthor could be set to the login ID, perhaps (pass in context..)
    * Wiki links obviously cannot be resolved until the all-in-one document
 is generated (so they come up as \S{}??), but otherwise work, and are
 clickable thanks to hyperref
    * To dileneate links in the printed version, they are currently
 underlined (but this is easily changed by tweaking the \anchortext command
 in the preamble)
    * If it is something other than an automatic CamelCase or
 http://www.example.com link, then a footnote is also created, showing
 where the link goes
    * If we _know_ hyperref is going to be used (currently it does not rely
 on any specials in the hyperref package -- it just overrides builtins to
 make links in the PDF), then the \anchortext{} command could be adjusted
 to accept an [optional] argument to make the actual anchortext an active
 link (but we should probably still do the footnote method for the printed
 version)
  * ... about that preamble (see [attachment:WikiFormatting.tex])
    * OK, so this is meant to be part of a larger document, so there should
 only be one preamble
    * But it's easy to delete a preamble (harder to make up your own), and
 this should help latex n00bs that just want a PDF
    * If this later goes the route required for #2207, individual preambles
 can probably be stripped automatically
  * line separation of list items
    * the default in LaTeX has quite a large spacing between list items,
 which is maybe not what people expect
    * this can be adjusted in the preamble..
  * Tickets
    * I've written a nice way of showing tickets for Trac v0.8 (which is
 what is running on a legacy system for students at my university), but the
 way tickets are handled in the formatter has changed quite drastically to
 v0.9
    * So this hasn't yet been implemented in the attached wikilatex.py (and
 acutally causes some unicode freakout that I don't fully understand at
 this point)
    * Same goes for reports and revision logs
  * Images
    * obviously, the Image cannot be embedded in the LaTeX, but we can make
 a figure float for .{png,jpeg,gif,etc} links (not yet implemented)
    * this required the image to be downloaded separately and put somewhere
 that pdflatex can find it (I wouldn't recommend /usr/bin/latex or dvipdfm
 because they want images in eps format, and would need to be converted)
    * At some point there will need to be a 'LaTeX' flavour of the Image
 macro
  * Quotes
    * double quote characters (") are TeXified to {{{``}}} or {{{''}}},
 according to a regex
  * Oneliners
    * not yet properly implemented, but probably similar to the method for
 Wiki/HTML
  * Tables
    * Tables in LaTeX are represented radically different to HTML (and are
 crap, quite frankly)
      * e.g. you need a column desciption before the table starts, with
 number of columns, etc.
    * The current implementation is a hack, but behaves most of the time
  * WikiProcessors
    * currently these are all dumped in a \verbatim{} environment
  * WikiMacros
    * PageOutline is converted to \tableofcontents{}
    * BR/br is converted to \\ (or \vspace{1em} if "there is no line to
 end")
    * Others are rendered in HTML, then the HTML code is put in a
 \verbatim{} environment (see, e.g. Timestamp in
 [attachment:WikiFormating.pdf]
  * subscript/superscript
    * These are implemented using math mode, making them very sensitive for
 anything much more complicated than plain text
  * The Implementation
    * probably needs cleaning up
    * needs a more rigourous approach to escaping of LaTeX specials like %,
 _, #, $, etc.
  * The Future
    * Math formulae using LaTeX
      * This is suggested on [http://trac-hacks.org/wiki/LatexFormulaMacro
 TracHacks]
      * Perhaps an opportunity to test the MIME detection/flavours for
 Macros..
      * But the suggested solution on TracHacks is not very clean at the
 moment
    * Testing
      * This probably needs a test suite, which would be markedly different
 to the one for the HTML Wiki, testing handling of LaTeX specials, etc.
    * Unicode
      * LaTeX does not like unicode, the preferred way to do &eacute;, for
 example is {{{ \'{e} }}}, but there is no solid mapping between unicode
 and LaTeX escapes like this -- currently if unicode is encountered, a
 exception is raised (not deliberately.. some other bug is at work here),
 and the line is output as <bad unicode on this line> or similar

 - Trent.

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2296>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to