[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: gschemdoc.sh
User: cnieves
Date: 07/04/21 05:04:13
Modified: . gschemdoc.sh
Log:
Allow gschemdoc to access wiki pages with -w . Applied patch from Peter Brett.
* scripts/gschemdoc.sh: Apply patch from Peter Brett to
allow gschemdoc to access wiki pages with -w .
The original patch initially tries to find a local export
of the wiki; on failure, it falls back to the online wiki
at the gEDA website.
Since the online wiki and the user's geda version may not
be the same, I commented out the part to display the online
wiki if the file is not locally available. Thanks!
Revision Changes Path
1.13 +54 -3 eda/geda/gaf/utils/scripts/gschemdoc.sh
(In the diff below, changes in quantity of whitespace are not shown.)
Index: gschemdoc.sh
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/utils/scripts/gschemdoc.sh,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- gschemdoc.sh 17 Apr 2007 20:19:23 -0000 1.12
+++ gschemdoc.sh 21 Apr 2007 09:04:12 -0000 1.13
@@ -1,5 +1,5 @@
#!/bin/sh
-# $Id: gschemdoc.sh,v 1.12 2007/04/17 20:19:23 pcjc2 Exp $
+# $Id: gschemdoc.sh,v 1.13 2007/04/21 09:04:12 cnieves Exp $
#
# NOTE: built from gschemdoc.sh
#
@@ -14,10 +14,11 @@
# 5: symbol directory (currently not used)
#
# alternative action:
-# present gschem user's manual
+# present gschem user's manual, or a specific wiki page
#
# options:
# "-m" display user's manual instead
+# "-w <path>" display a wiki page
#
# deBUG:
# echo "gschemdoc args are: <$0> <$1> <$2> <$3> <$4> <$5>"
@@ -128,6 +129,49 @@
}
#
+# Display a wiki page
+#
+# Tries a local page first; if it doesn't exist, falls back to wiki on gEDA
+# website.
+lookup_wiki()
+{
+ LOCALWIKIROOT="${DOCDIR}/wiki/"
+ LIVEWIKIROOT="http://geda.seul.org/wiki/"
+
+ # Munge wiki path to remove bad chars
+ LOCALNAME=$(echo "$1" | tr "?\!*:" "____")
+ if test -z "$LOCALNAME"; then
+ LOCALNAME="index"
+ fi
+ LOCALPATH="$LOCALWIKIROOT$LOCALNAME.html"
+
+ LIVEURL="$LIVEWIKIROOT$1"
+
+ if test -f "$LOCALPATH" ; then
+ view_file_browser $LOCALPATH
+ exit
+ fi
+
+ if test "${browser}" != "no" ; then
+
+# # Commented out, since the online wiki and the user version
+# # may not be the same.
+#
+# echo "Found ${browser}"
+# echo "Using browser and URL: $LIVEURL"
+# # NOTE: Mozilla and Netscape does not seem to support
+# # -- on the command line
+# ${browser} "$LIVEURL"
+ echo "Did not find the page in the local path."
+ exit
+ else
+ echo "Did not find a browser application."
+ exit
+ fi
+}
+
+
+#
# establish what software we have
#
browser="no"
@@ -157,6 +201,13 @@
fi
#
+# try to load a specific wiki path
+#
+if test "$1" = "-w"; then
+ lookup_wiki "$2"
+fi
+
+#
# i.
# if there is a file in the documentation directory, we
# will of course use that first and foremost
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs