[NTG-context] wikimedia2context: any existing solutions?

Khaled Hosny khaledhosny at eglug.org
Wed Mar 30 17:16:30 CEST 2011


On Wed, Mar 30, 2011 at 04:47:07PM +0200, Mojca Miklavec wrote:
> Hello,
> 
> Before I start reinvinting the wheel ... I have a feeling that some
> people were already doing some basic wikimedia2context syntax
> conversion.
> 
> I would like to create PDF out of some wiki pages with very limited
> number of used commands. I have created a simple ruby script that
> fetches all the contents that I want in the final PDF, all that is
> left to be done is conversion from wiki to tex syntax:
> - replace =...= with \section{...}, ==...== with \subsection{...},
> ===...=== with \subsubsection{...}, ...
> - replace ''...'' with {\bf ...}, '''...''' with {\it ...},
> '''''...''''' with {\bi ...}
> - all lines starting with a space should be printed verbatim
> - lines starting with * should be bulleted itemize
> - lines starting with # should be numbered itemize
> - some trivial replacements like >
> - some links: [[abc def]] should become symlinks to begining of
> sections with that title
> - [[Image:chap1-f2.jpg|frame|Figure 1.2: Cylindrical scanner]] should
> become \placefigure{Cylindrical
> scanner}{\externalfigure[chap1-f2.jpg]}
> - a few tables

If you are comfortable with writing PEG grammar (I'm not), writing a
mediawiki parser for luanamark[1] might be a good choice, it has a
ConTeXt writer already (and markdown parser).

I pet pandoc have mediawiki support as well, so you may try it.

[1] https://github.com/jgm/lunamark

Regards,
 Khaled

-- 
 Khaled Hosny
 Egyptian
 Arab


More information about the ntg-context mailing list