From 40b99882e33b8bb59e6980cd6884ca2e1eabfdd4 Mon Sep 17 00:00:00 2001
From: oetiker
Date: Tue, 19 Apr 2005 21:05:13 +0000
Subject: [PATCH] initial working version
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@415 a5681a0c-68f1-0310-ab6d-d61299d08faa
---
website/bin/fix-hrefs.pl | 21 ++++++++
website/bin/fix-pod2html-orig.pl | 73 +++++++++++++++++++++++++++
website/bin/fix-pod2html.pl | 87 ++++++++++++++++++++++++++++++++
website/bin/headfix.pl | 15 ++++++
website/bin/htmlfix.sh | 19 +++++++
website/bin/pod2wml.sh | 38 ++++++++++++++
website/build.sh | 10 ++++
website/doc/build.sh | 26 ++++++++++
website/doc/index.wml | 8 +++
website/index.wml | 29 +++++++++++
website/navbar.inc | 33 ++++++++++++
website/prog/build.sh | 24 +++++++++
website/prog/index.wml | 8 +++
website/tut/build.sh | 23 +++++++++
website/tut/index.wml | 8 +++
15 files changed, 422 insertions(+)
create mode 100755 website/bin/fix-hrefs.pl
create mode 100755 website/bin/fix-pod2html-orig.pl
create mode 100755 website/bin/fix-pod2html.pl
create mode 100755 website/bin/headfix.pl
create mode 100755 website/bin/htmlfix.sh
create mode 100755 website/bin/pod2wml.sh
create mode 100755 website/build.sh
create mode 100755 website/doc/build.sh
create mode 100644 website/doc/index.wml
create mode 100644 website/index.wml
create mode 100644 website/navbar.inc
create mode 100755 website/prog/build.sh
create mode 100644 website/prog/index.wml
create mode 100755 website/tut/build.sh
create mode 100644 website/tut/index.wml
diff --git a/website/bin/fix-hrefs.pl b/website/bin/fix-hrefs.pl
new file mode 100755
index 00000000..9188980d
--- /dev/null
+++ b/website/bin/fix-hrefs.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl -w
+
+use strict;
+use HTML::Parser;
+
+my $p = HTML::Parser->new(api_version => 3);
+$p->handler(start => \&startsub, 'tagname, text');
+#$p->handler(end => \&endsub, 'tagname, text');
+$p->handler(default => sub { print shift() }, 'text');
+$p->parse_file(shift||"-") or die("parse: $!");
+
+sub startsub {
+ my $tag = shift;
+ my $text = shift;
+
+ if ($tag eq "a") {
+ $text =~ s,/home/oetiker/data/svn-checkout/rrdtool/branches/1.2/website/doc/,,;
+ $text =~ s,\.html,.en.html,;
+ }
+ print $text;
+}
diff --git a/website/bin/fix-pod2html-orig.pl b/website/bin/fix-pod2html-orig.pl
new file mode 100755
index 00000000..fa514006
--- /dev/null
+++ b/website/bin/fix-pod2html-orig.pl
@@ -0,0 +1,73 @@
+#!/usr/bin/perl -w
+
+use strict;
+use HTML::Parser;
+
+# fix pod2html output:
+# v1.0: defer and tags until
+# the next , or
+
+# v1.1: don't nest any elements;
+# end one before beginning another
+
+# v1.2: insert tags if occurs
+# inside -
+
+# v1.3: anchors must not start with a digit;
+# insert a letter "N" at the start if they do
+
+# v1.4: insert the "N" letter into too.
+
+my $p = HTML::Parser->new(api_version => 3);
+$p->handler(start => \&startsub, 'tagname, text');
+$p->handler(end => \&endsub, 'tagname, text');
+$p->handler(default => sub { print shift() }, 'text');
+$p->parse_file(shift||"-") or die("parse: $!");
+
+my @stack;
+my $a=0;
+
+sub startsub {
+ my $tag = shift;
+ my $text = shift;
+ if ($tag eq "dl") {
+ if (@stack and $stack[0] eq "dt") {
+ $stack[0] = "dd";
+ print "
- ";
+ }
+ unshift @stack, 0;
+ }
+ if (($tag eq "dt" or $tag eq "dd") and $stack[0]) {
+ print "$stack[0]>";
+ $stack[0] = 0;
+ }
+ if ($tag eq "a") {
+ if ($a) {
+ print "
";
+ } else {
+ $a++;
+ }
+ $text =~ s/(name="|href="#)(\d)/$1N$2/;
+ }
+ print $text;
+}
+
+
+sub endsub {
+ my $tag = shift;
+ my $text = shift;
+ if ($tag eq "dl") {
+ print "$stack[0]>" if $stack[0];
+ shift @stack;
+ }
+ if ($tag eq "a") {
+ if ($a) {
+ print "";
+ $a--;
+ }
+ } elsif ($tag eq "dd" or $tag eq "dt") {
+ $stack[0] = $tag;
+ } else {
+ print $text;
+ }
+}
diff --git a/website/bin/fix-pod2html.pl b/website/bin/fix-pod2html.pl
new file mode 100755
index 00000000..a48eb7c3
--- /dev/null
+++ b/website/bin/fix-pod2html.pl
@@ -0,0 +1,87 @@
+#!/usr/bin/perl -w
+
+use strict;
+use HTML::Parser;
+
+# fix pod2html output:
+# v1.0: defer and tags until
+# the next , or
+
+# v1.1: don't nest any elements;
+# end one before beginning another
+
+# v1.2: insert tags if occurs
+# inside -
+
+# v1.3: anchors must not start with a digit;
+# insert a letter "N" at the start if they do
+
+# v1.4: insert the "N" letter into too.
+
+my $p = HTML::Parser->new(api_version => 3);
+$p->handler(start => \&startsub, 'tagname, text');
+$p->handler(end => \&endsub, 'tagname, text');
+$p->handler(default => sub { print shift() }, 'text');
+$p->parse_file(shift||"-") or die("parse: $!");
+
+my @ddstack;
+my @listack;
+my $a=0;
+
+sub startsub {
+ my $tag = shift;
+ my $text = shift;
+ if ($tag eq "dl") {
+ if (@ddstack and $ddstack[0] eq "dt") {
+ $ddstack[0] = "dd";
+ print "
- ";
+ }
+ unshift @ddstack, 0;
+ }
+ if ($tag =~ /^[uo]l$/) {
+ unshift @listack, 0;
+ }
+ if (($tag eq "dt" or $tag eq "dd") and $ddstack[0]) {
+ print "$ddstack[0]>";
+ $ddstack[0] = 0;
+ }
+ if (($tag eq "li") and $listack[0]) {
+ print "$listack[0]>";
+ $listack[0] = 0;
+ }
+ if ($tag eq "a") {
+ if ($a) {
+ print "
";
+ } else {
+ $a++;
+ }
+ $text =~ s/(name="|href="#)(\d)/$1N$2/;
+ }
+ print $text;
+}
+
+
+sub endsub {
+ my $tag = shift;
+ my $text = shift;
+ if ($tag eq "dl") {
+ print "$ddstack[0]>" if $ddstack[0];
+ shift @ddstack;
+ } elsif ($tag =~ /^[uo]l$/) {
+ print "$listack[0]>" if $listack[0];
+ shift @listack;
+ }
+
+ if ($tag eq "a") {
+ if ($a) {
+ print "";
+ $a--;
+ }
+ } elsif ($tag eq "dd" or $tag eq "dt") {
+ $ddstack[0] = $tag;
+ } elsif ($tag eq "li") {
+ $listack[0] = $tag;
+ } else {
+ print $text;
+ }
+}
diff --git a/website/bin/headfix.pl b/website/bin/headfix.pl
new file mode 100755
index 00000000..4495445e
--- /dev/null
+++ b/website/bin/headfix.pl
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+undef $/; #slurp alll
+$_ = <>;
+while (s/]+))/|#include PAGE="$VAL{PAGE}" AUTHOR="$VAL{AUTHOR}" TYPE="$VAL{TYPE}"\n|si;
+
+print;
+
diff --git a/website/bin/htmlfix.sh b/website/bin/htmlfix.sh
new file mode 100755
index 00000000..7bb2a6c9
--- /dev/null
+++ b/website/bin/htmlfix.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+case $1 in
+*.html)
+ perl -i -0777 -p -e 's/^\s*//' $1
+ tidy -latin1 -wrap 0 -q -asxhtml $1 >$1.fixed 2>$1.report
+ if [ $? != 0 ]; then
+ echo Parsing: $1
+ egrep -v "^(HTML Tidy|$1:|To learn|Please send|HTML and CSS|Lobby your)" $1.report
+ rm $1.report
+ name=`basename $1 .html`
+ name=`basename $name .en`
+ name=`basename $name .de`
+ touch -m -t 198001010000 $name.*.html
+ exit 1
+ fi
+ mv $1.fixed $1
+ rm $1.report
+;;
+esac
diff --git a/website/bin/pod2wml.sh b/website/bin/pod2wml.sh
new file mode 100755
index 00000000..d15dc0a5
--- /dev/null
+++ b/website/bin/pod2wml.sh
@@ -0,0 +1,38 @@
+pod2wml (){
+ base=$1
+ [ -z "$descr" ] && descr=$base
+ [ -z "$menu" ] && menu=$descr
+ pod2html --infile=$base.pod --outfile=$base.pre --noindex --htmlroot=$SITEROOT --podroot=$SITEROOT --podpath=$PODPATH
+ $SITEROOT/bin/fix-pod2html.pl $base.pre | $SITEROOT/bin/fix-hrefs.pl >$base.html
+ echo "" >>navbar.inc
+ printf "" >>index.inc
+ grep $base $base.pod |fgrep ' - '|head -1|sed 's| - ||' >>index.inc
+ echo "" >>index.inc
+ echo " $base.wml
+ perl -0777 -n -e 's|E|<|g;s|E|>|g;m|=head1 AUTHO\S+\s*(.+)| && do {$a=$1;$e="no\@address.nowhere";$a=~ s/\s*<(.+?)>\s*,?// and $e=$1; $e=~ s/\s\S+\s/\@/;print "author=\"$a <$e>\"/>\n"}' $base.pod >>$base.wml
+ # perl -0777 -n -e 's|.*?(.*|$1|s;for($i=5;$i>0;$i--){$j=$i-1;s|(?h)$j>|$1$i>|g}; s|.*?(.+?) - .*?
|$1
|s;s|\s*
||g;s|||g;s|\s*|\n|g;s|
\s*
||g;s|\s*||g;print ' $base.html >>$base.wml
+ perl -0777 -n -e '
+ s|.*?(.*|$1|s;
+ for($i=5;$i>0;$i--){
+ $j=$i-1;
+ s|(?h)$j>|$1$i>|g
+ };
+ s|.*?NAME.*?.*?\s*(.+?)\s*- .*?
|$1
|s;
+ s{(.+?)(?=|?ul>|?ol>)}{$1}sg;
+ s|\s*
|\n|g;
+ s|\n\s|\n|g;
+ s|\s*\s*\s*|\n\n|g;
+ s|(\S)
|$1\n|g;
+ s|(.+?)
|$1
|gs;
+ s|\s*(.+?)\s*
\s+|$1\n|g;
+ s|
\s*||g;
+ s|\s*||gs;
+ s|)\s*(\S)(.+?)\s*(
)|$1$2\L$3\E$4|g;
+ print
+ ' $base.html >>$base.wml
+# rm $base.html
+ perl -i~ -0777 -p -e 's|\s*\s*
||sg' $base.wml
+ rm $base.html $base.pre
+ descr=""
+}
diff --git a/website/build.sh b/website/build.sh
new file mode 100755
index 00000000..c6a3bc53
--- /dev/null
+++ b/website/build.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+PERL5LIB=/home/oetiker/lib/fake-perl/
+SITEROOT=`pwd`
+PODPATH=`ls */build.sh | sed -e 's|/.*||g' | perl -0777 -e 'print join ":", map {"$_"} split /\n/, <>'`
+export PERL5LIB SITEROOT PODPATH
+rm */pod*tmp
+for x in `ls */build.sh | sed 's|/.*||g'`; do
+ echo '****' $x '****'
+ (cd $x;./build.sh)
+done
diff --git a/website/doc/build.sh b/website/doc/build.sh
new file mode 100755
index 00000000..4528e6b8
--- /dev/null
+++ b/website/doc/build.sh
@@ -0,0 +1,26 @@
+
+#!/bin/sh
+sect=doc
+src=../../program
+. ../bin/pod2wml.sh
+
+pod2descr() {
+ pod=$1.pod
+ descr=`grep " - " $pod|head -1|sed 's/.*- //'`
+ menu=`grep " - " $pod|head -1|sed 's/ -.*//'`
+}
+
+
+# build probe list
+rm -f navbar.inc
+rm -f index.inc
+
+(cd $src/doc/;gmake pod)
+for pod in `cd $src/doc/;echo rrdtool.pod;ls *.pod|egrep -v 'tutorial|beginners|graph-old|bin_dec|rrdtool.pod|RRD|thread'`; do
+ base=`echo $pod |sed 's,.pod,,'`
+ echo $base
+ cat $src/doc/$pod > $base.pod
+ pod2descr $base
+ pod2wml $base
+done
+
diff --git a/website/doc/index.wml b/website/doc/index.wml
new file mode 100644
index 00000000..4f08e6c7
--- /dev/null
+++ b/website/doc/index.wml
@@ -0,0 +1,8 @@
+
+
+RRDtool Documentation
+
+
+#include "index.inc"
+
diff --git a/website/index.wml b/website/index.wml
new file mode 100644
index 00000000..406f43d7
--- /dev/null
+++ b/website/index.wml
@@ -0,0 +1,29 @@
+
+
+
+About RRDtool
+
+RRDtool
+
+If you know MRTG, you can think of RRDtool as a reimplementation of MRTGs
+graphing and logging features. Magnitudes faster and more flexible than you ever
+thought possible
+
+RRD is the Acronym for Round Robin Database. RRD is a system to store and
+display time-series data (i.e. network bandwidth, machine-room temperature,
+server load average). It stores the data in a very compact way that will not
+expand over time, and it presents useful graphs by processing the data to
+enforce a certain data density. It can be used either via simple wrapper
+scripts (from shell or Perl) or via frontends that poll network devices and
+put a friendly user interface on it.
+
+Get IT
+
+RRDtool is available for download from this site.
+Currently it compiles on a number of different Unix platforms as well as on
+NT. No binaries are officially provided at this point in time.
+
+Project -- Happy Tobi
+
+You like RRDtool? There is a simple way to show your appreciation.
diff --git a/website/navbar.inc b/website/navbar.inc
new file mode 100644
index 00000000..b711838f
--- /dev/null
+++ b/website/navbar.inc
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+#include "doc/navbar.inc"
+
+
+
+#include "tut/navbar.inc"
+
+
+
+#include "prog/navbar.inc"
+
+
+#
+# #include "probe/navbar.inc"
+#
+
+#
+# #include "matcher/navbar.inc"
+#
+
+#
+# #include "lib/navbar.inc"
+#
diff --git a/website/prog/build.sh b/website/prog/build.sh
new file mode 100755
index 00000000..c17aa06f
--- /dev/null
+++ b/website/prog/build.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+sect=prog
+src=../../program
+. ../bin/pod2wml.sh
+
+pod2descr() {
+ pod=$1.pod
+ descr=`grep " - " $pod|head -1|sed 's/.*- //'`
+ menu=`grep " - " $pod|head -1|sed 's/ -.*//'`
+}
+
+
+# build probe list
+rm -f navbar.inc
+rm -f index.inc
+
+for pod in `cd $src/doc/;ls *.pod|egrep 'RRD|thread'`; do
+ base=`echo $pod |sed 's,.pod,,'`
+ echo $base
+ cat $src/doc/$pod > $base.pod
+ pod2descr $base
+ pod2wml $base
+done
+
diff --git a/website/prog/index.wml b/website/prog/index.wml
new file mode 100644
index 00000000..480f08d0
--- /dev/null
+++ b/website/prog/index.wml
@@ -0,0 +1,8 @@
+
+
+RRDtool Programming
+
+
+#include "index.inc"
+
diff --git a/website/tut/build.sh b/website/tut/build.sh
new file mode 100755
index 00000000..67e0bd7a
--- /dev/null
+++ b/website/tut/build.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+sect=tut
+src=../../program
+. ../bin/pod2wml.sh
+
+pod2descr() {
+ pod=$1.pod
+ descr=`grep " - " $pod|head -1|sed 's/.*- //'`
+ menu=`grep " - " $pod|head -1|sed 's/ -.*//'`
+}
+
+
+# build probe list
+rm -f navbar.inc
+rm -f index.inc
+
+for pod in `cd $src/doc/;echo rrdtutorial.pod;ls *.pod|egrep 'cdeftut|rpntut|beginners|bin_dec'`; do
+ base=`echo $pod |sed 's,.pod,,'`
+ echo $base
+ cat $src/doc/$pod > $base.pod
+ pod2descr $base
+ pod2wml $base
+done
diff --git a/website/tut/index.wml b/website/tut/index.wml
new file mode 100644
index 00000000..afbbfd29
--- /dev/null
+++ b/website/tut/index.wml
@@ -0,0 +1,8 @@
+
+
+RRDtool Tutorial
+
+
+#include "index.inc"
+
--
2.30.2