commit 5faf884dc60c3ebd27734fe5f649acfb92025af8
parent a0bd07e6294ca43e196fd298fcac95f92bc7db2e
Author: Maxim Kim <habamax@gmail.com>
Date: Mon, 17 Jun 2013 07:50:44 +0400
Add missing helper markdown converter from google code.
Diffstat:
1 file changed, 62 insertions(+), 0 deletions(-)
diff --git a/autoload/vimwiki/customwiki2html.sh b/autoload/vimwiki/customwiki2html.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+#
+# This script converts markdown into html, to be used with vimwiki's
+# "customwiki2html" option. Experiment with the two proposed methods by
+# commenting / uncommenting the relevant lines below.
+#
+# NEW! An alternative converter was developed by Jason6Anderson, and can
+# be located at http://code.google.com/p/vimwiki/issues/detail?id=384
+#
+#
+# To use this script, you must have the Discount converter installed.
+#
+# http://www.pell.portland.or.us/~orc/Code/discount/
+#
+# To verify your installation, check that the commands markdown and mkd2text,
+# are on your path.
+#
+# Also verify that this file is executable.
+#
+# Then, in your .vimrc file, set:
+#
+# g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh'
+#
+# On your next restart, Vimwiki will run this script instead of using the
+# internal wiki2html converter.
+#
+
+MARKDOWN=markdown
+MKD2HTML=mkd2html
+
+
+FORCE="$1"
+SYNTAX="$2"
+EXTENSION="$3"
+OUTPUTDIR="$4"
+INPUT="$5"
+CSSFILE="$6"
+
+FORCEFLAG=
+
+[ $FORCE -eq 0 ] || { FORCEFLAG="-f"; };
+[ $SYNTAX = "markdown" ] || { echo "Error: Unsupported syntax"; exit -2; };
+
+OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html
+
+# # Method 1:
+# # markdown [-d] [-T] [-V] [-b url-base] [-C prefix] [-F bitmap] [-f flags] [-o file] [-s text] [-t text] [textfile]
+#
+# URLBASE=http://example.com
+# $MARKDOWN -T -b $URLBASE -o $OUTPUT $INPUT
+
+
+# Method 2:
+# mkd2html [-css file] [-header string] [-footer string] [file]
+
+$MKD2HTML -css "$CSSFILE" "$INPUT"
+OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html
+mv -f "$OUTPUTTMP" "$OUTPUT"
+
+
+