7 # Author: Clemens Kraus (http://www.clemens-kraus.de)
14 # Unpack vym-file, only if it is one
16 echo $VYMFILE_EXT | grep -F ".vym" 1>/dev/null
19 echo ">> Unpacking files ..."
20 unzip $VYMFILE_EXT -d $VYMPATH 1>/dev/null
21 if [ $? -gt 0 ] ; then
22 echo ">>> Error in unzip! Aborting."
32 if [ -z $STYLESHEETP ] ; then
33 echo ">>> Error: could not process stylesheet "$STYLESHEETP"! Aborting."
36 if [ -n $VYMPATH ] ; then
37 if [ -n "$WIKISTYLEP" ] ; then
38 mkdir -p $VYMPATH/images
39 cp `dirname $STYLESHEETP`/wiki/* $VYMPATH/images
40 if [ $? -gt 0 ] ; then
41 echo ">>> Warning: could not copy images for WIKI style
42 \""$STYLESHEETP"/wiki/*\"!"
44 echo ">> WIKI style images \""$STYLESHEETP"/wiki/*\" copied ..."
47 cp `dirname $STYLESHEETP`/$CSSFILE $VYMPATH
48 if [ $? -gt 0 ] ; then
49 echo ">>> Warning: could not copy CSS-file \""$CSSFILE"\"!"
51 echo ">> CSS-file \""$CSSFILE"\" copied ..."
56 echo ">> Starting XSLT transformation ..."
58 OPTIONS=" -o $VYMFILE.html \
59 --stringparam filenamep \"$VYMFILE\" \
60 --stringparam wikistylep \"$WIKISTYLEP\" \
61 --stringparam genimagep \"$GENIMAGEP\" \
62 --stringparam imageonlyp \"$IMAGEONLYP\" \
63 --stringparam urlHeadingp \"$URLHEADING\" \
64 --stringparam urlImagep \"$URLIMG\" \
65 --stringparam stylesheetp $CSSFILE \
66 `dirname $STYLESHEETP`/vym2html.xsl \
70 # echo Executing: xsltproc $OPTIONS 2>&1
71 # xsltproc $OPTIONS 2>&1
73 xsltproc -o $VYMPATH/$VYMNAME".html" --stringparam filenamep "$VYMPATH/$VYMNAME" --stringparam wikistylep "$WIKISTYLEP" --stringparam genimagep "$GENIMAGEP" --stringparam imageonlyp "$IMAGEONLYP" --stringparam urlHeadingp "$URLHEADING" --stringparam urlImagep "$URLIMAGE" --stringparam stylesheetp "$CSSFILE" `dirname $STYLESHEETP`/vym2html.xsl $VYMPATH/$VYMNAME".xml" 2>&1
75 if [ $? -gt 0 ] ; then
76 echo ">>> Error in xsltproc! Aborting."
84 # change all txt-files into xml-format
86 for i in `ls $VYMPATH/notes/$VYMNAME-note-*.txt 2>/dev/null`
88 # Check whether already modified
89 grep "<note>" $i 1>/dev/null
91 if [ $? -gt 0 ] ; then
92 echo ">> Modifying: "$i
94 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $i
96 if [ -z "$WIKISTYLEP" ] ; then
97 echo "<![CDATA[" >> $i
102 if [ -z "$WIKISTYLEP" ] ; then
114 # remove all temporary unpacked vym-files
116 echo $VYMFILE_EXT | grep -F ".vym" 1>/dev/null
119 echo ">> Removing temporary files ..."
120 for i in `ls $VYMPATH/notes/$VYMNAME-note-*.txt 2>/dev/null`
125 for i in `ls $VYMPATH/images/$VYMNAME-image-*.* 2>/dev/null`
130 rm $VYMPATH/$VYMFILE".xml" 2>/dev/null
137 # optional: reducing image-size
138 echo ">> reducing image size to 256 colors ..."
139 convert -colors 255 $VYMPATH/images/$VYMFILE".png" $VYMPATH/images/$VYMFILE".png"
143 # -------------------- Parameter check -----------------------
150 USAGE="USAGE:\t`basename $0` vymfile.[vym|xml] -sp=\077 [Options]\n
151 \t-sp=\077: absolute stylesheet path (including name of stylesheet)\n
152 Output:\tvymfile.html\n\n
154 -image: creates a clickable image at the beginning of the HTML-output\n
155 -imageonly: creates a clickable image without further HTML-output\n
156 -URLHeading: if set, URLs will show the heading\n
157 -URLImage: if set, URLs will show the globe visible in the map\n
158 -css=\077: tell vym2html to use this CSS-file, default is '$CSSFILE'\n
159 -v: prints the version of vym2html\n
160 -wikistyle: activates some wiki-shortcuts\n
161 \tWiki-style notation overview: \n
163 \t+ Big headlines start with the '+' character.\n
164 \t- Small headlines start with the '-' character.\n
165 \t Normal text doesn't have any starting notation.\n
166 \t! Notes start with an exclamation.\n
167 \t. Indented text starts with a dot.\n
168 \t\077 Questions start with a question-mark, and\n
169 \t= Answers starts with the equal-sign.\n
170 \t\052 Points for a item-list\n
174 \tuse '{...}' or '{(Clemens homepage) http://www.clemens-kraus.de/}'\n\tfor external links.\n
177 \t|This is bold| text, while |/this text is italic|, \n\t|*this is pre-formatted|, and |!this is a note|"
179 if [ "$1" = '-v' ]; then
180 echo "vym2html Version: "$VERSION
185 if [ $# -lt 2 ]; then
190 VYMNAME=`echo $VYMFILE_EXT | sed "s/.*\///" | sed "s/\\..*$//"`
191 VYMPATH=`dirname $VYMFILE_EXT`
197 if [ "$arg" = '-wikistyle' ]; then
199 elif [ "$arg" = '-image' ]; then
201 elif [ "$arg" = '-imageonly' ]; then
204 elif [ ${arg:0:3} = '-sp' ]; then # take first 3 chars
205 STYLESHEETP=`echo $arg | cut -d= -f2`
206 elif [ ${arg:0:4} = '-css' ]; then # take first 4 chars
207 CSSFILE=`echo $arg | cut -d= -f2`
208 elif [ $arg = "-useURLHeading" ]; then
210 elif [ $arg = "-useURLImage" ]; then
212 elif [ "$arg" = '-help' ]; then
222 echo VYMFILE_EXT=$VYMFILE_EXT
223 echo VYMNAME=$VYMNAME
224 echo VYMPATH=$VYMPATH
225 #echo WIKISTYLEP=$WIKISTYLEP
228 # ---------------------- Los geht's --------------------------
229 echo ">> Processing file '$VYMFILE_EXT' ..."
234 # Modify "*-note-x.txt" files
246 echo ">> ---------------------"