Plugins Directory » Reformat

24862 Author: Martin Cizek
Website: https://github.com/orchitech/redmine_reformat
Code repository: https://github.com/orchitech/redmine_reformat
Registered on: 2020-02-19 (about 1 month ago)
Current version: 0.2.0
Compatible with: Redmine 4.2.x, 4.1.x, 4.0.x, 3.4.x, 3.3.x
User ratings:   (3)

Textile-to-Markdown and any-other-conversion tool for Redmine rich text data

Features

  • Conversion can be run on a per-project, per-object and per-field basis.
  • Different sets of data can use different conversions - useful if some parts of your Redmine use different syntax flavours.
  • Supports custom fields, journals and even custom field journals.
  • Supports parallel conversion in several processes - especially handy when external tools are used (pandoc, web services).
  • Transaction safety even for parallel conversion.
  • Currently supported converters:
    • TextileToMarkdown - a Pandoc-based Textile to Markdown converter. Works on markup level. Battle-tested on quarter a million strings. See below for details.
    • RedmineFormatter - produces HTML using Redmine's internal formatter. Useful when chaining with external converters. See below for details.
    • Ws - calls an external web service, providing input in the POST body and expecting converted output in the response body.
    • Feel free to submit more :)
  • Conversions can be chained - e.g. convert Atlassian Wiki Markup (roughly similar to Textile) to HTML and then HTML to Markdown using Turndown.

Basic Usage

Current format Textile - convert all rich text to Markdown using the default TextileToMarkdown converter setup:

rake reformat:convert to_formatting=markdown

Dry run:

rake reformat:convert to_formatting=markdown dryrun=1

Parallel processing (Unix/Linux only):

rake reformat:convert to_formatting=markdown workers=10

If already using the commmon_mark format patch (see #32424):

convcfg='[{
  "from_formatting": "textile",
  "to_formatting": "common_mark",
  "converters": "TextileToMarkdown" 
}]'
rake reformat:convert to_formatting=common_mark converters_json="$convcfg" 

Convert to HTML (assuming a hypothetical html rich text format):

convcfg='[{
  "from_formatting": "textile",
  "to_formatting": "html",
  "converters": "RedmineFormatter" 
}]'
rake reformat:convert to_formatting=html converters_json="$convcfg" 

Convert using an external web service through intermediate HTML:

convcfg='[{
  "from_formatting": "textile",
  "to_formatting": "common_mark",
  "converters": [
    ["RedmineFormatter"],
    ["Ws", "http://localhost:4000/turndown-uservice"]
  ]
}]'
rake reformat:convert to_formatting=common_mark converters_json="$convcfg" 

For advanced scenarios and more info, visit the homepage.

Questions, Contributions and Issues

Feel free to open a ticket or PR on project's GitHub

Happy reformatting!

Installation notes

Database Backup

Either backup your database or clone your Redmine instance completely. A cloned Redmine instance allows you to compare conversion results with the original.

Install

cd $REDMINE_ROOT
git -C plugins clone https://github.com/orchitech/redmine_reformat.git
bundle install

And restart your Redmine.

Installing Converter Dependencies

If using TextileToMarkdown converter, install pandoc. The other provided converters have no direct dependencies.

Changelog

0.2.0 (2020-03-28)

Compatible with Redmine 4.2.x, 4.1.x, 4.0.x, 3.4.x, 3.3.x.

  • Introduced rake reformat:microservice to facilitate certain integration tests.
  • Rake task for Redmine format conversion has been renamed to rake reformat:convert.

0.1.1 (2020-02-25)

Compatible with Redmine 4.2.x, 4.1.x, 4.0.x, 3.4.x, 3.3.x.

from_formatting and to_fromatting in converter config can be specified as an array, so that a single converter spec can match more formats.

0.1.0 (2020-02-19)

Compatible with Redmine 4.2.x, 4.1.x, 4.0.x, 3.4.x, 3.3.x.

User ratings

  by Ji-Hyeon Gim about 1 month ago

  by Sandra Tatarevicova about 1 month ago

  by Lucie Nevludov√° about 1 month ago