[pydotorg-www] tip on converting reStructuredText to MoinMoin wiki format

Steve Holden steve at holdenweb.com
Mon Feb 10 11:21:01 EST 2020


Hi Sumana,

Thanks for your note. You should publish this on the Wiki, I haven't seen
any similar content anywhere!

Kind regards,
Steve


On Mon, Feb 10, 2020 at 3:51 PM Sumana Harihareswara <sh at changeset.nyc>
wrote:

> Here is a tip for anyone who is converting a complicated page on the
> wiki from reStructuredText to MoinMoin wiki format, as I just did
> https://wiki.python.org/psf/PackagingWG?action=diff&rev1=107&rev2=108 .
> I'd been looking for an rST-to-MoinMoin converter but hadn't found one,
> so I ended up using pandoc to get to an intermediate HTML state, then an
> HTML-to-MoinMoin format.
>
> (I did this so I could use the  `<<TableOfContents()>>`  syntax to
> automatically get a table of contents and easy anchor tag links to page
> sections.)
>
> Cleaned up to remove backtracking, I:
>
> 1) copied the rST source text of the page into a local file,
> packagingwg.rst
>
> 2) removed the `#format rst` line from the start (but copied the rest of
> the hashmarked stuff from the start, like an #acl line, into a separate
> scratch pad to retain for later)
>
> 3) turned the rST into HTML using pandoc: `pandoc -o packagingwg.html
> packagingwg.rst` (this gave me a few errors, like "[WARNING] Reference
> not found for 'fundable packaging improvements' at chunk line 1 column
> 50", which meant it slightly misformatted a few internal wiki links
>
> 4) installed libhtml-wikiconverter-moinmoin-perl which is available as a
> Debian package
>
> 5) converted from HTML to MoinMoin using  `html2wiki --dialect=MoinMoin
> packagingwg.html > packagingwg.wiki`
>
> 6) pasted the non-format-related hashmarked lines from my scratch pad
> into the start of packagingwg.wiki
>
> 7) corrected the "Reference not found" errors by removing the `|` in any
> hyperlinks that had turned into `[[|internal-pagename]`
>
> 8) replaced the contents of the page source with packagingwg.wiki
>
> Worked fine!
>
> Only on the revision AFTER that (so, knowing what format to use for the
> renderer, I suppose) will MoinMoin properly preview a table of contents
> for the page. So, heads-up.
>
> If there is an easier rst-to-MoinMoin path, or if there's a table of
> contents syntax available that works for reStructuredText-formatted
> pages on wiki.python.org, please let me know! I looked but I may have
> missed something.
>
> --
> Sumana Harihareswara
> Changeset Consulting
> https://changeset.nyc
> _______________________________________________
> pydotorg-www mailing list
> pydotorg-www at python.org
> https://mail.python.org/mailman/listinfo/pydotorg-www
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pydotorg-www/attachments/20200210/4a04bc5d/attachment.html>


More information about the pydotorg-www mailing list