diff options
author | Kjell Ahlstedt <kjell.ahlstedt@bredband.net> | 2014-04-08 10:45:56 +0200 |
---|---|---|
committer | Kjell Ahlstedt <kjell.ahlstedt@bredband.net> | 2014-04-08 10:45:56 +0200 |
commit | 2fb27b49beae3310e156054545c2421690a1a46b (patch) | |
tree | df9b7608ef5c421d23fb943d1e7e5982aa9b667a | |
parent | efbecec2303a2b6cd0dcbe353be29afcbbc84b19 (diff) | |
download | glibmm-2fb27b49beae3310e156054545c2421690a1a46b.tar.gz |
gmmproc: Small improvement of enum documentation
* tools/pm/DocsParser.pm: Some small improvements of
lookup_enum_documentation(). E.g. '\n' is replace by ' ' instead of removed,
and G_NORMALIZE_DEFAULT is converted to NORMALIZE_DEFAULT instead of
Normalize::DEFAULT. But still not perfect.
-rw-r--r-- | tools/pm/DocsParser.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/pm/DocsParser.pm b/tools/pm/DocsParser.pm index f7c9ea7f..854502d8 100644 --- a/tools/pm/DocsParser.pm +++ b/tools/pm/DocsParser.pm @@ -269,15 +269,14 @@ sub lookup_enum_documentation($$$) { my $desc = $$param_descriptions->{$param}; - # Remove the initial prefix which would be something like GTK_. - $param =~ s/\b[A-Z]+_//g; - $desc =~ s/\b[A-Z]+_//g; + # Remove the initial prefix in the name of the enum constant. Would be something like GTK_. + $param =~ s/\b[A-Z]+_//; # Now apply custom substitutions. for(my $i = 0; $i < scalar(@subst_in); ++$i) { - $param =~ s/${subst_in[$i]}/${subst_out[$i]}/; - $desc =~ s/${subst_in[$i]}/${subst_out[$i]}/; + $param =~ s/${subst_in[$i]}/${subst_out[$i]}/; + $desc =~ s/${subst_in[$i]}/${subst_out[$i]}/; } # Skip this element, if its name has been deleted. @@ -286,9 +285,11 @@ sub lookup_enum_documentation($$$) $param =~ s/([a-zA-Z0-9]*(_[a-zA-Z0-9]+)*)_?/$1/g; if(length($desc) > 0) { - $desc =~ s/\n//g; - $desc .= '.' unless($desc =~ /(?:^|\.)$/); - $docs .= "\@var $cpp_enum_name ${param}\n\u${desc}\n\n"; + $desc =~ s/\n/ /g; + $desc =~ s/ $//; + $desc =~ s/^\s+//; # Chop off leading whitespace + $desc .= '.' unless($desc =~ /(?:^|\.)$/); + $docs .= "\@var $cpp_enum_name ${param}\n \u${desc}\n\n"; # \u = Convert next char to uppercase } } @@ -600,7 +601,8 @@ sub substitute_identifiers($$) # Undo wrong substitutions. s/\bHas::/HAS_/g; s/\bNo::/NO_/g; - s/\bG:://g; #Rename G::Something to Something. Doesn't seem to work. murrayc. + s/\bO::/O_/g; + s/\bG:://g; #Rename G::Something to Something. # Substitute callback types to slot types. s/(\b\w+)Callback/Slot$1/g; |