Talk:Wikimedia Blog/Converting wiki pages to blog posts

From Meta, a Wikimedia project coordination wiki

Feel free to leave questions, comments and bug reports about the tool here

"wpmediawiki" plugin[edit]

BTW and FWIW, I just saw this plugin ("adds a subset of MediaWiki markups to WordPress"); did not try it out though. Regards, Tbayer (WMF) 20:17, 22 September 2011 (UTC)[reply]

MediaWiki 1.18 changes[edit]

It seems MediaWiki 1.18 has added a lot of noise to the code, even in Print version. Namely, the HTML code now includes the section edit links, even if they're hidden on the page. See the first span in the example below:

<h2><span class="editsection">[<a href="/w/index.php?title=Wikimedia_engineering_report/2011/September&amp;action=edit&amp;section=1" title="Edit section: Upcoming events">edit</a>]</span> <span class="mw-headline" id="Upcoming_events">Upcoming events</span></h2>

For reference, here's what the code looks like on a MediaWiki 1.17 wiki:

<h2><span class="mw-headline" id="Upcoming events">Upcoming events</span></h2>

guillom 13:51, 30 September 2011 (UTC)[reply]

This seems to have been changed again (sensibly - at least I can't see what the purpose of these hidden links in the print version would have been): I don't see these links in the HTML for [1] any more.
In any case, the first replacement rule in the script (the one containing <span class="editsection">) seems to be designed to address this, although when I tested it after your discovery, it failed for section headings that included a link (e.g. == [[Wikimedia Platform Engineering|Platform Engineering]]).
Regards, Tbayer (WMF) 15:09, 14 October 2011 (UTC)[reply]

"Release notes" for rewritten version[edit]

After the code on this page has not been updated for more than a year, I have just synced it to the new, rewritten version that we have been using for the Wikimedia blog for a while (LiAnna, Matthew and I use it regularly). The main change is that it loads the HMTL directly from the wiki - no need to download it as a file first. But there are also numerous other tweaks and fixes, some to keep up with MediaWiki changes (e.g. regarding [edit links] in April; the VisualEditor might bring some more). Of course it's still basically an ad hoc hack - a smart solution might generate the necessary changes directly and dynamically from the CSS of the MediaWiki wiki - but tt works quite well in practice so far.

I also intend to put it up as a web form on Tool Labs (advice welcome) so that people can use it without needing to run Python locally. Once that is done, it could conceivably become a button inside the Wordpress authoring interface (fill in a wiki URL, and have the content appear magically in the blog draft).

Regards, Tbayer (WMF) (talk) 23:25, 12 July 2013 (UTC)[reply]

"edit|edit source" links[edit]

Once the naming of "edit/edit source" section links stabilises, it would be good if this script accounted for that. Sharihareswara (WMF) (talk) 00:51, 5 August 2013 (UTC)[reply]

Done - as mentioned above, it was and is anticipated that the VE would require some changes in the script.
(The fix does not depend on the naming of the section edit links btw. But it does rely on the presence of the slightly hackish CSS introduced here recently.)
Regards, Tbayer (WMF) (talk) 01:00, 28 August 2013 (UTC)[reply]

Labs version, and relicensing[edit]

I have just made this available in an online version on Tool Labs: https://tools.wmflabs.org/blogconverter/ (thanks to Yuvi and Coren for their help). Hopefully this will make it much easier to use, especially for people who are not familiar with running Python scripts on their own machine. Comments and bug reports are welcome!

Legal subtleties: Because Labs only allows code that is freely licensed under an OSI-approved license (which CC-BY-SA is not, as far as I know), I relicensed the code under GPLv2. While credit for the initial idea for this script goes to RobLa, and Guillaume contributed code to earlier versions too, it looks that essentially all the potentially copyrightable code in the current version does not appear in this earlier version, so I assume I am in a position to release the current version under a different license.

Regards, Tbayer (WMF) (talk) 07:32, 11 May 2015 (UTC)[reply]

Video conversion bug[edit]

When converting a meta draft with video the video does not convert correctly.

Specifically happened with this post using this tool.

ASherman (WMF) (talk) 13:36, 29 July 2015 (UTC)[reply]

Bad link for styles[edit]

wikitech:bits.wikimedia.org is being retired, and the Vector CSS module name changed to skins.vector.styles. It's only a comment, but the correct URL is now

 https://meta.wikimedia.org/w/load.php?debug=false&lang=en&modules=ext.wikihiero%7Cmediawiki.legacy.commonPrint%2Cshared%7Cskins.vector.styles&only=styles&skin=vector&*

Why that particular set of modules? If you want to be smart, you can ask action=parse to tell you the modules that a particular chunk of wikitext needs. I've started writing this up at mw:API:Styling content -- SPage (WMF) (talk) 04:25, 11 August 2015 (UTC)[reply]

Clojure port[edit]

Just happened to notice this: https://github.com/gowda/blogfix ("Clojure port of http://meta.wikimedia.org/wiki/Wikimedia_Blog/Converting_wiki_pages_to_blog_posts"). Regards, Tbayer (WMF) (talk) 18:04, 24 September 2015 (UTC)[reply]

Fixes and updates July 2017[edit]

Just a note that the tool was recently offline due to a general Issue on Labs but has been restored. Also, I fixed some issues with the thumbnail layout that were causing clipped/misaligned images.

BTW, the online version tool has now been used over 1700 times since May 2015, according to the log (which only record timestamps but no other detail). I understand the WMF blog team now employs HTML copy+paste to import posts (which used to work less well back when we looked at it as an option some years ago), but I myself still use it for the monthly research newsletter posts, and it continues to see some other usage as well. Regards, Tbayer (WMF) (talk) 00:47, 25 July 2017 (UTC)[reply]