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=$SITEROOT --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|<p>\s*</p>|\n|g;
23 s|\n\s|\n|g;
24 s|\s*</pre>\s*<pre>\s*|\n\n|g;
25 s|(\S)</pre>|$1\n</pre>|g;
26 s|<pre>(.+?)</pre>|<protect><pre>$1</pre></protect>|gs;
27 s|<strong>\s*(.+?)\s*</strong><br />\s+</dt>|$1</dt>\n|g;
28 s|<hr />\s*<h2>|<h2>|g;
29 s|<dd>\s*</dd>||gs;
30 s|<a href=".*?/website|<a href="\$(ROOT)|g;
31 s|(<h2><a.*?>)\s*(\S)(.+?)\s*(</a></h2>)|$1$2\L$3\E$4|g;
32 print
33 ' $base.html >>$base.wml
34 # rm $base.html
35 perl -i~ -0777 -p -e 's|</dd>\s*<pre(.*?)</pre>\s*<dd>|</dd><dd><pre$1</pre></dd><dd>|sg' $base.wml
36 rm $base.html $base.pre
37 descr=""
38 }