Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
New script: txt2html.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
definite committed Jan 18, 2013
1 parent 2896753 commit 7337750
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions concordion/txt2html.sh
@@ -0,0 +1,49 @@
#!/bin/sh

function print_usage(){
cat <<END
$0 - Convert asciidoc to concordion html
SYNOPSIS
$0 <TxtFile> <htmlDir|htmlFile>
DESCRIPTION
This program convert an asciidoc text file to concodion
instrumented html file. For example:
$0 TestCase1.txt TestCases/
will convert TestCase1.txt to TestCases/TextCase1.html
If target file is already exist, this program will not touch it
and exit with -2.
EXIT STATUS
0: if everything is normal.
-1: Source file cannot be read.
-2: Target file exists.
1: Other error.
END
}

src=$1
name=`basename $src .txt`
target=$2

if [ ! -r $src ];then
echo "Cannot read $src" > /dev/stderr
exit -1
fi

if [ -d $target ];then
target="$target/$name.html"
fi

if [ -e $target ];then
echo "Target file $target already exists" > /dev/stderr
exit -2
fi

scriptDir=`dirname $0`
cfgFile=$scriptDir/xhtml11.conf

asciidoc -f $cfgFile -o $target $src
exit $?

0 comments on commit 7337750

Please sign in to comment.