General

Convert Markdown to Textile into a Ubuntu clipboard.

Convert Markdown to Textile into a Ubuntu clipboard.

I use this script to convert Zim article (Markdown code) to Textile code for report wrting on Rad mine.

#!/bin/bash
# Author: Pasakorn Tiwatthanont, a.k.a. iPAS
# Revised: 28/01/2014

if [ $# -eq 0 ]; then
echo “Markdown to Textile converter via Pandoc.”
echo \> `basename $0` \<file-markdown\>
exit 255
fi

if [ ! -f $1 ]; then
echo “File $1 do not exist!”
exit 255
fi

fi=$1
if [ “$2” != “” ]; then
fo=$2
else
fo=`echo $1 | sed ‘s/\..*$//’`.textile
fi

if [ “$fo” == “-” ]; then
pandoc -f markdown -t textile -o $fo $fi | xclip -selection c
else
pandoc -f markdown -t textile -o $fo $fi
fi

Advertisements
มาตรฐาน

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s