diff options
| author | fukachan <fukachan> | 2001-04-23 14:37:42 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-04-23 14:37:42 +0000 |
| commit | bd0f24504c76d450b3025cf2cb486cc411381d6c (patch) | |
| tree | 510a401d72b83fe1a7058293e62c63a5ab4901d6 /doc | |
| parent | 193f16fd4e9369b491330ae40568f6c91d6db523 (diff) | |
| download | fml8-bd0f24504c76d450b3025cf2cb486cc411381d6c.tar.gz fml8-bd0f24504c76d450b3025cf2cb486cc411381d6c.tar.bz2 fml8-bd0f24504c76d450b3025cf2cb486cc411381d6c.zip | |
html -> sgml converter with tiny functions
Diffstat (limited to 'doc')
| -rwxr-xr-x | doc/bin/html2sgml.pl | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/doc/bin/html2sgml.pl b/doc/bin/html2sgml.pl new file mode 100755 index 00000000..b00e704a --- /dev/null +++ b/doc/bin/html2sgml.pl @@ -0,0 +1,72 @@ +#!/usr/local/bin/perl +#-*- perl -*- +# +# Copyright (C) 2001 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: __template.pm,v 1.5 2001/04/03 09:45:39 fukachan Exp $ +# + +use strict; +use Carp; + +my $para = ''; +my $hr = 0; +my $listitem = 0; + +while (<>) { + # <P> + if (m@<P>@i) { + print "<para>\n"; + $para = 1; + next; + } + + if (/^\s*$/ && $para) { + print "\t" if $para eq 'tab'; + print "</para>\n\n"; + $para = 0; + } + + # HR + if (m@<HR>@i) { + print "</sect1>\n" if $hr; + s@<HR>@<sect1>@gi; + $hr = 1; + } + + # A + s@<A\s*HREF=@<ulink url=@gi; + s@</A>@</ulink>@gi; + + # PRE + s@<PRE>@<programlisting>@gi; + s@</PRE>@</programlisting>@gi; + + # UL + s@<UL>@<itemizedlist>@gi; + s@</UL>@</itemizedlist>@gi; + + if (m@<LI>@i) { + print "\t" if $para eq 'tab' && $listitem; + print "\t</listitem>\n\n" if $listitem; + s@<LI>@<listitem>\n\t<para>\n\t@gi; + $para = "tab"; + $listitem = 1; + } + + if (m@</itemizedlist>@) { + print "\t" if $para eq 'tab' && $listitem;; + print "\t</listitem>\n\n" if $listitem; + $listitem = 0; + } + + + # BR + s@<BR>@<newline>@gi; + + print; +} + +exit 0; |
