[Scripts for automatic cross-reference generation Stephane Popinet **20080704032011 For automatically linking keyword wiki documentation with the examples and test cases. ] hunk ./doc/examples/Makefile.am 27 - gfs2doc gfs-highlight + gfs2doc gfs-highlight gfsxref hunk ./doc/examples/Makefile.am 61 + sh ../share/crossref.sh --url=http://gfs.sourceforge.net/examples/examples $(EXAMPLES) + mv references examples hunk ./doc/examples/gfs-highlight.in 4 -title="Gerris simulation" +title="" hunk ./doc/examples/gfs-highlight.in 19 + [--comments] include comment block at the start + [--bold] use bold instead of links hunk ./doc/examples/gfs-highlight.in 26 +comment=0 +bold=0 hunk ./doc/examples/gfs-highlight.in 41 + --comment) + comment=1 + ;; + --bold) + bold=1 + ;; hunk ./doc/examples/gfs-highlight.in 57 +if test "x$title" = "x"; then : +cat < +EOF +else hunk ./doc/examples/gfs-highlight.in 70 +fi hunk ./doc/examples/gfs-highlight.in 75 -awk 'BEGIN{ infile=0 } { +awk -v comment=$comment 'BEGIN{ infile=comment } { hunk ./doc/examples/gfs-highlight.in 89 -sed "s/\"gfs_keyword\">\(Gfs\)\{0,1\}\([a-zA-Z0-9_]*\)<\/span>/"gfs_keyword">\1\2<\/a><\/span>/g" +( +if test $bold = "1"; then + sed "s/\"gfs_keyword\">\(Gfs\)\{0,1\}\([a-zA-Z0-9_]*\)<\/span>/"gfs_keyword">\1\2<\/b><\/span>/g" +else + sed "s/\"gfs_keyword\">\(Gfs\)\{0,1\}\([a-zA-Z0-9_]*\)<\/span>/"gfs_keyword">\1\2<\/a><\/span>/g" +fi +) hunk ./doc/examples/gfs-highlight.in 99 +if test "x$title" = "x"; then : +cat < +EOF +else hunk ./doc/examples/gfs-highlight.in 108 +fi addfile ./doc/examples/gfsxref hunk ./doc/examples/gfsxref 1 +#!/bin/sh + +usage() +{ + cat < output.html + +Creates cross-references for occurences of KEYWORD in input.gfs + +Options: + [--url=URL] reference URL for input.gfs + [--help] displays this message and exits +EOF + exit $1 +} + +if test $# -lt 1; then + usage 1 1>&2 +fi + +while test $# -gt 1; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --url=*) + url=$optarg + ;; + --help) + usage 0 1>&2 + ;; + --*) + usage 0 1>&2 + ;; + esac + shift +done + +title=`awk --posix -v keyword=$1 ' +BEGIN { + if (substr (keyword, 1, 3) == "Gfs") + keyword = substr (keyword, 4); + paren = -1; + n = 0; + last = ""; +} +{ + if ($1 == "#" && $2 == "Title:") { + title = $3; + for (i = 4; i <= NF; i++) + title = title " " $i; + } + else if ($1 != "#" && $0 ~ "(Gfs){0,1}" keyword "[[:blank:]]") { + if (last != "") + block[n++] = last; + last = $0; + paren = 0; + for (i = 2; i <= NF; i++) { + if ($i == "#") + break; + if (index ($i, "{")) + paren++; + if (index ($i, "}")) + paren--; + } + } + else if (paren > 0) { + last = last "\n" $0; + for (i = 1; i <= NF; i++) { + if ($i == "#") + break; + if (index ($i, "{")) + paren++; + if (index ($i, "}")) + paren--; + } + } +} +END { + print title + if (last != "") + block[n++] = last; + for (i = 0; i < n; i++) + print block[i] > "xref_" i; +}'` + +if test -f xref_0; then + cat <$title +EOF + + for file in xref_*; do + echo "

" + gfs-highlight --comment --bold < $file + echo "

