#!/usr/bin/perl #-------------- #convert a text file to docbook XML, the quickhack version use strict; use warnings; if (defined $ARGV[0]){ open SOURCE, $ARGV[0] or die("$!"); } else{ print "usage: txt2dcb [text file]" and die; } print ''; print "\n
\n"; my $marker = 0; my $isheader = 1; my $line; my $string; while(defined($string = )){ if($string eq "\n" and $marker == 0){ if ($isheader){ print "\t$line\n"; } else{ print "\t$line\n" unless !$line; } $line = undef; $isheader = undef; $marker++; } elsif($string eq "\n" and $marker == 1){ $isheader = 1; } else{ chomp($string); if (defined $line){ $line = $line.$string; } else{ $line = $string; } $marker = 0; } } print "\n
";