Minor updates
authorinsilmaril
Wed Jul 18 10:15:46 2007 +0000 (2007-07-18)
changeset 55549f2d7a5f85d
parent 554 34520279e086
child 556 3b4f7dfc12c2
Minor updates
demos/vym-projectplan.vym
scripts/vym2html.sh
scripts/vym2txt.sh
     1.1 Binary file demos/vym-projectplan.vym has changed
     2.1 --- a/scripts/vym2html.sh	Tue Jul 17 11:20:20 2007 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,250 +0,0 @@
     2.4 -#!/bin/sh
     2.5 -#
     2.6 -# vym2html.sh
     2.7 -#
     2.8 -VERSION="0.7"
     2.9 -# Date: 20040625
    2.10 -# Author: Clemens Kraus (http://www.clemens-kraus.de)
    2.11 -#
    2.12 -# AddOns: Uwe Drechsel
    2.13 -#echo $@
    2.14 -
    2.15 -
    2.16 -unpacker()
    2.17 -# Unpack vym-file, only if it is one
    2.18 -{
    2.19 -  echo $VYMFILE_EXT | grep -F ".vym" 1>/dev/null
    2.20 -
    2.21 -  if [ $? = 0 ] ; then
    2.22 -	  echo ">> Unpacking files ..."
    2.23 -	  unzip $VYMFILE_EXT -d $VYMPATH 1>/dev/null
    2.24 -	  if [ $? -gt 0 ] ; then
    2.25 -		echo ">>> Error in unzip! Aborting."
    2.26 -	  	exit 4
    2.27 -	  fi
    2.28 -  fi
    2.29 -}
    2.30 -
    2.31 -
    2.32 -transform()
    2.33 -{
    2.34 -  # copy stylesheet
    2.35 -  if [ -z $STYLESHEETP ] ; then
    2.36 -	  echo ">>> Error: could not process stylesheet "$STYLESHEETP"! Aborting."
    2.37 -	  exit 5
    2.38 -  else
    2.39 -	  if [ -n $VYMPATH ] ; then
    2.40 -		  if [ -n "$WIKISTYLEP" ] ; then
    2.41 -		    mkdir -p $VYMPATH/images
    2.42 -			cp `dirname $STYLESHEETP`/wiki/* $VYMPATH/images
    2.43 -			if [ $? -gt 0 ] ; then
    2.44 -				echo ">>> Warning: could not copy images for WIKI style
    2.45 -				\""$STYLESHEETP"/wiki/*\"!"
    2.46 -			else
    2.47 -			  echo ">> WIKI style images \""$STYLESHEETP"/wiki/*\" copied ..."
    2.48 -			fi  
    2.49 -		  fi
    2.50 -	  	cp `dirname $STYLESHEETP`/$CSSFILE $VYMPATH
    2.51 -		if [ $? -gt 0 ] ; then
    2.52 -			echo ">>> Warning: could not copy CSS-file \""$CSSFILE"\"!"
    2.53 -		else
    2.54 -		  echo ">> CSS-file \""$CSSFILE"\" copied ..."
    2.55 -		fi
    2.56 -	  fi
    2.57 -  fi
    2.58 -  
    2.59 -  echo ">> Starting XSLT transformation ..."
    2.60 -
    2.61 -  OPTIONS=" -o $VYMFILE.html \
    2.62 -  --stringparam filenamep \"$VYMFILE\" \
    2.63 -  --stringparam wikistylep \"$WIKISTYLEP\" \
    2.64 -  --stringparam genimagep \"$GENIMAGEP\" \
    2.65 -  --stringparam imageonlyp \"$IMAGEONLYP\" \
    2.66 -  --stringparam urlHeadingp \"$URLHEADING\" \
    2.67 -  --stringparam urlImagep \"$URLIMG\" \
    2.68 -  --stringparam stylesheetp $CSSFILE  \
    2.69 -  `dirname $STYLESHEETP`/vym2html.xsl \
    2.70 -  $VYMFILE.xml "
    2.71 -  
    2.72 -  
    2.73 -# echo Executing: xsltproc $OPTIONS 2>&1
    2.74 -#  xsltproc $OPTIONS 2>&1
    2.75 -
    2.76 -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
    2.77 -
    2.78 -  if [ $? -gt 0 ] ; then
    2.79 -	  echo ">>> Error in xsltproc! Aborting."
    2.80 -	  exit 3
    2.81 -  fi
    2.82 -  
    2.83 -}
    2.84 -
    2.85 -
    2.86 -txt2html()
    2.87 -# change all txt-files into xml-format
    2.88 -{
    2.89 -  for i in `ls $VYMPATH/notes/$VYMNAME-note-*.txt 2>/dev/null`
    2.90 -  do
    2.91 -    # Check whether already modified
    2.92 -	grep "<note>" $i 1>/dev/null
    2.93 -	
    2.94 -	if [ $? -gt 0 ] ; then
    2.95 -	  echo ">> Modifying: "$i
    2.96 -	  cp $i $i"_tmp"
    2.97 -	  echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $i
    2.98 -	  echo "<note>" >> $i
    2.99 -	  if [ -z "$WIKISTYLEP" ] ; then
   2.100 -		  echo "<![CDATA[" >> $i
   2.101 -	  fi
   2.102 -	  
   2.103 -	  cat $i"_tmp" >> $i
   2.104 -  
   2.105 -	  if [ -z "$WIKISTYLEP" ] ; then
   2.106 -		  echo "]]>" >> $i
   2.107 -	  fi
   2.108 -	  echo "</note>" >> $i
   2.109 -  
   2.110 -	  rm $i"_tmp"
   2.111 -	fi
   2.112 -  done
   2.113 -}
   2.114 -
   2.115 -
   2.116 -remove_files()
   2.117 -# remove all temporary unpacked vym-files
   2.118 -{
   2.119 -  echo $VYMFILE_EXT | grep -F ".vym" 1>/dev/null
   2.120 -	
   2.121 -  if [ $? = 0 ] ; then
   2.122 -	echo ">> Removing temporary files ..."
   2.123 -	for i in `ls $VYMPATH/notes/$VYMNAME-note-*.txt 2>/dev/null`
   2.124 -	do
   2.125 -	  rm $i
   2.126 -	done
   2.127 -  
   2.128 -	for i in `ls $VYMPATH/images/$VYMNAME-image-*.* 2>/dev/null`
   2.129 -	do
   2.130 -	  rm $i
   2.131 -	done
   2.132 -  
   2.133 -	rm $VYMPATH/$VYMFILE".xml" 2>/dev/null
   2.134 -  fi
   2.135 -}
   2.136 -
   2.137 -
   2.138 -reducesize()
   2.139 -{
   2.140 -  # optional: reducing image-size
   2.141 -  echo ">> reducing image size to 256 colors ..."
   2.142 -  convert -colors 255 $VYMPATH/images/$VYMFILE".png" $VYMPATH/images/$VYMFILE".png"
   2.143 -}
   2.144 -
   2.145 -
   2.146 -# -------------------- Parameter check -----------------------
   2.147 -GENIMAGEP=""
   2.148 -IMAGEONLYP=""
   2.149 -WIKISTYLEP=""
   2.150 -STYLESHEETP=""
   2.151 -CSSFILE="vym.css"
   2.152 -
   2.153 -USAGE="USAGE:\t`basename $0`  vymfile.[vym|xml]  -sp=\077  [Options]\n
   2.154 -\t-sp=\077: absolute stylesheet path (including name of stylesheet)\n
   2.155 -Output:\tvymfile.html\n\n
   2.156 -Options:\n
   2.157 --image: creates a clickable image at the beginning of the HTML-output\n
   2.158 --imageonly: creates a clickable image without further HTML-output\n
   2.159 --URLHeading: if set, URLs will show the heading\n
   2.160 --URLImage: if set, URLs will show the globe visible in the map\n
   2.161 --css=\077: tell vym2html to use this CSS-file, default is '$CSSFILE'\n
   2.162 --v: prints the version of vym2html\n
   2.163 --wikistyle: activates some wiki-shortcuts\n
   2.164 -\tWiki-style notation overview: \n
   2.165 -\tLines:\n
   2.166 -\t+ Big headlines start with the '+' character.\n
   2.167 -\t- Small headlines start with the '-' character.\n
   2.168 -\t  Normal text doesn't have any starting notation.\n
   2.169 -\t! Notes start with an exclamation.\n
   2.170 -\t. Indented text starts with a dot.\n
   2.171 -\t\077 Questions start with a question-mark, and\n
   2.172 -\t= Answers starts with the equal-sign.\n
   2.173 -\t\052 Points for a item-list\n
   2.174 -\t# clues\n
   2.175 -\n
   2.176 -\tLinks:\n
   2.177 -\tuse '{...}' or '{(Clemens homepage) http://www.clemens-kraus.de/}'\n\tfor external links.\n
   2.178 -\n
   2.179 -\tMarkup:\n
   2.180 -\t|This is bold| text, while |/this text is italic|, \n\t|*this is pre-formatted|, and |!this is a note|"
   2.181 -
   2.182 -if [ "$1" = '-v' ]; then
   2.183 -	  echo "vym2html Version: "$VERSION
   2.184 -	  exit 0
   2.185 -fi
   2.186 -
   2.187 -
   2.188 -if [ $# -lt 2  ]; then 
   2.189 -	echo -e $USAGE
   2.190 -	exit 1
   2.191 -else
   2.192 -	VYMFILE_EXT=$1
   2.193 -	VYMNAME=`echo $VYMFILE_EXT | sed "s/.*\///" | sed "s/\\..*$//"`
   2.194 -	VYMPATH=`dirname $VYMFILE_EXT`
   2.195 -fi
   2.196 -
   2.197 -shift 1
   2.198 -
   2.199 -for arg do
   2.200 -  if [ "$arg" = '-wikistyle' ]; then
   2.201 -	  WIKISTYLEP="yes"
   2.202 -  elif [ "$arg" = '-image' ]; then
   2.203 -	  GENIMAGEP="yes"
   2.204 -  elif [ "$arg" = '-imageonly' ]; then
   2.205 -	  IMAGEONLYP="yes"
   2.206 -	  GENIMAGEP="yes"
   2.207 -  elif [ ${arg:0:3} = '-sp' ]; then			# take first 3 chars
   2.208 -	  STYLESHEETP=`echo $arg | cut -d= -f2`
   2.209 -  elif [ ${arg:0:4} = '-css' ]; then		# take first 4 chars
   2.210 -	  CSSFILE=`echo $arg | cut -d= -f2`
   2.211 -  elif [ $arg = "-useURLHeading" ]; then
   2.212 -		URLHEADING="yes"		
   2.213 -  elif [ $arg = "-useURLImage" ]; then
   2.214 -		URLIMAGE="yes"		
   2.215 -  elif [ "$arg" = '-help' ]; then
   2.216 -	echo -e $USAGE
   2.217 -	exit 1
   2.218 -  else
   2.219 -	echo -e $USAGE
   2.220 -	exit 1
   2.221 -  fi
   2.222 -done
   2.223 -
   2.224 -#Debugging
   2.225 -echo VYMFILE_EXT=$VYMFILE_EXT
   2.226 -echo VYMNAME=$VYMNAME
   2.227 -echo VYMPATH=$VYMPATH
   2.228 -#echo WIKISTYLEP=$WIKISTYLEP
   2.229 -
   2.230 -
   2.231 -# ---------------------- Los geht's --------------------------
   2.232 -echo ">> Processing file '$VYMFILE_EXT' ..."
   2.233 -
   2.234 -# Unpack vym-file
   2.235 -unpacker
   2.236 -
   2.237 -# Modify "*-note-x.txt" files
   2.238 -txt2html
   2.239 -
   2.240 -# Transform
   2.241 -transform
   2.242 -
   2.243 -#reducesize
   2.244 -
   2.245 -# clean up
   2.246 -remove_files
   2.247 -
   2.248 -echo ">> Ready!"
   2.249 -echo ">> ---------------------"
   2.250 -
   2.251 -exit 0
   2.252 -
   2.253 -
     3.1 --- a/scripts/vym2txt.sh	Tue Jul 17 11:20:20 2007 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,144 +0,0 @@
     3.4 -#!/bin/sh
     3.5 -#
     3.6 -# vym2txt.sh
     3.7 -#
     3.8 -VERSION="0.11"
     3.9 -# Date: 20040417
    3.10 -# Author: Clemens Kraus (http://www.clemens-kraus.de)
    3.11 -#
    3.12 -#echo $@
    3.13 -
    3.14 -
    3.15 -unpacker()
    3.16 -# Unpack vym-file, only if it is one
    3.17 -{
    3.18 -  echo $VYMFILE_EXT | grep -F ".vym" 1>/dev/null
    3.19 -
    3.20 -  if [ $? = 0 ] ; then
    3.21 -	  echo ">> Unpacking files ..."
    3.22 -	  unzip $VYMFILE_EXT -d $VYMFILE_PATH 1>/dev/null
    3.23 -	  if [ $? -gt 0 ] ; then
    3.24 -		echo ">>> Error in unzip! Aborting."
    3.25 -	  	exit 4
    3.26 -	  fi
    3.27 -  fi
    3.28 -}
    3.29 -
    3.30 -
    3.31 -txt2xml()
    3.32 -# change all txt-files into xml-format
    3.33 -{
    3.34 -  for i in `ls $VYMFILE-note-*.txt 2>/dev/null`
    3.35 -  do
    3.36 -    # Check whether already modified
    3.37 -	grep "<note>" $i 1>/dev/null
    3.38 -	
    3.39 -	if [ $? -gt 0 ] ; then
    3.40 -	  echo ">> Modifying: "$i
    3.41 -	  # Each line gets an additional <line>-tag, because of the indents!
    3.42 -	  sed -e 's,^,<line><![CDATA[,g' -e 's,$,]]>\&#xA;</line>,g' $i > $i"_tmp"
    3.43 -	  
    3.44 -	  #cp $i $i"_tmp"
    3.45 -	  echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>" > $i
    3.46 -	  echo "<note>" >> $i
    3.47 -	  #echo "<![CDATA[" >> $i
    3.48 -	  cat $i"_tmp" >> $i
    3.49 -	  #echo "]]>" >> $i
    3.50 -	  echo "</note>" >> $i
    3.51 -  
    3.52 -	  rm $i"_tmp"
    3.53 -	fi
    3.54 -  done
    3.55 -}
    3.56 -
    3.57 -
    3.58 -transform()
    3.59 -{
    3.60 -  echo ">> Starting XSLT transformation ..."
    3.61 -# sabcmd vym2html.xsl $VYMFILE".xml"  \$filenamep=$VYMFILE \$wikistylep=$WIKISTYLEP \$genimagep=$GENIMAGEP \$stylesheetp=$STYLESHEETP > $VYMFILE".html"
    3.62 -  xsltproc -o $VYMFILE".txt" --stringparam filenamep `pwd`/"$VYMFILE" `dirname $STYLESHEETP`/vym2txt.xsl  $VYMFILE".xml"
    3.63 -  
    3.64 -  if [ $? -gt 0 ] ; then
    3.65 -	  echo ">>> Error in xsltproc! Aborting."
    3.66 -	  exit 3
    3.67 -  fi
    3.68 -}
    3.69 -
    3.70 -
    3.71 -remove_files()
    3.72 -# remove all temporary unpacked vym-files
    3.73 -{
    3.74 -  echo $VYMFILE_EXT | grep -F ".vym" 1>/dev/null
    3.75 -	
    3.76 -  if [ $? = 0 ] ; then
    3.77 -	echo ">> Removing temporary files ..."
    3.78 -	for i in `ls $VYMFILE-note-*.txt 2>/dev/null`
    3.79 -	do
    3.80 -	  rm $i
    3.81 -	done
    3.82 -  
    3.83 -	for i in `ls $VYMFILE-image-*.* 2>/dev/null`
    3.84 -	do
    3.85 -	  rm $i
    3.86 -	done
    3.87 -  
    3.88 -	rm $VYMFILE".xml" 2>/dev/null
    3.89 -  fi
    3.90 -}
    3.91 -
    3.92 -# -------------------- Parameter check -----------------------
    3.93 -STYLESHEETP=""
    3.94 -
    3.95 -USAGE="USAGE:\t`basename $0`  vymfile.[vym|xml]  -sp=\077  [Options]\n"
    3.96 -USAGE=$USAGE"\t-sp=\077: absolute stylesheet path (including name of stylesheet)\n"
    3.97 -USAGE=$USAGE"Output:\tvymfile.txt\n\n"
    3.98 -USAGE=$USAGE"Options:\n"
    3.99 -USAGE=$USAGE"-v: prints the version of vym2txt\n"
   3.100 -
   3.101 -if [ "$1" = '-v' ]; then
   3.102 -	  echo "vym2txt Version: "$VERSION
   3.103 -	  exit 0
   3.104 -fi
   3.105 -if [ $# -lt 1 -o $# -gt 2 -o "$1" = '-help' ]; then 
   3.106 -	echo -e $USAGE
   3.107 -	exit 1
   3.108 -else
   3.109 -	VYMFILE_EXT=$1
   3.110 -	VYMFILE=`echo $VYMFILE_EXT | cut -d. -f1`
   3.111 -	VYMFILE_PATH=`dirname $VYMFILE_EXT`
   3.112 -fi
   3.113 -
   3.114 -for arg in $2
   3.115 -do
   3.116 -  if [ ${arg:0:3} = '-sp' ]; then		# take first 3 chars
   3.117 -	  STYLESHEETP=`echo $arg | cut -d= -f2`
   3.118 -  elif [ "$arg" = '-help' ]; then
   3.119 -	echo -e $USAGE
   3.120 -	exit 1
   3.121 -  else
   3.122 -	echo -e $USAGE
   3.123 -	exit 1
   3.124 -  fi
   3.125 -done
   3.126 -
   3.127 -
   3.128 -# ---------------------- Los geht's --------------------------
   3.129 -echo ">> Processing file '$VYMFILE_EXT' ..."
   3.130 -
   3.131 -# Unpack vym-file
   3.132 -unpacker
   3.133 -
   3.134 -txt2xml
   3.135 -
   3.136 -# Transform
   3.137 -transform
   3.138 -
   3.139 -# clean up
   3.140 -remove_files
   3.141 -
   3.142 -echo ">> Ready!"
   3.143 -echo ">> ---------------------"
   3.144 -
   3.145 -exit 0
   3.146 -
   3.147 -