[GRASS-SVN] r32841 - in grass/trunk: imagery/i.ortho.photo/photo.2image imagery/i.ortho.photo/photo.camera imagery/i.ortho.photo/photo.init imagery/i.ortho.photo/photo.rectify include/Make tools

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 17 14:35:39 EDT 2008


Author: glynn
Date: 2008-08-17 14:35:38 -0400 (Sun, 17 Aug 2008)
New Revision: 32841

Modified:
   grass/trunk/imagery/i.ortho.photo/photo.2image/Makefile
   grass/trunk/imagery/i.ortho.photo/photo.camera/Makefile
   grass/trunk/imagery/i.ortho.photo/photo.init/Makefile
   grass/trunk/imagery/i.ortho.photo/photo.rectify/Makefile
   grass/trunk/include/Make/Html.make
   grass/trunk/tools/mkhtml.sh
Log:
Clean-up generation of HTML files


Modified: grass/trunk/imagery/i.ortho.photo/photo.2image/Makefile
===================================================================
--- grass/trunk/imagery/i.ortho.photo/photo.2image/Makefile	2008-08-17 14:59:19 UTC (rev 32840)
+++ grass/trunk/imagery/i.ortho.photo/photo.2image/Makefile	2008-08-17 18:35:38 UTC (rev 32841)
@@ -11,6 +11,5 @@
 
 default: etc
 
-$(PGM).tmp.html: $(PGM).html
-	$(INSTALL_DATA) $< $@
-
+$(PGM).tmp.html:
+	> $@

Modified: grass/trunk/imagery/i.ortho.photo/photo.camera/Makefile
===================================================================
--- grass/trunk/imagery/i.ortho.photo/photo.camera/Makefile	2008-08-17 14:59:19 UTC (rev 32840)
+++ grass/trunk/imagery/i.ortho.photo/photo.camera/Makefile	2008-08-17 18:35:38 UTC (rev 32841)
@@ -11,5 +11,5 @@
 
 default: etc
 
-$(PGM).tmp.html: $(PGM).html
-	$(INSTALL_DATA) $< $@
+$(PGM).tmp.html:
+	> $@

Modified: grass/trunk/imagery/i.ortho.photo/photo.init/Makefile
===================================================================
--- grass/trunk/imagery/i.ortho.photo/photo.init/Makefile	2008-08-17 14:59:19 UTC (rev 32840)
+++ grass/trunk/imagery/i.ortho.photo/photo.init/Makefile	2008-08-17 18:35:38 UTC (rev 32841)
@@ -11,6 +11,5 @@
 
 default: etc
 
-$(PGM).tmp.html: $(PGM).html
-	$(INSTALL_DATA) $< $@
-
+$(PGM).tmp.html:
+	> $@

Modified: grass/trunk/imagery/i.ortho.photo/photo.rectify/Makefile
===================================================================
--- grass/trunk/imagery/i.ortho.photo/photo.rectify/Makefile	2008-08-17 14:59:19 UTC (rev 32840)
+++ grass/trunk/imagery/i.ortho.photo/photo.rectify/Makefile	2008-08-17 18:35:38 UTC (rev 32841)
@@ -13,6 +13,5 @@
 
 default: etc
 
-$(PGM).tmp.html: $(PGM).html
-	$(INSTALL_DATA) $< $@
-
+$(PGM).tmp.html:
+	> $@

Modified: grass/trunk/include/Make/Html.make
===================================================================
--- grass/trunk/include/Make/Html.make	2008-08-17 14:59:19 UTC (rev 32840)
+++ grass/trunk/include/Make/Html.make	2008-08-17 18:35:38 UTC (rev 32841)
@@ -19,9 +19,8 @@
 else
 
 $(HTMLDIR)/$(PGM).html: $(PGM).html $(PGM).tmp.html
-	-$(MKDIR) $(HTMLDIR)
-	$(MODULE_TOPDIR)/tools/mkhtml.sh $(PGM)
-	$(INSTALL_DATA) $(PGM).tmp.html $@
+	-test -d $(HTMLDIR) || $(MKDIR) $(HTMLDIR)
+	$(MODULE_TOPDIR)/tools/mkhtml.sh $(PGM) > $@
 	-for file in  *.png *.jpg ; do \
 		head -n 1 $$file | grep '^\#!' > /dev/null ; \
 		if [ $$? -ne 0 ] ; then \

