From bd0f24504c76d450b3025cf2cb486cc411381d6c Mon Sep 17 00:00:00 2001 From: fukachan Date: Mon, 23 Apr 2001 14:37:42 +0000 Subject: html -> sgml converter with tiny functions --- doc/bin/html2sgml.pl | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 doc/bin/html2sgml.pl 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 (<>) { + #

+ if (m@

@i) { + print "\n"; + $para = 1; + next; + } + + if (/^\s*$/ && $para) { + print "\t" if $para eq 'tab'; + print "\n\n"; + $para = 0; + } + + # HR + if (m@


@i) { + print "\n" if $hr; + s@
@@gi; + $hr = 1; + } + + # A + s@@@gi; + + # PRE + s@
@@gi;
+    s@
@@gi; + + # UL + s@
    @@gi; + s@
@@gi; + + if (m@
  • @i) { + print "\t" if $para eq 'tab' && $listitem; + print "\t\n\n" if $listitem; + s@
  • @\n\t\n\t@gi; + $para = "tab"; + $listitem = 1; + } + + if (m@@) { + print "\t" if $para eq 'tab' && $listitem;; + print "\t\n\n" if $listitem; + $listitem = 0; + } + + + # BR + s@
    @@gi; + + print; +} + +exit 0; -- cgit v1.2.1