From b28835effc4a5c46ce39151e8afac087138471e4 Mon Sep 17 00:00:00 2001
From: wolf \n";
+ print CLASS "\n\n \n";
}
if( $type eq "DocText" ) {
print CLASS "", deref( $name, $rootnode );
}
elsif ( $type eq "Pre" ) {
- print CLASS " ";
+ print CLASS " \n";
}
elsif( $type eq "Ref" ) {
my $ref = $node->{Ref};
@@ -414,19 +414,19 @@ sub printDoc
}
}
elsif ( $type eq "DocSection" ) {
- print CLASS " ";
+ print CLASS " \n";
}
elsif ( $type eq "Image" ) {
- print CLASS " ";
+ print CLASS " \n";
}
elsif ( $type eq "ParaBreak" ) {
- print CLASS " ";
+ print CLASS " ";
}
elsif ( $type eq "ListItem" ) {
if ( $lasttype ne "ListItem" ) {
- print CLASS "\n",
- esc( $name ), "\n
\n",
+ esc( $name ), "\n
\n\n",
- deref( $name, $rootnode),"
",
+ deref( $name, $rootnode),"
\n\n";
+ print CLASS "
\n"; + print CLASS "\n\n
\n"; } - print CLASS "
"; + print CLASS "\n"; } @@ -602,18 +602,43 @@ sub deref my $out = ""; my $text; - foreach $text ( split (/(\@\w+\s+[\w:#]+)/, $str ) ) { - if ( $text =~ /\@ref\s+([\w:#]+)/ ) { - my $name = $1; - $name =~ s/^\s*#//g; - $out .= wordRef( $name, $rootnode ); - } - elsif ( $text =~ /\@p\s+([\w:#]+)/ ) { - $out .= "".esc($1)."
";
- }
- elsif ( $text =~/\@em\s+(\w+)/ ) { # emphasized
- $out .= "".esc($1)."";
+ # escape @x commands
+ foreach $text ( split (/(\@\w+(?:\s+.+?(?=\s)|\{.*?\}))/, $str ) ) {
+
+ # check whether $text is an @command or the text between
+ # @commands
+ if ( $text =~ /\@(\w+)(?:\s+(.+?)(?:\s|$)|\{(.*?)\})/ ) {
+ my $command = $1;
+ my $content = $2 . $3;
+
+ # @ref -- cross reference
+ if ( $command eq "ref" ) {
+ $content =~ s/^\s*#//g;
+ $out .= wordRef( $content, $rootnode );
+ }
+
+ # @p -- typewriter
+ elsif ( $command eq "p" ) {
+ $out .= "".esc($content)."
";
+ }
+
+ # @em -- emphasized
+ elsif ( $command eq "em" ) {
+ $out .= "".esc($content)."";
+ }
+
+ # @sect1-4 -- section header
+ elsif ( $command =~ /^sect([1-4])$/ ) {
+ $out .= "