This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 $? |