[GRASS-SVN] r64315 - grass-addons/tools/addons

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 25 05:46:04 PST 2015


Author: neteler
Date: 2015-01-25 05:46:04 -0800 (Sun, 25 Jan 2015)
New Revision: 64315

Modified:
   grass-addons/tools/addons/grass-addons-index.sh
Log:
Addons manuals overview: let's be robust against missing keywords in a few HTML pages

Modified: grass-addons/tools/addons/grass-addons-index.sh
===================================================================
--- grass-addons/tools/addons/grass-addons-index.sh	2015-01-25 13:38:26 UTC (rev 64314)
+++ grass-addons/tools/addons/grass-addons-index.sh	2015-01-25 13:46:04 UTC (rev 64315)
@@ -60,12 +60,19 @@
 # paste -d' ' /tmp/a.$TMP /tmp/b.$TMP /tmp/c.$TMP >> index.html
     
     # get one-line description:
-    awk '/NAME/,/KEYWORDS/'  *.html | grep ' - ' | cut -d'-' -f2- | cut -d'.' -f1 | cut -d'<' -f1 | sed 's+>$+></li>+g'  > /tmp/c.$TMP
+    # let's be robust against missing keywords in a few HTML pages
+    for currfile in `ls -1 *.html | grep -v index.html` ; do
+        grep 'KEYWORDS' $currfile 2> /dev/null > /dev/null
+        if [ $? -eq 0 ] ; then
+           cat $currfile | awk '/NAME/,/KEYWORDS/' | grep ' - ' | cut -d'-' -f2- | cut -d'.' -f1 | cut -d'<' -f1 | sed 's+>$+></li>+g'  >> /tmp/c.$TMP
+        else
+           echo "" >> /tmp/c.$TMP
+        fi
+    done
 
     paste -d' ' /tmp/a.$TMP /tmp/b.$TMP /tmp/c.$TMP >> index.html
 
     echo "</ul>" >> index.html
-
     echo "<hr>
 © 2013-2015 <a href=\"http://grass.osgeo.org\">GRASS Development Team</a>, GRASS GIS ${major} Addons Reference Manual<br>" >> index.html
     echo "<i><small>`date -u`</small></i>" >> index.html
@@ -77,3 +84,4 @@
 generate 6 4
 
 exit 0
+



More information about the grass-commit mailing list