Created
March 6, 2013 18:31
-
-
Save dergachev/5101793 to your computer and use it in GitHub Desktop.
pandoc2redmine.sh - wrapper script on pandoc to fix textile output for Redmine compatibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/env bash | |
cat $1 | ruby -pe 'puts " "*20 if $_.match("^```$")' \ | |
| pandoc -f markdown -t textile \ | |
| ruby -r CGI -n -e 'print CGI.unescapeHTML($_);' \ | |
| ruby -ne 'puts $_ unless $_.match(" "*20)' \ | |
| pbcopy | |
# without spaces, pandoc outputs "bc." for code blocks, which isn't accepted to redmine | |
# it also annoyingly HTML escapes its pre- block contents | |
# for more info, see https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Writers/Textile.hs#L136 | |
# see http://johnmacfarlane.net/pandoc/README.html#bullet-lists for nested bullet syntax |
If you write with Github's markdown change markdown
to gfm
in the snippet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vim snippet: