Extension:PandocUltimateConverter

Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:MIT licensed extensions
MediaWiki extensions manual
PandocUltimateConverter
Release status: betaCategory:Beta status extensions
Implementation Special page Category:Special page extensions
Description Pandoc converter extension for mediawiki which imports not only text, but also images
Author(s) Urfiner (Nikolai Kochkin)
Latest version 0.2.1
MediaWiki 1.39 - 1.43Category:Extensions with manual MediaWiki version
License MIT License
Download Category:Extensions in GitHub version control
  • $wgPandocUltimateConverter_PandocCustomUserRight
  • $wgPandocUltimateConverter_MediaFileExtensionsToSkip
  • $wgPandocUltimateConverter_TempFolderPath
  • $wgPandocUltimateConverter_PandocExecutablePath
Category:All extensions

The PandocUltimateConverter is an extension for MediaWiki that converts document files (.docx, .odt) and other files to wikitext. It imports not only text but also images. It is highly inspired by Microsoft's PandocUpload extension but written from scratch to support 1.41 MediaWiki and include image import.

You can see demo here.

Installation

Installation is just a bit more complicated than usual:

  1. Install pandoc
  2. Download extension from command line git clone https://github.com/Griboedow/PandocUltimateConverter.git or download the last zip from releases.
  3. Load the extension in LocalSettings.php wfLoadExtension( 'PandocUltimateConverter' );
  4. (Optional) Configure path to pandoc binary $wgPandocUltimateConverter_PandocExecutablePath = 'C:\Program Files\Pandoc\pandoc.exe';. It will work without this parameter if pandoc is in PATH.
  5. (Optional) Configure path to a temp folder where pandoc will store images before upload $wgPandocUltimateConverter_TempFolderPath = 'D:\_TMP';. It will try to use the default system temp folder if not specified.
  6. Allow additional file extensions to be uploaded to MediaWiki
    $wgFileExtensions[] = 'docx';
    $wgFileExtensions[] = 'odt';
    // You can specify other required extensions as well
    
  7. Enable uploads if they are not enabled
    $wgEnableUploads = true;
    


Usage

Follow these steps:

  1. Go to Special:PandocUltimateConverter page.
  2. Choose source type: file or URL.
  3. Specify file (or URL) to convert and target page name.
  4. After the file conversion is finished, you will be redirected to the target page
    • The Source file will be automatically removed from the wiki
    • All the images will be automatically uploaded to MediaWiki with the name "Pandocultimateconverter-{guid}-{imageOriginalNameAndExtension}"
    • If the image is already present on the wiki, the image duplicate will not be uploaded. We will just use the existing image.
    • All the images will be automatically removed from the temp folder
Target page and all the images will be overwritten if they already exist

Limitations

Consider the following limitations:

  1. The list of supported formats can be found on the Pandoc website. For example, it supports docx and odt formats, but does not support pdf format.
  2. For URLs, it may add a lot of garbage data to the target webpage; that is a known behavior of pandoc.

Advanced configuration

There are additional configs:

  1. $wgPandocUltimateConverter_MediaFileExtensionsToSkip = [ 'emf' ]; -- You can specify an array of extensions that should not be uploaded to MediaWiki as a file. For example, EMF images are not supported on the web, and there is no reason to upload them. The config is case-insensitive.
  2. Global configs $wgPandocExecutablePath and $wgPandocTmpFolderPath are still working but we recommend to switch to configuration parameters $wgPandocUltimateConverter_PandocExecutablePath and $wgPandocUltimateConverter_TempFolderPath.
  3. You can specify custom user rights for the extensions via $wgPandocUltimateConverter_PandocCustomUserRight where you can specify the required permission. For example: you can limit access to the special page by specifying $wgPandocUltimateConverter_PandocCustomUserRight = 'pandoc'; together with $wgGroupPermissions['your_group_here']['pandoc'] = true;.

See also

Category:Bulk upload Category:Page creation extensions
Category:All extensions Category:Beta status extensions Category:Bulk upload Category:Extensions in GitHub version control Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:MIT licensed extensions Category:Page creation extensions Category:Special page extensions