[GRASS-SVN] r72027 - in sandbox/gisix: . g.citation
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 4 07:25:21 PST 2018
Author: gisix
Date: 2018-01-04 07:25:21 -0800 (Thu, 04 Jan 2018)
New Revision: 72027
Added:
sandbox/gisix/g.citation/
sandbox/gisix/g.citation/g.citation.html
sandbox/gisix/g.citation/g.citation.sh
Log:
New folder for g.citation module code
Added: sandbox/gisix/g.citation/g.citation.html
===================================================================
--- sandbox/gisix/g.citation/g.citation.html (rev 0)
+++ sandbox/gisix/g.citation/g.citation.html 2018-01-04 15:25:21 UTC (rev 72027)
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>GRASS GIS manual: g.citation_20180104_00.sh</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="grassdocs.css" type="text/css">
+</head>
+<body bgcolor="white">
+<div id="container">
+
+<a href="index.html"><img src="grass_logo.png" alt="GRASS logo"></a>
+<hr class="header">
+
+<h2>NAME</h2>
+<em><b>g.citation_20180104_00.sh</b></em> - Provide scientific citation for GRASS modules and add-ons. THIS MODULE IS STILL UNDER DEVELOPMENT!
+<h2>SCHLÜSSELWÖRTER</h2>
+<h2>SYNOPSIS</h2>
+<div id="name"><b>g.citation_20180104_00.sh</b><br></div>
+<b>g.citation_20180104_00.sh --help</b><br>
+<div id="synopsis"><b>g.citation_20180104_00.sh</b> <b>module</b>=<em>string</em> <b>style</b>=<em>string</em> [<b>output</b>=<em>string</em>] [--<b>help</b>] [--<b>verbose</b>] [--<b>quiet</b>] [--<b>ui</b>]
+</div>
+
+<div id="flags">
+<h3>Flags:</h3>
+<dl>
+<dt><b>--help</b></dt>
+<dd>Print usage summary</dd>
+<dt><b>--verbose</b></dt>
+<dd>Ausführlicher Ausgabemodus</dd>
+<dt><b>--quiet</b></dt>
+<dd>Schweigsamer Ausgabemodus</dd>
+<dt><b>--ui</b></dt>
+<dd>Force launching GUI dialog</dd>
+</dl>
+</div>
+
+<div id="parameters">
+<h3>Parameter:</h3>
+<dl>
+<dt><b>module</b>=<em>string</em> <b>[required]</b></dt>
+<dd>GRASS module to be cited</dd>
+
+<dt><b>style</b>=<em>string</em> <b>[required]</b></dt>
+<dd>citation style</dd>
+<dd>Optionen: <em>bibtex, csl, datacite, dublincore, json, json-ld, narcxml</em></dd>
+<dd>Standardwert: <em>bibtex</em></dd>
+
+<dt><b>output</b>=<em>string</em></dt>
+<dd>name/path of output image file</dd>
+
+</dl>
+</div>
+</body>
+</html>
Added: sandbox/gisix/g.citation/g.citation.sh
===================================================================
--- sandbox/gisix/g.citation/g.citation.sh (rev 0)
+++ sandbox/gisix/g.citation/g.citation.sh 2018-01-04 15:25:21 UTC (rev 72027)
@@ -0,0 +1,283 @@
+#!/bin/sh
+
+############################################################################
+#
+# MODULE: g.citation
+# AUTHOR(S): Peter Loewe <ploewe AT osgeo DOT org> (ORCID: 0000-0003-2257-0517), Markus Neteler <mneteler AT osgeo DOT org> (ORCID:0000-0003-1916-1966)
+# PURPOSE: Provide scientific citation for GRASS modules and add-ons.
+#
+# COPYRIGHT: (C) 2018 by Peter Loewe (pl), Markus Neteler, and the GRASS Development team
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+#############################################################################
+#last edit: 20180104 pl
+
+
+#%Module
+#% description: Provide scientific citation for GRASS modules and add-ons. THIS MODULE IS STILL UNDER DEVELOPMENT!
+#%End
+
+
+#%option
+#% key: module
+#% type: string
+#% description: GRASS module to be cited
+#% required : yes
+#% multiple: no
+#%end
+
+#%option
+#% key: style
+#% type: string
+#% description: citation style
+#% options: bibtex,csl,datacite,dublincore,json,json-ld,narcxml
+#% answer: bibtex
+#% required : yes
+#%end
+###^^^ Default to BibTex !
+
+#%option
+#% key: output
+#% type: string
+#% gisprompt: new_file,file,file
+#% description: name/path of output image file
+#% required : no
+#%end
+###^^^ if output is provided, write to ascii file, otherwise print to command line
+
+
+# TMPDIR=`g.gisenv get="GISDBASE"`
+# #TMPDIR is used to create the inner temporary latlon location
+
+export GIS_LOCK=$$
+
+###
+### Initialize
+###
+#Error Routine
+
+error_routine () {
+echo "ERROR: $1"
+exit 1
+}
+
+#################################
+# is GRASS running ? if not: abort
+#################################
+
+if [ -z "$GISBASE" ] ; then
+ error_routine "You must be in GRASS to run this program."
+fi
+#################################
+
+#################################
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+ exec $GISBASE/bin/g.parser "$0" "$@"
+fi
+#################################
+
+
+#################################
+
+###
+###
+###
+
+# Find out, if / how many modules are provided by the user.
+
+
+if [ -z "$GIS_OPT_MODULE" ] ; then
+ error_routine "No module provided"
+fi
+
+## Code snippet to deal with multiple modules (later):
+# MAPS_LIST=`echo $GIS_OPT_INPUT | sed 's/,/ /g'`
+#
+# MAPS_ARRAY=($(echo $MAPS_LIST | tr '\n' ' '))
+# MAPS_COUNT=${#MAPS_ARRAY[*]}
+#
+# # echo "Zahl: $MAPS_COUNT"
+##
+
+###
+
+## TBD: Find lhmpom-equivalent in GRASS repository
+
+# x=$(wget -0 - 'http:/foo/g.region.html')
+
+###
+
+## Which GRASS version is currently used ?
+## What Libraries, etc ?
+
+#g.version -erg
+
+#version=7.2.0
+#date=2016
+#revision=exported
+#build_date=2016-12-28
+#build_platform=i686-pc-linux-gnu
+#build_off_t_size=8
+#libgis_revision=68908
+#libgis_date="2016-07-09 20:12:57 +0200 (Sat, 09 Jul 2016) "
+#proj4=4.9.3
+#gdal=2.1.2
+#geos=3.5.1
+#sqlite=3.15.2
+
+
+#g.gisenv
+#MAPSET=user1
+#GISDBASE=/home/loewe/Projekte/locations
+#LOCATION_NAME=spearfish60_grass7
+#GUI=text
+#PID=1814
+
+
+###
+# Define the local directory of HTML man pages
+
+HTMLDIR="$GISBASE/docs/html"
+MODULEMANLOCAL="$HTMLDIR/$GIS_OPT_MODULE.html"
+
+###
+# Verfiy that a man page exists for the module. Abort otherwise.
+if [ -e $MODULEMANLOCAL ]
+then
+ echo
+ echo "OK: HTML for $GIS_OPT_MODULE available"
+else
+ error_routine "No documenation for module $GIS_OPT_MODULE available"
+fi
+
+###
+
+## derive core strings from lhmpom: NAME / AUTHOR / LAST CHANGED / COPYRIGHT: Years + Entity
+
+#######################################
+#######################################
+#######################################
+### FUNCTIONS
+#######################################
+#######################################
+#######################################
+
+echo "function definition begins"
+######################################
+## Function to extract content from an existing HTML file
+## Example: function_extract_textfragment
+### AUTHOR_STARTSTRING="<h2><a name=\"author\">AUTHOR</a></h2>"
+### AUTHOR_ENDSTRING="<p><i>Last changed:"
+### $MODULEMANLOCAL defines path to existing HTML document
+### function_extract_textfragment $AUTHOR_STARTSTRING $AUTHOR_ENDSTRING $$MODULEMANLOCAL
+function_extract_textfragment()
+{
+STARTSTRING=$1
+ENDSTRING=$2
+SOURCE=$3
+echo
+echo "___________________________________"
+echo "START:function_extract_textfragment"
+
+STARTLINE=$(grep $STARTSTRING $SOURCE)
+ENDLINE=$(grep $ENDSTRING $SOURCE)
+
+echo " START: $STARTLINE"
+echo " STOP: $ENDLINE"
+#echo
+TEXTFRAGMENT_RAW=$(grep -A50 $STARTSTRING $SOURCE | grep -B50 $ENDSTRING | egrep -v "$STARTSTRING|$ENDSTRING")
+echo "RESULT: $TEXTFRAGMENT_RAW"
+#echo
+#remove all newlines, etc from string:
+echo "..."
+TEXTFRAGMENT=${TEXTFRAGMENT_RAW//[$'\t\n\r']}
+echo $TEXTFRAGMENT
+echo "---"
+#echo
+echo "STOP:function_extract_textfragment"
+echo "------------------------"
+
+echo
+}
+
+echo "function definition ends"
+echo
+
+
+############################
+
+#NAME
+
+#AUTHORS
+
+#AUTHORSTRING_RAW=`grep -A20 "$AUTHOR_STARTSTRING" $MODULEMANLOCAL | grep -B20 "$AUTHOR_ENDSTRING" | egrep -v "$AUTHOR_STARTSTRING|$AUTHOR_ENDSTRING" `
+#echo $AUTHORSTRING_RAW
+#echo
+
+#AUTHOR_STARTSTRING="<h2><a name=\"author\">AUTHOR</a></h2>"
+AUTHOR_STARTSTRING=">AUTHOR</a></h2>"
+#AUTHOR_ENDSTRING="<p><i>Last changed:"
+AUTHOR_ENDSTRING="<p><i>Last"
+# !!! Hier Problem mit der Übergabe der Quotierung bei Leer- umnd Sonderzeichen !!!
+
+#echo "function_extract_textfragment $AUTHOR_STARTSTRING $AUTHOR_ENDSTRING $MODULEMANLOCAL"
+#function_extract_textfragment $AUTHOR_STARTSTRING $AUTHOR_ENDSTRING $MODULEMANLOCAL
+
+AUTHORSTRING=`function_extract_textfragment $AUTHOR_STARTSTRING $AUTHOR_ENDSTRING $MODULEMANLOCAL`
+
+echo "MAIN TEXTFRAGMENT: $TEXTFRAGMENT"
+echo "***"
+
+echo "MAIN AUTHORSTRING $AUTHORSTRING"
+AUTHOR_FULLNAME=`echo $AUTHORSTRING_RAW| cut -d, -f1`
+AUTHOR_AFFILIATION=`echo $AUTHORSTRING_RAW| cut -d, -f2`
+echo
+echo "Author NAME: $AUTHOR_FULLNAME"
+echo "Author AFFILIATION $AUTHOR_AFFILIATION"
+
+#very naive !
+# consider multiple authors: LINEBREAK as seperator
+# consider additional authors: "Extended by"
+
+#LASTCHANGED
+
+#COPYRIGHT-YEARS
+
+#COPRIGHT-ENTITY
+
+
+###
+
+echo
+echo
+echo "-COMPLETED-"
+###
+
+##IF output file is stated: print to file ELSE print to command line
+
+########################################
+#cleanup: remove location & files
+
+#rm $TMPDIR/.grassrc6_$TEMP_LOCATION
+#^^^activate if we have started ealrier a write to filesystem for whatever reasons
+
+
+########################################
+#That's all, folks.
+
+
+###########LEFTOVERS_
+
+#A BibTeX entry for LaTeX users is:
+#
+#@Manual{GRASS_GIS_software,
+# title = {Geographic Resources Analysis Support System (GRASS) Software},
+# author = {{GRASS Development Team}},
+# organization = {Open Source Geospatial Foundation},
+# address = {USA},
+# year = {YEAR},
+# url = {http://grass.osgeo.org},
+#}
Property changes on: sandbox/gisix/g.citation/g.citation.sh
___________________________________________________________________
Added: svn:executable
+ *
More information about the grass-commit
mailing list