Skip to content

Griboedow/PandocUltimateConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PandocUltimateConverter is a Pandoc converter extension for MediaWiki which imports not only text, but also images.

MediaWiki page: https://www.mediawiki.org/wiki/Extension:PandocUltimateConverter

Prerequisites

Tested on MediaWiki 1.39, 1.40, 1.41

Requires pandoc to be installed.

Tested on Windows and Linux.

Installation

Installation is just a bit more complicated than usual:

  1. Install pandoc
  2. Download extension
  3. Load the extension in LocalSettings.php wfLoadExtension( 'PandocUltimateConverter' );
  4. [Optional] Configure path to pandoc binary $wgPandocExecutablePath = 'C:\Program Files\Pandoc\pandoc.exe';. It will work without this param if pandoc is in the PATH env. variable
  5. [Optional] Configure path to a temp folder where pandoc will store images before upload $wgPandocTmpFolderPath = 'D:\_TMP';. IT will try to use default temp folder if not specified.
  6. Allow additional file extensions to be uploaded to MediaWiki
$wgFileExtensions[] = 'docx';
$wgFileExtensions[] = 'odt';
// You can specify other requried extensions as well

TL;DR:

$wgEnableUploads = true;

$wgFileExtensions[] = 'docx';
$wgFileExtensions[] = 'odt';

wfLoadExtension( 'PandocUltimateConverter' );

Usage

Follow these steps:

  1. Go to Special:PandocUltimateConverter page. PandocUltimateConverterExtension

  2. Specify file to convert and target page name.

    • Target page and all the images will be overwritten if they already exist
  3. After the file conversion is finished, you will be redirected to the target page

    • Source file will be automatically removed from the wiki
    • All the images will be automatically uploaded to MediaWiki with a name Pandocultimateconverter-{guid}-{imageOriginalNameAndExtension}
    • If the image is already present on 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

Supported formats

Theoretically it supports everything Pandoc supports. On practice, I've tested for docx and odt only.

PDF is not supported as input format of pandoc.

Simple demo

Simple gif to show how it works: PandocConverterGif

Debug

In case you face any issues with the extension, please add these lines to the LocalSettings.php:

error_reporting( -1 );
$wgDebugLogFile = "/var/log/mediawiki/main.log";
$wgDebugLogPrefix = date( '[Y-m-d H:i:s] ' );
$wgShowExceptionDetails = true;
$wgShowDBErrorBacktrace = true;
error_reporting( E_ALL ); ini_set( 'display_errors', 1 );

$wgDebugLogGroups['DBQuery'] =
$wgDebugLogGroups['DBReplication'] =
$wgDebugLogGroups['DBConnection'] =
$wgDebugLogGroups['runJobs'] =
$wgDebugLogGroups['Parsoid'] =
$wgDebugLogGroups['rdbms'] = "/var/log/mediawiki/misc.log";

Confirm the issue once more and provide the content of /var/log/mediawiki/main.log. You may want to specify different path, especially if you are using WIndows OS.

About

Pandoc converter extension for mediawiki which imports not only text, but also images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published