For simplicity, installing required packages on Ubuntu 20.04
sudo apt-get install -y python3-redminelib python3-bs4 python3-lxml
Optionally, for converting SVG to other image format by ImageMagick convert
:
sudo apt-get install -y imagemagick
Optionally, for exporting beautiful PDF by WeasyPrint:
sudo apt-get install -y weasyprint
Optionally, for exporting as DocBook:
sudo apt-get install -y pandoc
- Python 3
pip install python-redmine beautifulsoup4 lxml
- Optionally, for converting SVG to other image format by ImageMagick
convert
: - Optionally, for exporting beautiful PDF by install WeasyPrint
- Optionally, for exporting as DocBook, install Pandoc.
usage: redmine-exporter [-h] [-t {textile,html,pdf,docbook}] [-u REDMINE_URL]
[-k REDMINE_KEY] [-p PROJECT] [--css CSS]
[--embed-images] [--convert-svg {png,jpg,gif}]
[--convert-svg-opts CONVERT_SVG_OPTS] [--toc]
[-f FILE] [-o OUTPUT] [--title TITLE]
[--docbook-tpl DOCBOOK_TPL] [--pandoc PANDOC]
[--weasyprint [WEASYPRINT]]
wiki [wiki ...]
positional arguments:
wiki wiki name
optional arguments:
-h, --help show this help message and exit
-t {textile,html,pdf,docbook}, --type {textile,html,pdf,docbook}
Export format type
-u REDMINE_URL, --redmine-url REDMINE_URL
Remine access key
-k REDMINE_KEY, --redmine-key REDMINE_KEY
Remine access key
-p PROJECT, --project PROJECT
Remine project id or name
--css CSS Replace html style tag by css file.
--embed-images Base64 encode images into html.
--convert-svg {png,jpg,gif}
Convert SVG to other image format by ImageMagick
convert.
--convert-svg-opts CONVERT_SVG_OPTS
ImageMagick convert command line options
--toc Enable html or wiki table of content
-f FILE, --file FILE Specify configure, default ~/.redmine_exporter.conf
-o OUTPUT, --output OUTPUT
Output directory
--title TITLE Specify title
--docbook-tpl DOCBOOK_TPL
Specify docbook template
--pandoc PANDOC pandoc cli options for generating docbook
--weasyprint [WEASYPRINT]
weasyprint cli options for generating pdf
For simplicity, you can write ~/.redmine\_exporter.conf
as
{
"redmine_url": "<redmine url>",
"redmine_key": "<your redmine key>",
"project": "<default redmine project>",
"css": "<default css full path>",
"convert_svg_opts": "-antialias -font Noto-Sans-CJK-SC-Thin -background none"
}
The following options can be set in ~/.redmine\_exporter.conf
:
redmine_url
: identical to--redmine-url
and envREDMINE_URL
redmine_key
: identical to--redmine-key
and envREDMINE_KEY
project
: identical to--project
and envREDMINE_PROJECT
css
: identical to--css
and envREDMINE_CSS
docbook_tpl
: identical to--docbook-tpl
andREDMINE_DOCKBOOK_TPL
convert_svg_opts
: identical to--convert-svg-opts
./redmine_exporter -t textile "<wiki>"
./redmine_exporter -t html --css default.css "<wiki>"
./redmine_exporter -t pdf --weasyprint --css default.css "<wiki>"
It is better than exporting PDF directly.
./redmine_exporter -t docbook --title "<new title>" "<wiki>"