Code

initial working version
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Tue, 19 Apr 2005 21:05:13 +0000 (21:05 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Tue, 19 Apr 2005 21:05:13 +0000 (21:05 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@415 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 files changed:
website/bin/fix-hrefs.pl [new file with mode: 0755]
website/bin/fix-pod2html-orig.pl [new file with mode: 0755]
website/bin/fix-pod2html.pl [new file with mode: 0755]
website/bin/headfix.pl [new file with mode: 0755]
website/bin/htmlfix.sh [new file with mode: 0755]
website/bin/pod2wml.sh [new file with mode: 0755]
website/build.sh [new file with mode: 0755]
website/doc/build.sh [new file with mode: 0755]
website/doc/index.wml [new file with mode: 0644]
website/index.wml [new file with mode: 0644]
website/navbar.inc [new file with mode: 0644]
website/prog/build.sh [new file with mode: 0755]
website/prog/index.wml [new file with mode: 0644]
website/tut/build.sh [new file with mode: 0755]
website/tut/index.wml [new file with mode: 0644]

diff --git a/website/bin/fix-hrefs.pl b/website/bin/fix-hrefs.pl
new file mode 100755 (executable)
index 0000000..9188980
--- /dev/null
@@ -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 (executable)
index 0000000..fa51400
--- /dev/null
@@ -0,0 +1,73 @@
+#!/usr/bin/perl -w
+
+use strict;
+use HTML::Parser;
+
+# fix pod2html output:
+# v1.0: defer </dd> and </dt> tags until
+# the next <dd>, <dt> or </dl>
+
+# v1.1: don't nest any <a> elements; 
+# end one before beginning another
+
+# v1.2: insert <dd> tags if <dl> occurs
+# inside <dt>
+
+# v1.3: <a> anchors must not start with a digit;
+# insert a letter "N" at the start if they do
+
+# v1.4: insert the "N" letter into <a href="#xxx"> 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 "</dt><dd>";
+               }
+                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 "</a>";
+               } 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>";
+                       $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 (executable)
index 0000000..a48eb7c
--- /dev/null
@@ -0,0 +1,87 @@
+#!/usr/bin/perl -w
+
+use strict;
+use HTML::Parser;
+
+# fix pod2html output:
+# v1.0: defer </dd> and </dt> tags until
+# the next <dd>, <dt> or </dl>
+
+# v1.1: don't nest any <a> elements; 
+# end one before beginning another
+
+# v1.2: insert <dd> tags if <dl> occurs
+# inside <dt>
+
+# v1.3: <a> anchors must not start with a digit;
+# insert a letter "N" at the start if they do
+
+# v1.4: insert the "N" letter into <a href="#xxx"> 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 "</dt><dd>";
+               }
+                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 "</a>";
+               } 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>";
+                       $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 (executable)
index 0000000..4495445
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+undef $/; #slurp alll 
+$_ = <>;
+while (s/<page[\s\n\r]+(\S+)\s*=\s*(?:"([^"]+)"|([^"\s>]+))/<page/si){
+  chomp($VAL{uc($1)}= $2 ? $2: $3);
+}
+
+if ($VAL{TYPE} eq 'lone') {
+  $sub="_$VAL{TYPE}";
+}
+
+s|<page[\s\n\r]*/?>|#include <inc/template${sub}.inc> 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 (executable)
index 0000000..7bb2a6c
--- /dev/null
@@ -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 (executable)
index 0000000..d15dc0a
--- /dev/null
@@ -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 "<nav:but ${sect}_$base      \"$menu\"           $base/>" >>navbar.inc
+ printf "<dt><a href=\"$base.en.html\">" >>index.inc
+ grep $base $base.pod |fgrep ' - '|head -1|sed 's| - |</a></dt><dd>|' >>index.inc 
+ echo "</dd>" >>index.inc
+ echo "<page page=\"${sect}_$base\"" > $base.wml
+ perl -0777 -n -e 's|E<lt>|<|g;s|E<gt>|>|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|.*?(<h1.+)</body>.*|$1|s;for($i=5;$i>0;$i--){$j=$i-1;s|(</?h)$j>|$1$i>|g}; s|<h2><a name="name">NAME</a></h2>.*?<p>(.+?) - .*?</p>|<h1>$1</h1>|s;s|<p>\s*</p>||g;s|<hr.*?>||g;s|</pre>\s*<pre>|\n|g;s|<br\s*/>\s*</dt>|</dt>|g;s|</dd>\s*<dd>||g;print ' $base.html >>$base.wml
+ perl -0777 -n -e '
+  s|.*?(<h1.+)</body>.*|$1|s;
+  for($i=5;$i>0;$i--){
+         $j=$i-1;
+         s|(</?h)$j>|$1$i>|g
+  };
+  s|<h2.*?>.*?NAME.*?</h2>.*?<p.*?>\s*(.+?)\s*- .*?</p>|<h1>$1</h1>|s;
+  s{<li></li>(.+?)(?=<li>|</?ul>|</?ol>)}{<li>$1</li>}sg;
+  s|<p>\s*</p>|\n|g;
+  s|\n\s|\n|g;
+  s|\s*</pre>\s*<pre>\s*|\n\n|g;
+  s|(\S)</pre>|$1\n</pre>|g;
+  s|<pre>(.+?)</pre>|<protect><pre>$1</pre></protect>|gs;
+  s|<strong>\s*(.+?)\s*</strong><br />\s+</dt>|$1</dt>\n|g;
+  s|<hr />\s*<h2>|<h2>|g;
+  s|<dd>\s*</dd>||gs;
+  s|<a href=".*?/website|<a href="\$(ROOT)|g; 
+  s|(<h2><a.*?>)\s*(\S)(.+?)\s*(</a></h2>)|$1$2\L$3\E$4|g;
+  print 
+ ' $base.html >>$base.wml
+# rm $base.html
+ perl -i~ -0777 -p -e 's|</dd>\s*<pre(.*?)</pre>\s*<dd>|</dd><dd><pre$1</pre></dd><dd>|sg' $base.wml
+ rm $base.html $base.pre
+ descr=""
+}
diff --git a/website/build.sh b/website/build.sh
new file mode 100755 (executable)
index 0000000..c6a3bc5
--- /dev/null
@@ -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 (executable)
index 0000000..4528e6b
--- /dev/null
@@ -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 (file)
index 0000000..4f08e6c
--- /dev/null
@@ -0,0 +1,8 @@
+<PAGE AUTHOR = "Tobias Oetiker <tobi@oetiker.ch>"
+        PAGE = "doc">
+
+<H1>RRDtool Documentation</H1>
+
+<dl>
+#include "index.inc"
+</dl>
diff --git a/website/index.wml b/website/index.wml
new file mode 100644 (file)
index 0000000..406f43d
--- /dev/null
@@ -0,0 +1,29 @@
+<PAGE AUTHOR = "Tobias Oetiker <tobi@oetiker.ch>"
+        PAGE = "welcome">
+
+
+<H1>About RRDtool</H1>
+
+<H2>RRDtool</H2>
+
+<P>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</P>
+
+<P>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.</P>
+
+<H2>Get IT</H2>
+
+<P>RRDtool is available for <A HREF="download.html">download</A> 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.</P>
+
+<H2>Project -- Happy Tobi</H2>
+
+<P>You like RRDtool? <A HREF="$(ROOT)/license.html">There is a simple way to show your appreciation</A>.</P>
diff --git a/website/navbar.inc b/website/navbar.inc
new file mode 100644 (file)
index 0000000..b711838
--- /dev/null
@@ -0,0 +1,33 @@
+<nav:bar 0     main "">
+ <nav:but welcome        "Welcome"                 index                         />
+ <nav:but doc            "Documentation"           doc/index          doc       />
+ <nav:but tut            "Tutorials"               tut/index           tut       />
+ <nav:but prog           "Programming"             prog/index          prog      />
+ <nav:but down           "Download"                down                          />
+ <nav:but sup            "Support"                 sup                           />
+ <nav:but cast           "Cast"                   cast                          />
+</nav:bar>
+
+<nav:bar 1 doc           "doc/">
+#include "doc/navbar.inc"
+</nav:bar>
+
+<nav:bar 1 tut           "tut/">
+#include "tut/navbar.inc"
+</nav:bar>
+
+<nav:bar 1 prog           "prog/">
+#include "prog/navbar.inc"
+</nav:bar>
+
+# <nav:bar 1 probe        "probe/">
+# #include "probe/navbar.inc"
+# </nav:bar>
+
+# <nav:bar 1 matcher      "matcher/">
+# #include "matcher/navbar.inc"
+# </nav:bar>
+
+# <nav:bar 1 lib               "lib/">
+# #include "lib/navbar.inc"
+# </nav:bar>
diff --git a/website/prog/build.sh b/website/prog/build.sh
new file mode 100755 (executable)
index 0000000..c17aa06
--- /dev/null
@@ -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 (file)
index 0000000..480f08d
--- /dev/null
@@ -0,0 +1,8 @@
+<PAGE AUTHOR = "Tobias Oetiker <tobi@oetiker.ch>"
+        PAGE = "prog">
+
+<H1>RRDtool Programming</H1>
+
+<dl>
+#include "index.inc"
+</dl>
diff --git a/website/tut/build.sh b/website/tut/build.sh
new file mode 100755 (executable)
index 0000000..67e0bd7
--- /dev/null
@@ -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 (file)
index 0000000..afbbfd2
--- /dev/null
@@ -0,0 +1,8 @@
+<PAGE AUTHOR = "Tobias Oetiker <tobi@oetiker.ch>"
+        PAGE = "tut">
+
+<H1>RRDtool Tutorial</H1>
+
+<dl>
+#include "index.inc"
+</dl>