1 pod2wml (){
2 base=$1
3 [ -z "$descr" ] && descr=$base
4 [ -z "$menu" ] && menu=$descr
5 perl-5.8.8 -I/home/oetiker/checkouts/mrtg/trunk/web/bin/lib -MPod::Simple::HTML -e Pod::Simple::HTML::go $base.pod $base.html
6 #Thing.pod Thing.html
7 # pod2html-5.8.8 --infile=$base.pod --outfile=$base.pre --noindex --htmlroot='$(ROOT)' --podroot=$SITEROOT --podpath=$PODPATH
8 # $SITEROOT/bin/fix-pod2html.pl $base.pre | $SITEROOT/bin/fix-hrefs.pl >$base.html
9 echo "<nav:but ${sect}_$base \"$menu\" $base/>" >>navbar.inc
10 printf "<dt><a href=\"$base.en.html\">" >>index.inc
11 grep -i $base $base.pod |fgrep ' - '|head -1|sed 's| - |</a></dt><dd>|' >>index.inc
12 echo "</dd>" >>index.inc
13 echo "<page page=\"${sect}_$base\"" > $base.wml
14 perl-5.8.8 -0777 -n -e 's|E<lt>|<|g;s|E<gt>|>|g;m|=head1 AUTHO\S+\s*(.+)| && do {$a=$1;$a =~ s/>.*/>/; $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
15 # 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
16 true <<'XXXX'
17 perl-5.8.8 -0777 -n -e '
18 s|.*?(<h1.+)</body>.*|$1|s;
19 for($i=5;$i>0;$i--){
20 $j=$i-1;
21 s|(</?h)$j>|$1$i>|g
22 };
23 s|<h2.*?>.*?NAME.*?</h2>.*?<p.*?>\s*(.+?)\s*- .*?</p>|<h1>$1</h1>|s;
24 s{<li></li>(.+?)(?=<li>|</?ul>|</?ol>)}{<li>$1</li>}sg;
25 s|<dt><strong>\s*(.*?)</strong>\s*<dd>|<dt>$1</dt>\n<dd>|sg;
26 s|<dd>\s*<p>\s*(.*?)\s*</p>\s*</dd>|<dd>$1</dd>|sg;
27 s|<li>\s*<p>([^<]+?)</p>\s*</li>|<li>$1</li>|sg;
28 s|<p>\s*</p>|\n|g;
29 s|\n\s|\n|g;
30 s|\s*</pre>\s*<pre>\s*|\n\n|g;
31 s|(\S)</pre>|$1\n</pre>|g;
32 s|<pre>(.+?)</pre>|<protect><pre>$1</pre></protect>|gs;
33 # s|<strong>\s*(.+?)\s*</strong><br />\s+</dt>|$1</dt>\n|g;
34 s|<hr />\s*(<h\d>)|$1|g;
35 s|<dd>\s*</dd>||gs;
36 s|<a href=".*?/website|<a href="\$(ROOT)|g;
37 s|(<h2><a.*?>)\s*(\S)(.+?)\s*(</a></h2>)|$1$2\L$3\E$4|g;
38 print
39 ' $base.html >>$base.wml
40 # rm $base.html
41 perl-5.8.8 -i~ -0777 -p -e 's|</dd>\s*<pre(.*?)</pre>\s*<dd>|</dd><dd><pre$1</pre></dd><dd>|sg' $base.wml
42 XXXX
43 perl-5.8.8 -0777 -n -e '
44 s|</p>\s*<dt>|</p></dd>\n<dt>|sg;
45 s|</pre>\s*<dt>|</pre></dd>\n<dt>|sg;
46 s|<pre>(.+?)</pre>|<protect><pre>$1</pre></protect>|gs;
47 s|.*?(<h1.+)</body>.*|$1|s;
48 for($i=5;$i>0;$i--){
49 $j=$i-1;
50 s|(</?h)$j>|$1$i>|g
51 };
52 s|http://search.cpan.org/perldoc\?([^ #."]+)|$1.en.html|g;
53 s|<h2.*?>.*?NAME.*?</h2>.*?<p.*?>\s*(.+?)\s*- .*?</p>|<h1>$1</h1>|s;
55 print
56 ' $base.html >>$base.wml
57 # rm $base.html
58 rm $base.html
59 # $base.pre
60 descr=""
61 }