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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 16 06:53:02 PDT 2015


Author: wenzeslaus
Date: 2015-10-16 06:53:02 -0700 (Fri, 16 Oct 2015)
New Revision: 66516

Added:
   grass-addons/tools/addons/get_page_description.sh
Modified:
   grass-addons/tools/addons/grass-addons-index.sh
Log:
refactor out extraction of one line description for addons

Added: grass-addons/tools/addons/get_page_description.sh
===================================================================
--- grass-addons/tools/addons/get_page_description.sh	                        (rev 0)
+++ grass-addons/tools/addons/get_page_description.sh	2015-10-16 13:53:02 UTC (rev 66516)
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# PURPOSE: Extracts page one line descriptions for index.html of GRASS GIS Addons
+
+# AUTHORS: Martin Landa
+
+if [ $# -ne 1 ]; then
+    echo "$(basename $0) takes exactly one argument (HTML manual page name)"
+    exit 1
+fi
+
+TMP=$$
+
+currfile=$1
+
+grep 'KEYWORDS' $currfile 2> /dev/null > /dev/null
+if [ $? -eq 0 ] ; then
+    # keywords found, so go ahead with extraction of one-line description
+    cat $currfile | awk '/NAME/,/KEYWORDS/' | grep ' - ' | cut -d'-' -f2- | cut -d'<' -f1 | sed 's+>$+></li>+g'  >> /tmp/d.$TMP
+    # argh, fake keyword line found (broken manual page or missing g.parser usage)
+    if [ ! -s /tmp/d.$TMP ] ; then
+        echo "(incomplete manual page, please fix; name part not found)" > /tmp/d.$TMP
+    fi
+    cat /tmp/d.$TMP
+    rm -f /tmp/d.$TMP
+else
+    # let's try to be more robust against missing keywords in a few HTML pages
+    # argh, no keywords found (broken manual page or missing g.parser usage)
+    echo "(incomplete manual page, please fix; keyword part not found)"
+fi


Property changes on: grass-addons/tools/addons/get_page_description.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/x-sh
Added: svn:eol-style
   + native

Modified: grass-addons/tools/addons/grass-addons-index.sh
===================================================================
--- grass-addons/tools/addons/grass-addons-index.sh	2015-10-16 10:36:02 UTC (rev 66515)
+++ grass-addons/tools/addons/grass-addons-index.sh	2015-10-16 13:53:02 UTC (rev 66516)
@@ -64,6 +64,7 @@
     # mkdir -p /tmp/grass${major}${minor}/manuals/addons ; cd /tmp/grass${major}${minor}/manuals/addons
     # grass.osgeo.org SERVER
     cd /var/www/grass/grass-cms/grass${major}${minor}/manuals/addons
+    SRC=${HOME}/src/
 
     if test -f index.html ; then
 	mv index.html index.html.bak
@@ -107,8 +108,6 @@
 </tr></table>
 <hr>" > index.html
 
-    # fetch one-line descriptions into a separate file:
-    # let's try to be more robust against missing keywords in a few HTML pages
     prefix_last=""
     for currfile in `ls -1 *.html | grep -v index.html` ; do
 	# module prefix
@@ -124,20 +123,7 @@
 
 	module=`echo $currfile | sed 's+\.html$++g'`
 	echo "<li style=\"margin-left: 20px\"><a href=\"$currfile\">$module</a>:" >> index.html
-        grep 'KEYWORDS' $currfile 2> /dev/null > /dev/null
-        if [ $? -eq 0 ] ; then
-           # keywords found, so go ahead with extraction of one-line description
-           cat $currfile | awk '/NAME/,/KEYWORDS/' | grep ' - ' | cut -d'-' -f2- | cut -d'<' -f1 | sed 's+>$+></li>+g'  >> /tmp/d.$TMP
-           # argh, fake keyword line found (broken manual page or missing g.parser usage)
-	   if [ ! -s /tmp/d.$TMP ] ; then
-	      echo "(incomplete manual page, please fix)" > /tmp/d.$TMP
-           fi
-	   cat /tmp/d.$TMP >> index.html
-	   rm -f /tmp/d.$TMP
-        else
-           # argh, no keywords found (broken manual page or missing g.parser usage)
-           echo "(incomplete manual page, please fix)" >> index.html
-        fi
+        ${SRC}grass-addons/tools/addons/get_page_description.sh $currfile >> index.html
     done
 
     year=`date +%Y`



More information about the grass-commit mailing list