[glibmm] gmmproc: docs: Convert signal and property names correctly.



commit 274870acdd9baf8b163fd224a6a4f92469796819
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Mon Feb 13 17:41:00 2012 -0500

    gmmproc: docs: Convert signal and property names correctly.
    
    	* tools/pm/DocsParser.pm (substitute_identifiers): Search for gtk-doc
    	property and signal references and convert them to appropriate C++
    	names so that they are referenced correctly in the documentation.
    
    	Bug #668918.

 ChangeLog              |   10 ++++++++++
 tools/pm/DocsParser.pm |   20 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bb3458e..f74ab31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-02-13  Josà Alburquerque  <jaalburquerque gmail com>
+
+	gmmproc: docs: Convert signal and property names correctly.
+
+	* tools/pm/DocsParser.pm (substitute_identifiers): Search for gtk-doc
+	property and signal references and convert them to appropriate C++
+	names so that they are referenced correctly in the documentation.
+
+	Bug #668918.
+
 2012-02-08  Josà Alburquerque  <jaalburquerque gmail com>
 
 	gmmproc: DocsParser.pm (convert_tags_to_doxygen): Correct typo.
diff --git a/tools/pm/DocsParser.pm b/tools/pm/DocsParser.pm
index 5e80242..29d1d1d 100644
--- a/tools/pm/DocsParser.pm
+++ b/tools/pm/DocsParser.pm
@@ -433,6 +433,26 @@ sub substitute_identifiers($$)
   {
     # TODO: handle more than one namespace
 
+    # Convert property names to C++.
+    # The standard (and correct) gtk-doc way of referring to properties.
+    s/(#[A-Z]\w+):([a-z\d-]+)/my $name = "$1::property_$2()"; $name =~ s"-"_"g; "$name";/ge;
+    # This is an incorrect format but widely used so correctly treat as a
+    # property.
+    s/(\s)::([a-z\d-]+)(\s+property)/my $name = "$1property_$2()$3"; $name =~ s"-"_"g; "$name";/ge;
+    # This one catches properties written in the gtk-doc block as for example
+    # '#GtkActivatable::related-action property'.  The correct way to write it
+    # would be 'GtkActivatable:related-action' (with a single colon and not
+    # two because the double colons are specifically for signals -- see the
+    # gtk-doc docs:
+    # http://developer.gnome.org/gtk-doc-manual/unstable/documenting_symbols.html.en)
+    # but a few are written with the double colon in the gtk+ docs so this
+    # protects against those errors.
+    s/([A-Z]\w+)::([a-z\d-]+)(\s+property)/my $name = "$1::property_$2()$3"; $name =~ s"-"_"g; "$name";/ge;
+
+    # Convert signal names to C++.
+    s/(^|\s)::([a-z\d-]+)([^:\w]|$)/my $name = "$1signal_$2()$3"; $name =~ s"-"_"g; "$name";/ge;
+    s/(#[A-Z]\w+)::([a-z\d-]+)([^:\w]|$)/my $name = "$1::signal_$2()$3"; $name =~ s"-"_"g; "$name";/ge;
+
     s/[#%]([A-Z][a-z]*)([A-Z][A-Za-z]+)\b/$1::$2/g; # type names
 
     s/[#%]([A-Z])([A-Z]*)_([A-Z\d_]+)\b/$1\L$2\E::$3/g; # enum values



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]