Tiny Python script to add line breaks to a text file before posting it as a wiki page
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
License.md
README.wiki
wikibrs.py

README.wiki

A tiny Python script to convert a plaintext file into a MediaWiki wiki page (as wikitext), avoiding the issue that subsequent lines blend into one because MediaWiki treats newlines differently.

Basically, it adds "<br />" tags to the end of every line of the input file, except those where MediaWiki will keep the line break anyway when parsing it as wikitext (e.g. after a line that starts with "*").

I use it to publish notes taken on an Etherpad (exported from Etherpad as plaintext file) on Meta-wiki.

Usage: wikibrs.py inputfile.txt outputfile.txt

To avoid getting yourself into trouble when using this for Wikipedia articles, consider looking at the essay "Don't use line breaks" first ;)