ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Khaled Hosny <khaledhosny@eglug.org>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: wikimedia2context: any existing solutions?
Date: Wed, 30 Mar 2011 17:16:30 +0200	[thread overview]
Message-ID: <20110330151629.GA18420@khaled-laptop> (raw)
In-Reply-To: <AANLkTinQin5k7SoeSpFBL6JQYRcGcg01n8YpvPwcCrFH@mail.gmail.com>

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 &gt;
> - 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2011-03-30 15:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30 14:47 Mojca Miklavec
2011-03-30 15:16 ` Khaled Hosny [this message]
2011-03-30 17:32   ` Mojca Miklavec
2011-03-30 17:38     ` Aditya Mahajan
2011-03-30 18:44     ` Khaled Hosny
2011-03-30 20:41       ` Mojca Miklavec
2011-04-03 11:48     ` R. Ermers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110330151629.GA18420@khaled-laptop \
    --to=khaledhosny@eglug.org \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).