Modified: grass/trunk/tools/mkhtml.sh
===================================================================
--- grass/trunk/tools/mkhtml.sh	2008-08-17 14:59:19 UTC (rev 32840)
+++ grass/trunk/tools/mkhtml.sh	2008-08-17 18:35:38 UTC (rev 32841)
@@ -15,16 +15,9 @@
 
 PGM=$1
 
-if ! grep -i '<html>' ${PGM}.tmp.html > /dev/null 2>&1 ; then
-    echo > ${PGM}.tmp.html
-fi
-
-if test -f ${PGM}.html ; then
-    cat ${PGM}.html >> ${PGM}.tmp.html
-fi
-
-if ! grep -i '<html>' ${PGM}.tmp.html > /dev/null ; then
-    cat > ${PGM}.tmp.html.header <<-EOF
+if ! grep -i '<html>' "${PGM}.html" > /dev/null 2>&1 ; then
+    if ! grep -i '<html>' "${PGM}.tmp.html" > /dev/null 2>&1 ; then
+	cat <<-EOF
 	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 	<html>
 	<head>
@@ -37,34 +30,46 @@
 	<h2>NAME</h2>
 	<em><b>${PGM}</b></em>
 	EOF
-    grep -iv '</body>\|</html>' ${PGM}.tmp.html >> ${PGM}.tmp.html.header
-    mv -f ${PGM}.tmp.html.header ${PGM}.tmp.html
+    fi
+    if [ -f "${PGM}.tmp.html" ] ; then
+	grep -iv '</body>\|</html>' "${PGM}.tmp.html"
+    fi
+else
+    if [ -f "${PGM}.tmp.html" ] ; then
+	echo '***' "${PGM}.tmp.html" >&2
+	exit 1
+    fi
 fi
 
+cat "${PGM}.html"
+
 # if </html> is found, suppose a complete html is provided.
 # otherwise, generate module class reference:
-if ! grep -i '</html>' ${PGM}.tmp.html > /dev/null ; then
-    MODCLASS=`echo ${PGM} | cut -d'.' -f1`
-    case $MODCLASS in
-	d)  INDEXNAME=display	;;
-	db) INDEXNAME=database	;;
-	g)  INDEXNAME=general	;;
-	i)  INDEXNAME=imagery	;;
-	m)  INDEXNAME=misc	;;
-	pg) INDEXNAME=postGRASS	;;
-	ps) INDEXNAME=postscript ;;
-	p)  INDEXNAME=paint	;;
-	r)  INDEXNAME=raster	;;
-	r3) INDEXNAME=raster3D	;;
-	s)  INDEXNAME=sites	;;
-	v)  INDEXNAME=vector	;;
-	*)  INDEXNAME=$MODCLASS	;;
-    esac
-    cat >> ${PGM}.tmp.html <<-EOF
-	<HR>
-	<P><a href="index.html">Main index</a> - <a href="$INDEXNAME.html">$INDEXNAME index</a> - <a href="full_index.html">Full index</a></P>
-	<P>&copy; 2003-2008 <a href="http://grass.osgeo.org">GRASS Development Team</a></p>
+if grep -i '</html>' "${PGM}.html" > /dev/null 2>&1 ; then
+    exit 0
+fi
+
+MODCLASS=`echo ${PGM} | cut -d'.' -f1`
+case $MODCLASS in
+    d)  INDEXNAME=display   ;;
+    db) INDEXNAME=database  ;;
+    g)  INDEXNAME=general   ;;
+    i)  INDEXNAME=imagery   ;;
+    m)  INDEXNAME=misc      ;;
+    pg) INDEXNAME=postGRASS ;;
+    ps) INDEXNAME=postscript ;;
+    p)  INDEXNAME=paint     ;;
+    r)  INDEXNAME=raster    ;;
+    r3) INDEXNAME=raster3D  ;;
+    s)  INDEXNAME=sites     ;;
+    v)  INDEXNAME=vector    ;;
+    *)  INDEXNAME=$MODCLASS ;;
+esac
+
+cat <<-EOF
+	<hr>
+	<p><a href="index.html">Main index</a> - <a href="$INDEXNAME.html">$INDEXNAME index</a> - <a href="full_index.html">Full index</a></p>
+	<p>&copy; 2003-2008 <a href="http://grass.osgeo.org">GRASS Development Team</a></p>
 	</body>
 	</html>
-	EOF
-fi
+EOF



More information about the grass-commit mailing list