Wikipedia:Tools/Editing tools
Semi-auto edit bots
Pywikibot
Useful for creating bots, or for interactive repair of interwiki links.
DotNetWikiBot
DotNetWikiBot has an option to review and change each edit in Microsoft Word before saving it to live wiki. DotNetWikiBot is a client API on .NET, intended for building bots for MediaWiki sites.
Relink
Relink.pl is a Perl5 script that relinks wikitext. It removes red links, given a list of titles that it generates from the raw wikitext. It can also add links given a list of words to link. It will report link counts, how many times each link occurs, and the total number of outgoing links.
Wikisyntax conversion utilities
From spreadsheet tables
- User:Cacycle/wikEd editor extension functionality, see above
- The CSV to Wikipedia converter allows you to convert tables in CSV format into the MediaWiki syntax for tables (or to HTML, if you prefer). This way you can import tables directly from spreadsheet applications like Excel or from databases. For more information, see de:Benutzer:Duesentrieb/csv2wp (en). (by de:Duesentrieb).
- The HTML::WikiConverter Perl module (mentioned below) is also capable of table conversion.
- A very simple Copy & Paste Excel-to-Wiki Converter
- A free open source tool to convert from csv and Excel files to wiki table format: csv2other
- Spreadsheet-to-MediaWiki-table-Converter This class constructs a MediaWiki-format table from an Excel/GoogleDoc copy&paste. It provides a variety of methods to modify the style. It defaults to a Wikipedia styling with first column header.[1]
From Microsoft Word or OpenOffice
see also "From OpenOffice" section below for conversion from or via OpenOffice
- VisualEditor, the WYSIWYG editor deployed on multiple Wikipedias allows for the copying/pasting of content from Word documents into a wiki page. Most formatting is kept intact - including tables. However, images and advanced formatting will need to be cleaned up upon import.
- User:Cacycle/wikEd editor extension functionality, see above
- Extension:Word2MediaWikiPlus: Converts most text, tables and pictures into wiki format.
- Microsoft Office Word Add-in For MediaWiki: Converts Word documents to wiki formatting. Doesn't do images.
- Word2MediaWiki using a Word Visual Basic macro
- word2mediawiki.pl: A Perl script that convert Word files to Mediawiki using OpenOffice (running "headless"). Images are also supported. Images are extracted from the Word file and saved as ordinary images which are uploaded to the wiki using pywikipediabot. Runs on Linux.
- word2mediawiki.py: A Python script that convert Word files to Mediawiki using OpenOffice. Images are also supported.
- Excel2Wiki tool for converting Excel tables to wiki tables.
- Adding code to Microsoft visual basic editor
- Add the source code below (currently hidden in a collapsed table) to the visual basic editor in Word.
- Copy and paste the below code into a file.
- Open the visual basic editor tools → macro → visual basic editor (In Word 2007, Show Developer Tab in Ribbon must be checked in Word Options → Popular)
- Right click on Normal in the Project pane and select Import File...
- Import the file saved above (that file is no longer needed after import)
- Save the code File → Save normal
- Close the visual basic editor.
- Converting the Word formatted text is simply done by running your new 'installed' macro tools → macro → macros.
- See the notes[2] for more formatting options.
Code to add to Microsoft Visual basic editor Attribute VB_Name = "Word2Wiki" Dim newDoc As Document Sub Word2Wiki() Set newDoc = New Word.Document ActiveDocument.Content.Copy newDoc.Content.Paste Application.ScreenUpdating = False ConvertH1 ConvertH2 ConvertH3 ConvertItalic ConvertBold 'ConvertUnderline ConvertLinks 'must come before lists otherwise it adds extra line breaks in their sequence and breaks it ConvertBreaks '''ConvertLists ConvertTables''' ' Copy to clipboard newDoc.Content.Copy newDoc.Close (False) Application.ScreenUpdating = True End Sub Private Sub ConvertH1() Dim normalStyle As Style Set normalStyle = newDoc.Styles(wdStyleNormal) newDoc.Select With Selection.Find .ClearFormatting .Style = newDoc.Styles(wdStyleHeading1) .Text = "" .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Forward = True .Wrap = wdFindContinue Do While .Execute With Selection If InStr(1, .Text, vbCr) Then ' Just process the chunk before any newline characters ' We'll pick-up the rest with the next search .Collapse .MoveEndUntil vbCr End If ' Don't bother to markup newline characters (prevents a loop, as well) If Not .Text = vbCr Then .InsertBefore "= " .InsertAfter " =" End If .Style = normalStyle End With Loop End With End Sub Private Sub ConvertH2() Dim normalStyle As Style Set normalStyle = newDoc.Styles(wdStyleNormal) newDoc.Select With Selection.Find .ClearFormatting .Style = newDoc.Styles(wdStyleHeading2) .Text = "" .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Forward = True .Wrap = wdFindContinue Do While .Execute With Selection If InStr(1, .Text, vbCr) Then ' Just process the chunk before any newline characters ' We'll pick-up the rest with the next search .Collapse .MoveEndUntil vbCr End If ' Don't bother to markup newline characters (prevents a loop, as well) If Not .Text = vbCr Then .InsertBefore "== " .InsertAfter " ==" End If .Style = normalStyle End With Loop End With End Sub Private Sub ConvertH3() Dim normalStyle As Style Set normalStyle = newDoc.Styles(wdStyleNormal) newDoc.Select With Selection.Find .ClearFormatting .Style = newDoc.Styles(wdStyleHeading3) .Text = "" .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Forward = True .Wrap = wdFindContinue Do While .Execute With Selection If InStr(1, .Text, vbCr) Then ' Just process the chunk before any newline characters ' We'll pick-up the rest with the next search .Collapse .MoveEndUntil vbCr End If ' Don't bother to markup newline characters (prevents a loop, as well) If Not .Text = vbCr Then .InsertBefore "=== " .InsertAfter " ===" End If .Style = normalStyle End With Loop End With End Sub Private Sub ConvertBold() newDoc.Select With Selection.Find .ClearFormatting .Font.Bold = True .Text = "" .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Forward = True .Wrap = wdFindContinue Do While .Execute With Selection If InStr(1, .Text, vbCr) Then ' Just process the chunk before any newline characters ' We'll pick-up the rest with the next search .Collapse .MoveEndUntil vbCr End If ' Don't bother to markup newline characters (prevents a loop, as well) If Not .Text = vbCr Then .InsertBefore "'''" .InsertAfter "'''" End If .Font.Bold = False End With Loop End With End Sub Private Sub ConvertItalic() newDoc.Select With Selection.Find .ClearFormatting .Font.Italic = True .Text = "" .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Forward = True .Wrap = wdFindContinue Do While .Execute With Selection If InStr(1, .Text, vbCr) Then ' Just process the chunk before any newline characters ' We'll pick-up the rest with the next search .Collapse .MoveEndUntil vbCr End If ' Don't bother to markup newline characters (prevents a loop, as well) If Not .Text = vbCr Then .InsertBefore "''" .InsertAfter "''" End If .Font.Italic = False End With Loop End With End Sub Private Sub ConvertUnderline() newDoc.Select With Selection.Find .ClearFormatting .Font.Underline = True .Text = "" .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Forward = True .Wrap = wdFindContinue Do While .Execute With Selection If InStr(1, .Text, vbCr) Then ' Just process the chunk before any newline characters ' We'll pick-up the rest with the next search .Collapse .MoveEndUntil vbCr End If ' Don't bother to markup newline characters (prevents a loop, as well) If Not .Text = vbCr Then .InsertBefore "=== " .InsertAfter " ===" End If .Font.Underline = False End With Loop End With End Sub Private Sub ConvertLists() Dim para As Paragraph For Each para In newDoc.ListParagraphs With para.Range If .ListFormat.ListType = wdListBullet Then .InsertBefore "*" Else .InsertBefore "#" End If .ListFormat.RemoveNumbers End With Next para End Sub Private Sub ConvertBreaks() Dim para As Paragraph For Each para In newDoc.Paragraphs If para.Range.ListFormat.List Is Nothing Then If para.Range.Words.Count > 1 Then para.Range.InsertParagraphBefore End If End If Next para End Sub Private Sub ConvertTables() Dim thisTable As Table Dim myCol As Word.Column Dim myRow As Word.Row Dim myCell As Word.Cell Dim myFrame As Word.Frame For Each thisTable In newDoc.Tables With thisTable For Each myRow In thisTable.Rows For Each myCell In myRow.Cells With myCell.Range .InsertBefore "|" End With Next myCell myRow.Range.InsertBefore "|-" & vbCrLf Next myRow .Range.InsertBefore "{| border=""1""" & vbCrLf .Range.InsertAfter vbCrLf & "|}" .ConvertToText Separator:=wdSeparateByParagraphs End With Next thisTable For Each myFrame In newDoc.Frames myFrame.Delete Next myFrame End Sub Private Sub ConvertLinks() newDoc.Select For Each aHyperlink In newDoc.Hyperlinks Set aRange = aHyperlink.Range With aRange .InsertBefore "[" + aHyperlink.Address + " " .InsertAfter "]" End With Next aHyperlink End Sub |
On the other hand, transferring a single wiki page in mediawiki to Word is easy, just save the desired webpage and then open the page in Microsoft Word.
From HTML
- Online, no installation required
- html2wiki (tools.wmflabs.org/magnustools)
- An AJAX interface for the HTML::WikiConverter http://labs.seapine.com/htmltowiki.cgi (remove HTML head if not working)
- A browser based HTML to Wiki converter Emiliano Bruni's I love wiki – HTML2Wiki Converter (also using Perl module HTML::WikiConverter, remove HTML head if not working)
- HTML::WikiConverter on the Toolserver: http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi (asf of 1 November 2011 the account has expired)
- Note: You must change the "Wiki dialect" to MediaWiki or it won't work properly. You can enter a url to convert a web page. It is based on the Perl module HTML::WikiConverter which performs html→wiki conversion and is available on CPAN. (by en:Diberri). This converter can fetch a URL instead of pasting the html.
- Tip: If you receive no conversion but an "Internal Server Error" or nothing at all, the HTML source may be too large
- Tip: If you experience problems with non-ASCII characters, paste UTF-8 code as ASCII (Ä instead of Ä), convert and restore original encoding (SciTe could help you doing the encoding conversions)
- https://gwicke.github.io/paste2wiki/ : HTML paste supported, offers both HTML clean-up and converts to wikitext using Parsoid. Decent support for HTML from Google Docs and GMail.
- To download
- Html2Wiki is an extension for MediaWiki that imports HTML
- HTML::WikiConverter http://search.cpan.org/~diberri/HTML-WikiConverter-0.61/.
- User:Cacycle/wikEd editor extension functionality, see above
- Another HTML to Wiki converter http://www.dwheeler.com/html2wikipedia/
- A C++ based program also called Html2mediawiki
From OpenOffice and LibreOffice
- LibreOffice provides MediaWiki export functionality, package libreoffice-wiki-publisher needs to be installed
- via OpenOffice 2.x to MediaWiki: open the .doc with OpenOffice.org 2.x and export as mediawiki text. Not available any longer in OpenOffice 3.x versions.
- Odt2Wiki – OpenOffice.org Wiki
- OpenOffice2MediaWiki: Export filter for converting from ODT format to MediaWiki
- Writer2MediaWiki: OpenOffice macro for converting to MediaWiki format
- Sun Wiki Publisher: OpenOffice extension from Sun to publish in MediaWiki format
From LaTeX
- LaTeX2wiki converts sections, math, and references using a web form.
From source codes
- Wikipedia supports syntax highlighting. For information on how to use it, and the languages supported, see Syntax Highlight Extension.
From Wikispaces
- A very simple Wikispaces text to MediaWiki text Converter.
See also
- Wikipedia:Text editor support
- MediaWiki:Edittools – Source code of system message that appears below the edit window
- ^ http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/55686
- ^ Note: You may want to alter this Microsoft Word visual basic editor code so that Word H1 tags become Wiki H2 tags, H2->H3, and so on. H1 is widely considered the title of a web page, whereas H1 is widely considered just the top-level heading in Word.
- Note: this macro also provides a workaround converting linebreaks from word to paragraphs in wiki – line breaks in word are ignored in wiki so everything runs together in one paragraph in the older version of this code. Additionally, the code no longer makes any changes to the source document. Changes are made on a document in memory and put on the clipboard for pasting into the wiki text area.