" + done + + rm -f xref_* +fi addfile ./doc/share/crossref.sh move ./doc/share/crossref.sh ./doc/examples/crossref.sh.in hunk ./configure.in 460 +doc/examples/crossref.sh hunk ./debian/gerris-snapshot.install 17 +usr/share/gerris/* hunk ./doc/Makefile.am 16 -EXTRA_DIST=figures +EXTRA_DIST=figures share hunk ./doc/examples/Makefile.am 18 - Makefile.deps + Makefile.deps \ + crossref.sh.in hunk ./doc/examples/Makefile.am 50 -examples: examples.dvi +examples: examples.dvi crossref.sh hunk ./doc/examples/Makefile.am 62 - sh ../share/crossref.sh --url=http://gfs.sourceforge.net/examples/examples $(EXAMPLES) + sh ./crossref.sh --url=http://gfs.sourceforge.net/examples/examples $(EXAMPLES) hunk ./doc/examples/crossref.sh.in 1 +#!/bin/sh +# Generated automatically. Please modify crossref.sh.in. + +path="@prefix@/share/gerris" + +usage() +{ + cat <&2 +fi + +while test $# -gt 1; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --url=*) + url=$optarg + ;; + --help) + usage 0 1>&2 + ;; + --*) + usage 0 1>&2 + ;; + *) + break + ;; + esac + shift +done + +keywords=`awk '{if ($1 == "gfs_keyword" && substr ($3,1,4) == "\"Gfs") print substr($3,2,length($3)-2); }' < $path/gfs.lang` + +if test -d references; then : +else + mkdir references +fi + +for k in $keywords; do + rm -f references/$k.html + for f in $*; do + gfsxref --url="$url/$f.html" $k < $f/$f.gfs >> references/$k.html + cd $f + for d in *; do + if test -d $d; then + gfsxref --url="$url/$f.html#$d" $k < $d/$d.gfs >> ../references/$k.html + fi + done + cd .. + done +done hunk ./doc/examples/gfsxref 55 - else if ($1 != "#" && $0 ~ "(Gfs){0,1}" keyword "[[:blank:]]") { + else if ($1 != "#" && $0 ~ "(^|[[:blank:]])+(Gfs){0,1}" keyword "[[:blank:]]") { hunk ./rpm/gerris.spec 11 -Release: 6.%{alphatag}cvs%{?dist} +Release: 7.%{alphatag}cvs%{?dist} hunk ./rpm/gerris.spec 25 -Requires: gts-snapshot-devel >= 0.7.6 pkgconfig gcc sed gawk m4 hunk ./rpm/gerris.spec 27 -%endif -%if 0%{?suse_version} -Requires: libproj0 gsl libnetcdf-4 -%endif -BuildRequires: glibc-devel automake libtool gsl-devel gts-snapshot-devel >= 0.7.6 -%if 0%{?fedora_version} hunk ./rpm/gerris.spec 30 +Requires: libproj0 gsl libnetcdf-4 hunk ./rpm/gerris.spec 33 +# For both distros +Requires: gts-snapshot-devel >= 0.7.6 pkgconfig gcc sed gawk m4 +BuildRequires: glibc-devel automake libtool gsl-devel gts-snapshot-devel >= 0.7.6 hunk ./rpm/gerris.spec 59 + --disable-mpi \ hunk ./rpm/gerris.spec 65 + --disable-mpi \ hunk ./rpm/gerris.spec 75 + --disable-mpi \ hunk ./rpm/gerris.spec 82 + --disable-mpi \ hunk ./rpm/gerris.spec 129 -%defattr(-,root,root,-) +%defattr(-,root,root) hunk ./rpm/gerris.spec 138 +%{_datadir}/gerris/gfs.lang hunk ./rpm/gerris.spec 144 +* Thu Jul 3 2008 Ivan Adam Vari - 7 +- Fixed typo in %files section (attr) +- Added new file gfs.lang to %files section +- Disabled MPI according to debian build rules + hunk ./test/Makefile.am 58 + sh ../doc/examples/crossref.sh --url=http://gfs.sourceforge.net/tests/tests $(TESTDIRS) + mv references tests