Mediawiki2latex: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 7: Line 7:
See also:
See also:
* [[Mediawiki collection extension installation]], a system that is currently a bit broken on this wiki, i.e. it has trouble retrieving and using all the images.
* [[Mediawiki collection extension installation]], a system that is currently a bit broken on this wiki, i.e. it has trouble retrieving and using all the images.
== Using ==
=== Official online server ===
The official online server allows processing books within limits, so we recommend installing your own platform if you got a Debian/Ubuntu machine.
* [http://mediawiki2latex.wmflabs.org/ http://mediawiki2latex.wmflabs.org/], max 200 pages, time limit = 1 hour.
* [http://mediawiki2latex-large.wmflabs.org/ http://mediawiki2latex-large.wmflabs.org/] max 800 pages, max time = 6 hours
Using your own is faster and will take take load off the official server.
=== Your own local server ===
You could run your own server, either as public or local server.
: <code>mediawiki2latex -s PORT_NUMBER </code>
: e.g.
: mediawiki2latex -s 8080
=== Command line ===
See also: [https://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/wb2pdf/manual official manual]. It it includes more information.
<pre>
  -V, -?, -v    --version, --help    show version number
  -o FILE      --output=FILE        output FILE (REQUIRED)
  -f START:END  --featured=START:END  run selftest on featured article numbers from START to END
  -x CONFIG    --hex=CONFIG          hex encoded full configuration for run
  -s PORT      --server=PORT        run in server mode listen on the given port. E.g. 8080 starts it on http://localhost:8080/
  -t FILE      --templates=FILE      user template map FILE
  -r INTEGER    --resolution=INTEGER  maximum image resolution in dpi INTEGER, default = 300 DPI
  -u URL        --url=URL            input URL (REQUIRED)
  -p PAPER      --paper=PAPER        paper size, on of A4,A5,B5,letter,legal,executive
  -m            --mediawiki          use MediaWiki to expand templates
  -h            --html                use MediaWiki generated html as input (default). Will render expanded templates
  -k            --bookmode            uses a Pediapress collection "book" page, i.e. retrieves its list of included articles.
  -z            --zip                output zip archive of latex source
  -b            --epub                output epub file
  -d            --odt                output odt file
  -g            --vector              keep vector graphics in vector form
  -i            --internal            use internal template definitions
  -l DIRECTORY  --headers=DIRECTORY  use user supplied latex headers
  -c DIRECTORY  --copy=DIRECTORY      copy LaTeX tree to DIRECTORY
</pre>
Example code (replace URL by your own)
* Generate a PDF from a wiki book ("Collection extension), starting from the HTML code
mediawiki2latex -o book.pdf -k -u https://edutechwiki.unige.ch/fr/EduTech_Wiki:Livres/Book title
* Create a Libre Office document from a collection
mediawiki2latex -o book.odf -k -d -u https://edutechwiki.unige.ch/fr/EduTech_Wiki:Livres/XXX YYY ZZZ


== Installation ==
== Installation ==

Revision as of 15:30, 11 February 2019

Introduction

Mediwiki2latex or wb2pdf is a tool, created by Dirk Huenniger that allows exporting Mediawiki pages and article collections to Latex, PDF, Epub and ODF.

It can be used to (1) Create print documents on demand and (2) export for book projects that start from wiki pages as draft documents.

See also:

Using

Official online server

The official online server allows processing books within limits, so we recommend installing your own platform if you got a Debian/Ubuntu machine.

Using your own is faster and will take take load off the official server.

Your own local server

You could run your own server, either as public or local server.

mediawiki2latex -s PORT_NUMBER
e.g.
mediawiki2latex -s 8080

Command line

See also: official manual. It it includes more information.

  -V, -?, -v    --version, --help     show version number
  -o FILE       --output=FILE         output FILE (REQUIRED)
  -f START:END  --featured=START:END  run selftest on featured article numbers from START to END
  -x CONFIG     --hex=CONFIG          hex encoded full configuration for run
  -s PORT       --server=PORT         run in server mode listen on the given port. E.g. 8080 starts it on http://localhost:8080/
  -t FILE       --templates=FILE      user template map FILE
  -r INTEGER    --resolution=INTEGER  maximum image resolution in dpi INTEGER, default = 300 DPI
  -u URL        --url=URL             input URL (REQUIRED)
  -p PAPER      --paper=PAPER         paper size, on of A4,A5,B5,letter,legal,executive
  -m            --mediawiki           use MediaWiki to expand templates
  -h            --html                use MediaWiki generated html as input (default). Will render expanded templates
  -k            --bookmode            uses a Pediapress collection "book" page, i.e. retrieves its list of included articles.
  -z            --zip                 output zip archive of latex source
  -b            --epub                output epub file
  -d            --odt                 output odt file
  -g            --vector              keep vector graphics in vector form
  -i            --internal            use internal template definitions
  -l DIRECTORY  --headers=DIRECTORY   use user supplied latex headers
  -c DIRECTORY  --copy=DIRECTORY      copy LaTeX tree to DIRECTORY

Example code (replace URL by your own)

  • Generate a PDF from a wiki book ("Collection extension), starting from the HTML code
mediawiki2latex -o book.pdf -k -u https://edutechwiki.unige.ch/fr/EduTech_Wiki:Livres/Book title
  • Create a Libre Office document from a collection
mediawiki2latex -o book.odf -k -d -u https://edutechwiki.unige.ch/fr/EduTech_Wiki:Livres/XXX YYY ZZZ

Installation

See the official links below first. Below we just wrote down what did work on Feb 2019 for Ubuntu 18x LTS.

(1) Install the (old) default version, which will also install lots of run time dependencies (compatible with your current Ubuntu system).

sudo apt-get install mediawiki2latex

(2) Then install the build time dependencies (as root) as explained [Benutzer:Dirk Hünniger/wb2pdf/installing here] , i.e. about 10 different packages

sudo apt-get install ghc libghc-x509-dev libghc-pem-dev
sudo apt-get install libghc-regex-compat-dev libghc-http-dev cabal-install libghc-hxt-dev
sudo apt-get install libghc-split-dev libghc-blaze-html-dev libghc-file-embed-dev
sudo apt-get install libghc-highlighting-kate-dev  libghc-hxt-http-dev libghc-regex-pcre-dev
sudo apt-get install libghc-temporary-dev libghc-url-dev libghc-utf8-string-dev
sudo apt-get install libghc-utility-ht-dev libghc-http-conduit-dev libghc-happstack-server-dev
sudo apt-get install libghc-directory-tree-dev libghc-zip-archive-dev libghc-strict-dev
sudo apt-get install libghc-network-uri-dev
sudo apt-get install ghostscript calibre latex2rtf libreoffice 

(3) Then install the new version

git clone https://git.code.sf.net/p/wb2pdf/git wb2pdf-git cd wb2pdf-git make sudo make install

Links