# Typedef
elsif ( $decl =~ /^\s*typedef\s+
+ (?:typename\s+)? # `typename' keyword
(.*?\s*[\*&]?) # type
- \s*([-\w_\:]+) # name
+ \s+([-\w_\:]+) # name
+ \s*(\[[-\w_\:<>\s]*\])? # array
\s*[{;]\s*$/xs ) {
- print "Typedef: <$1> <$2>\n" if $debug;
- $newNode = newTypedef( $1, $2 );
+ print "Typedef: <$1 $3> <$2>\n" if $debug;
+ $newNode = newTypedef( $1.$3, $2 );
}
# Enum
my $pure = $4 eq "" ? 0 : 1;
if ( $tpn =~ /((?:\w+\s*::\s*)?operator.*?)\s*$/ # operator
- || $tpn =~ /((?:\w*\s*::\s*~?)?[-\w:]+)\s*$/ ) { # normal
+ || $tpn =~ /((?:\w*(?:\s*<[\w\s_,]*>\s*)?\s*::\s*~?)?[-\w:]+)\s*$/ ) { # normal
my $name = $1;
$tpn = $`;
$newNode = newMethod( $tpn, $name,
print "Cracked: [$retType] [$name]\n\t[$params]\n\t[$const]\n"
if $debug;
- if ( $retType =~ /([\w\s_<>,]+)\s*::\s*$/ ) {
+ if ( $retType =~ /(\w+(<[\w\s_,]*>|\s*::\s*\w+)*)\s*::\s*$/ ) {
# check if stuff before :: got into rettype by mistake.
$retType = $`;
($name = $1."::".$name);
if !defined $type;
if( $lasttype eq "ListItem" && $type ne $lasttype ) {
- print CLASS "</ul><p>\n";
+ print CLASS "</ul>\n\n<p>\n";
}
if( $type eq "DocText" ) {
print CLASS "", deref( $name, $rootnode );
}
elsif ( $type eq "Pre" ) {
- print CLASS "</p><pre>\n",
- esc( $name ), "\n</pre><p>";
+ print CLASS "</p>\n\n<pre>\n",
+ esc( $name ), "\n</pre>\n\n<p>\n";
}
elsif( $type eq "Ref" ) {
my $ref = $node->{Ref};
}
}
elsif ( $type eq "DocSection" ) {
- print CLASS "</p><H3>",
- deref( $name, $rootnode),"</H3><p>";
+ print CLASS "</p>\n\n<H3>",
+ deref( $name, $rootnode),"</H3>\n<p>\n";
}
elsif ( $type eq "Image" ) {
- print CLASS "</p><img url=\"",
- $node->{Path}, "\"><p>";
+ print CLASS "</p>\n<img url=\"",
+ $node->{Path}, "\">\n<p>\n";
}
elsif ( $type eq "ParaBreak" ) {
- print CLASS "</p><p>";
+ print CLASS "</p>\n\n<p>";
}
elsif ( $type eq "ListItem" ) {
if ( $lasttype ne "ListItem" ) {
- print CLASS "</p><ul>\n";
+ print CLASS "</p>\n\n<ul>\n";
}
print CLASS "<li>",
deref( $name, $rootnode ), "</li>\n";
}
if( $type eq "ListItem" ) {
- print CLASS "</ul><p>\n";
+ print CLASS "</ul>\n\n<p>\n";
}
- print CLASS "</p>";
+ print CLASS "</p>\n";
}
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 .= "<code>".esc($1)."</code>";
- }
- elsif ( $text =~/\@em\s+(\w+)/ ) { # emphasized
- $out .= "<em>".esc($1)."</em>";
+ # 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 .= "<code>".esc($content)."</code>";
+ }
+
+ # @em -- emphasized
+ elsif ( $command eq "em" ) {
+ $out .= "<em>".esc($content)."</em>";
+ }
+
+ # @sect1-4 -- section header
+ elsif ( $command =~ /^sect([1-4])$/ ) {
+ $out .= "<h$1>".esc($content)."</h$1>";
+ }
+
+ # unknown command. warn and copy command
+ else {
+ print "Unknown command @", $command, "\n";
+ $out .= esc($text);
+ }
}
+ # no @x command, thus regular text
else {
$out .= esc($text);
}