| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | ## ================================================================= |
|---|
| 4 | ## Logtalk - Object oriented extension to Prolog |
|---|
| 5 | ## Release 2.21.0 |
|---|
| 6 | ## |
|---|
| 7 | ## Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved. |
|---|
| 8 | ## ================================================================= |
|---|
| 9 | |
|---|
| 10 | XT_PATH="/Applications/XML/XT" |
|---|
| 11 | # XT_PATH="/usr/local/XT" |
|---|
| 12 | |
|---|
| 13 | XSLT="lgthtml.xsl" |
|---|
| 14 | |
|---|
| 15 | if [ -z "$1" ]; then |
|---|
| 16 | title="Entity documentation index" |
|---|
| 17 | else |
|---|
| 18 | title="$1" |
|---|
| 19 | fi |
|---|
| 20 | |
|---|
| 21 | echo |
|---|
| 22 | echo This script converts all .xml files in the current directory to .html |
|---|
| 23 | echo files applying the XSLT transformation defined in the $XSLT file |
|---|
| 24 | echo using the James Clark XT XSLT Java processor 20020426a or later version. |
|---|
| 25 | echo |
|---|
| 26 | echo An index.html file, containing links to all .html documenting files, |
|---|
| 27 | echo is automatically generated. This file uses the script optional parameter |
|---|
| 28 | echo value as the title of the index.html file. |
|---|
| 29 | echo |
|---|
| 30 | echo converting XML files to HTML... |
|---|
| 31 | |
|---|
| 32 | for file in *.xml; do |
|---|
| 33 | echo " converting" $file |
|---|
| 34 | name="`expr "$file" : '\(.*\)\.[^./]*$' \| "$file"`" |
|---|
| 35 | eval java -cp ${XT_PATH}/xt.jar:${XT_PATH}/lib/xp.jar -Dcom.jclark.xsl.sax.parser=com.jclark.xml.sax.CommentDriver com.jclark.xsl.sax.Driver $file $XSLT $name.html |
|---|
| 36 | done |
|---|
| 37 | |
|---|
| 38 | echo conversion done |
|---|
| 39 | echo |
|---|
| 40 | echo generating index file... |
|---|
| 41 | |
|---|
| 42 | echo "" > index.html |
|---|
| 43 | |
|---|
| 44 | echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">" >> index.html |
|---|
| 45 | echo "<html>" >> index.html |
|---|
| 46 | echo "<head>" >> index.html |
|---|
| 47 | echo " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" >> index.html |
|---|
| 48 | echo " <title>"$title"</title>" >> index.html |
|---|
| 49 | echo " <link rel=\"stylesheet\" href=\"logtalk.css\" type=\"text/css\">" >> index.html |
|---|
| 50 | echo "</head>" >> index.html |
|---|
| 51 | echo "<body>" >> index.html |
|---|
| 52 | echo "<h1>"$title"</h1>" >> index.html |
|---|
| 53 | echo "<ul>" >> index.html |
|---|
| 54 | |
|---|
| 55 | for file in *.xml; do |
|---|
| 56 | name="`expr "$file" : '\(.*\)\.[^./]*$' \| "$file"`" |
|---|
| 57 | echo " indexing" $name.html |
|---|
| 58 | echo " <li><a href=\""$name.html"\">"$name"</a></li>" >> index.html |
|---|
| 59 | done |
|---|
| 60 | |
|---|
| 61 | echo "</ul>" >> index.html |
|---|
| 62 | |
|---|
| 63 | date="`eval date`" |
|---|
| 64 | |
|---|
| 65 | echo "<p>Generated on "$date"</p>" >> index.html |
|---|
| 66 | echo "</body>" >> index.html |
|---|
| 67 | echo "</html>" >> index.html |
|---|
| 68 | |
|---|
| 69 | echo index file generated |
|---|
| 70 | echo |
|---|