Code

fix for #301: plug memory leak in lua bindings -- bmayland @ leoninedev.com
[rrdtool-all.git] / website / bin / pod2wml.classic.sh
1 pod2wml (){
2  base=$1
3  [ -z "$descr" ] && descr=$base
4  [ -z "$menu" ] && menu=$descr
5  pod2html --infile=$base.pod --outfile=$base.pre --noindex --htmlroot='$(ROOT)' --podroot=$SITEROOT --podpath=$PODPATH
6  $SITEROOT/bin/fix-pod2html.pl $base.pre | $SITEROOT/bin/fix-hrefs.pl >$base.html
7  echo "<nav:but ${sect}_$base      \"$menu\"            $base/>" >>navbar.inc
8  printf "<dt><a href=\"$base.en.html\">" >>index.inc
9  grep $base $base.pod |fgrep ' - '|head -1|sed 's| - |</a></dt><dd>|' >>index.inc 
10  echo "</dd>" >>index.inc
11  echo "<page page=\"${sect}_$base\"" > $base.wml
12  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
13  # 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
14  perl -0777 -n -e '
15   s|.*?(<h1.+)</body>.*|$1|s;
16   for($i=5;$i>0;$i--){
17          $j=$i-1;
18          s|(</?h)$j>|$1$i>|g
19   };
20   s|<h2.*?>.*?NAME.*?</h2>.*?<p.*?>\s*(.+?)\s*- .*?</p>|<h1>$1</h1>|s;
21   s{<li></li>(.+?)(?=<li>|</?ul>|</?ol>)}{<li>$1</li>}sg;
22   s|<dt><strong>\s*(.+?)</strong>\s*<dd>|<dt>$1</dt>\n<dd>|sg;   
23   s|<p>\s*</p>|\n|g;
24   s|\n\s|\n|g;
25   s|\s*</pre>\s*<pre>\s*|\n\n|g;
26   s|(\S)</pre>|$1\n</pre>|g;
27   s|<pre>(.+?)</pre>|<protect><pre>$1</pre></protect>|gs;
28 #  s|<strong>\s*(.+?)\s*</strong><br />\s+</dt>|$1</dt>\n|g;
29   s|<hr />\s*<h2>|<h2>|g;
30   s|<dd>\s*</dd>||gs;
31   s|<a href=".*?/website|<a href="\$(ROOT)|g; 
32   s|(<h2><a.*?>)\s*(\S)(.+?)\s*(</a></h2>)|$1$2\L$3\E$4|g;
33   print 
34  ' $base.html >>$base.wml
35 # rm $base.html
36  perl -i~ -0777 -p -e 's|</dd>\s*<pre(.*?)</pre>\s*<dd>|</dd><dd><pre$1</pre></dd><dd>|sg' $base.wml
37  rm $base.html $base.pre
38  descr=""
39 }