#!/usr/bin/perl
# xmlmanhtml - simple xml to man converter
# Copyright (C) 2000-2002 Oliver Kurth
\n",
p => "
";
print "$attr{name}\n"; print "" . $attr{desc} . "\n"; }; /^synopsis$/ and do{ print "Synopsis\n"; $section = $element; }; /^description$/ and do{ print "Description\n"; $section = $element; }; /^options$/ and do{ print "Options\n"; $section = $element; }; /^seealso$/ and do{ print "see also\n"; $section = $element; }; /^section$/ and do{ print "".$attr{name}."\n"; $section = $attr{name}; }; /^arg$/ and do{ print ""; }; /^file$/ and do{ print ""; }; /^opt$/ and do{ print ""; $opt = 1; }; /^manref$/ and do{ if(!$attr{href}){ print "" . $attr{name} ." (" . $attr{section} . ")"; }else{ print "" . $attr{name}. ""; } }; /^p$/ and do{ print ""; # $paragraph = 1; # $break = 1; }; /^url$/ and do{ print "".$attr{href}.""; }; } sub handle_end{ local $_; my $expat = shift; my $element = shift; flush_buf(); my %attr = @_; $section = "" if($section eq $element); print $terminators{$element} if($terminators{$element}); } sub handle_char{ local $_; my $expat = shift; my $string = shift; $string =~ s/&/&/gs; $string =~ s/</gs; $string =~ s/>/>/gs; $string =~ s/"/"/gs; $buffer .= $string; } MAIN:{ my $file = shift; if (!$file) { print STDERR "You need to specify a file to parse\n"; exit(1); } my $parser = new XML::Parser(Handlers => {Start => \&handle_start, End => \&handle_end, Char => \&handle_char}); print ' '; $parser->parsefile($file); print "\n"; } |