View File | Revision Log | Show Annotations | Download File | View Changeset
/hippo/hippo-documentation/hst_docs/trunk/scripts/any2CMS
Revision: 21417
Committed: Tue Jan 26 17:00:05 2010 UTC (10 years, 5 months ago) by rbijlsma
File size: 2640 byte(s)
Log Message:
HSTTWODOCS-242

File Contents

# Content
1 #!/bin/bash
2 # ----------------------------------------------------------------------------
3 # IDENTITY
4 # NAME
5 #
6
7 source rearg.bash
8
9 for flag; do
10 case "$flag" in
11 # OPTIONS
12 -n=*|--noot=*) #:: with optional argument, because see next one
13 toecho[1]="--noot, with optional argument: \`${flag#*=}'"
14 ;;
15 -n|--noot) #:: Version of --noot=* without optional argument
16 toecho[1]="--noot without optional argument"
17 ;;
18 -a|--aap|-j|--jet|-w|--wim|-z|--zus) #:: Simple flags here all whiped together
19 : ${nrsimple:=4}; toecho[$((nrsimple++))]="$flag a simple flag"
20 ;;
21 -m=*|--mies=*) #:: with required argument of which last is used if many.
22 toecho[2]="--mies, with required argument: \`${flag#*=}'"
23 ;;
24 -t=*|--teun=*) #:: with required argument of which many build an array.
25 teun[$[teunind++]]="${flag#*=}"
26 ;;
27 -- ) shift; break
28 ;;
29 -?* ) commonflag "$flag" "$0"; exit #Replace this in function or sourced script by:# -?* ) commonflag --func=$FUNCNAME $flag FILENAME; [ "$PS1" ] && return || exit # replace FILENAME with name of the script defining the function (and holding its helptext)
30 ;;
31 ?* ) break
32 ;;
33 esac; shift
34 done
35
36 putsep --keep 2> /dev/null || echo "#------------------------------------------------------$USER $(date +'%Y.%U.%w.%H:%M')"
37
38 realname=$(readlink -f "$0")
39 scriptdir="${realname%/*}"
40
41 for file
42 do
43 name="${file##*/}"
44 ext="${name#*\.}"
45 base="${name%\.*}"
46 if [ "$ext" == "html" ]
47 then
48 echo -e "${EXPLCOLOR}tidy $file$UNCOLOR"
49 tidy -asxml -utf8 "$file" > "${base}_wiki_auto.xml"
50 elif [ "$ext" == "txt" ]
51 then
52 echo -e "${EXPLCOLOR}txt2xml for $file$UNCOLOR"
53 type txt2xml
54 txt2xml "$file" > "${base}_txt_auto.xml"
55 fi
56 done
57
58 shopt -s nullglob
59
60 for wikixml in *_wiki_auto.xml
61 do
62 echo -e "${EXPLCOLOR}wiki2doc for $wikixml$UNCOLOR"
63 base="${wikixml%_wiki_auto.xml}"
64 xslt --stringparam filename "${base}" $scriptdir/wiki2doc.xsl "${base}_wiki_auto.xml" > "${base}_doc_auto.xml" # TODO folder
65 done
66
67 for wikixml in *_txt_auto.xml
68 do
69 echo -e "${EXPLCOLOR}txt2doc for $wikixml$UNCOLOR"
70 base="${wikixml%_txt_auto.xml}"
71 xslt --stringparam filename "${base}" $scriptdir/txt2doc.xsl "${base}_txt_auto.xml" > "${base}_doc_auto.xml" # TODO folder
72 done
73
74 for docfile in *_doc_auto.xml *_doc.xml
75 do
76 echo -e "${EXPLCOLOR}doc2cms for $docfile$UNCOLOR"
77 base="${docfile%_doc*}"
78 xslt $scriptdir/doc2jcr.xsl "${base}_doc_auto.xml" > "${base}_CMS_auto.xml"
79 echo -e "${EXPLCOLOR} Generated ${base}_CMS_auto.xml$UNCOLOR"
80 done
81
82

Properties

Name Value
svn:executable *