|
From: <fr...@us...> - 2004-01-02 16:47:51
|
Update of /cvsroot/devil-linux/scripts/webtools
In directory sc8-pr-cvs1:/tmp/cvs-serv6632
Modified Files:
generate_docs_from_cvs
Log Message:
create submenu automatically and a lot of other small fixes and improvements
Index: generate_docs_from_cvs
===================================================================
RCS file: /cvsroot/devil-linux/scripts/webtools/generate_docs_from_cvs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- generate_docs_from_cvs 2 Jan 2004 02:18:28 -0000 1.11
+++ generate_docs_from_cvs 2 Jan 2004 16:47:48 -0000 1.12
@@ -20,6 +20,9 @@
DOC_PATH="docu"
WEB_PATH="documentation"
+# the submenu file to generate
+SUBMENU="submenu.shtml"
+
#------------------------------------#
# nothing to config below this line! #
#------------------------------------#
@@ -38,9 +41,11 @@
local THIS_DOCU_PATH=${DOC_PATH}/$version
local THIS_WEB_PATH=${WEB_PATH}/$version
+ local THIS_SUBMENU=${DOC_PATH}/${SUBMENU}
+ local THIS_SUBMENU_PATH=${WEB_PATH}/${SUBMENU}
# clean up first as someone might have messed up before
- rm -rf build output.html
+ rm -rf ${MODULE%%/*} output.html
echo "generating docs for version $version"
@@ -58,7 +63,7 @@
# use special style sheet when generating for the devil homepage?
[ "$HOMEPAGE" = "yes" ] && style="devil_homepage"
- # link output.html to final destination directory
+ # link output.html to final destination directory so we generate in-place
ln -s ${THIS_DOCU_PATH} output.html
echo Generating HTML
@@ -70,7 +75,7 @@
echo Cleaning up the HTML
for F in $(find ${THIS_DOCU_PATH} -name "*.html")
do
- ${MODULE}/tools/tidy -m $F
+ ${MODULE}/tools/tidy -modify -clean $F
done
mkdir -p output.html/images/ || exit 1
@@ -79,7 +84,15 @@
cp -dpR ${MODULE}/images/*.png output.html/images || exit 1
# clean up behind us
- rm -rf build output.html
+ rm -rf ${MODULE%%/*} output.html
+
+ # add an entry to the submenu file so a link to this version
+ # of the documentation shows up in the navigation[C
+ echo -n creating submenu entry...
+ cat >> ${THIS_SUBMENU} <<-EOF
+ <p class="menu"> <!--#if expr="\${SECTION} != ${THIS_WEB_PATH}" --><a href="/${THIS_WEB_PATH}/"><!--#endif -->Version ${version}<!--#if expr="\${SECTION} != ${THIS_WEB_PATH}" --></a><!--#endif --></p>
+EOF
+ echo done.
# post processing
echo postprocessing:
@@ -92,33 +105,42 @@
echo " * ${SRC_FILE} -> ${DST_FILE}, ${HEAD_FILE}, ${CONTENT_FILE}"
- # filter the content for the "right frame" and replace all local
+ # filter source file and replace all local
# references to xxx.html with xxx.shtml
- sed -e 's|\("[a-z0-9]\+\)\.html\(\(#[a-z0-9]\+\)\?"\)|\1.shtml\2|g' <${THIS_DOCU_PATH}/${SRC_FILE} >${THIS_DOCU_PATH}/${CONTENT_FILE}
+ sed -e 's|\("[a-z0-9]\+\)\.html\(\(#[a-z0-9]\+\)\?"\)|\1.shtml\2|g' \
+ <${THIS_DOCU_PATH}/${SRC_FILE} \
+ >${THIS_DOCU_PATH}/${SRC_FILE}.2
+ mv ${THIS_DOCU_PATH}/${SRC_FILE}.2 ${THIS_DOCU_PATH}/${SRC_FILE}
+
+ # the "right frame"
+ perl -e '$_=join("",<STDIN>); s|^.*<body[^>]*>||is; s|</body>.*$||is; print $_' \
+ <${THIS_DOCU_PATH}/${SRC_FILE} \
+ >${THIS_DOCU_PATH}/${CONTENT_FILE}
# the head section
-# cat > ${THIS_DOCU_PATH}/${HEAD_FILE} <<-EOF
-# <!-- HEADER comes here -->
-#EOF
- touch ${THIS_DOCU_PATH}/${HEAD_FILE}
+ perl -e '$_=join("",<STDIN>); s|^.*<head>||is; s|</head>.*$||is; print $_' \
+ <${THIS_DOCU_PATH}/${SRC_FILE} \
+ >${THIS_DOCU_PATH}/${HEAD_FILE}
- # this will put all together incl. the navigation
+ # this file will put head, content and central navigation together
cat > ${THIS_DOCU_PATH}/${DST_FILE} <<-EOF
- <!--#set var="THIS_PAGE" value="${THIS_PAGE}" --><!--#set var="SECTION" value="${THIS_WEB_PATH}" --><!--#include virtual="../../index.shtml" -->
+ <!--#set var="THIS_PAGE" value="${THIS_PAGE}" --><!--#set var="SECTION" value="${THIS_WEB_PATH}" --><!--#set var="SUBMENU" value="${THIS_SUBMENU_PATH}" --><!--#include virtual="../../index.shtml" -->
EOF
# file processed therefore we don't need it anymore
rm -f ${THIS_DOCU_PATH}/${SRC_FILE}
done
+
}
cd /home/groups/d/de/devil-linux || exit 1
-echo test -d docu \&\& rm -rf docu
-test -d docu && rm -rf docu
-echo mkdir -p docu \|\| exit 1
-mkdir -p docu || exit 1
+echo rm -rf ${DOC_PATH} \|\| exit 1
+rm -rf ${DOC_PATH} || exit 1
+
+echo mkdir -p ${DOC_PATH} \|\| exit 1
+mkdir -p ${DOC_PATH} || exit 1
for GEN in $GENERATE; do
version=${GEN%%:*}
@@ -128,7 +150,7 @@
done
echo -n "Cleaning up and updating rights..."
-find docu/ -type f | xargs chmod 0664
-find docu/ -type d | xargs chmod 2775
+find ${DOC_PATH}/ -type f | xargs chmod 0664
+find ${DOC_PATH}/ -type d | xargs chmod 2775
echo done.
|