[gtk-doc] Use a table for struct members



commit e1a2fd56f3f8ff8d661867410631199c3e1ca71d
Author: William Jon McCann <william jon mccann gmail com>
Date:   Mon Feb 10 14:16:58 2014 -0500

    Use a table for struct members
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723991

 gtkdoc-mkdb.in  |   21 +++++++++++++++------
 style/style.css |   16 ++++++++++++++++
 2 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index c25b3f9..d509201 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -1704,22 +1704,31 @@ sub OutputStruct {
         my $missing_parameters = "";
         my $unused_parameters = "";
 
-        $desc .= "<variablelist role=\"struct\">\n";
+        $desc .= <<EOF;
+<refsect3 role="struct_members">\n<title>Members</title>
+<informaltable role="struct_members_table" pgwide="1" frame="none">
+<tgroup cols="3">
+<colspec colname="name" colwidth="300px"/>
+<colspec colname="description"/>
+<colspec colname="annotations" colwidth="200px"/>
+<tbody>
+EOF
+
         while (@fields) {
             my $field_name = shift @fields;
             my $text = shift @fields;
             my $field_descr = $field_descrs{$field_name};
             my $param_annotations = "";
 
-            $desc .= "<varlistentry><term>$text</term>\n";
+            $desc .= "<row><entry role=\"struct_member_name\"><para>$text</para></entry>\n";
             if (defined $field_descr) {
                 ($field_descr,$param_annotations) = &ExpandAnnotation($symbol, $field_descr);
                 $field_descr = &ConvertMarkDown($symbol, $field_descr);
-                $field_descr .= $param_annotations;
                 # trim
                 $field_descr =~ s/^(\s|\n)+//msg;
                 $field_descr =~ s/(\s|\n)+$//msg;
                 $desc .= "<listitem>$field_descr</listitem>\n";
+                $desc .= "<entry role=\"struct_member_description\">$field_descr</entry>\n<entry 
role=\"struct_member_annotations\">$param_annotations</entry>\n";
                 delete $field_descrs{$field_name};
             } else {
                 &LogWarning (&GetSymbolSourceFile ($symbol), &GetSymbolSourceLine($symbol),
@@ -1729,11 +1738,11 @@ sub OutputStruct {
                 } else {
                     $missing_parameters = $field_name;
                 }
-                $desc .= "<listitem />\n";
+                $desc .= "<entry /><entry />\n";
             }
-            $desc .= "</varlistentry>\n";
+            $desc .= "</row>\n";
         }
-        $desc .= "</variablelist>";
+        $desc .= "</tbody></tgroup></informaltable>\n</refsect3>\n";
         foreach my $field_name (keys %field_descrs) {
             &LogWarning (&GetSymbolSourceFile ($symbol), &GetSymbolSourceLine($symbol),
                 "Field description for $symbol"."::"."$field_name is not used from source code comment 
block.");
diff --git a/style/style.css b/style/style.css
index d544b0f..8a1afcf 100644
--- a/style/style.css
+++ b/style/style.css
@@ -183,6 +183,16 @@ div.informaltable table td, div.informaltable table th
   color: #555753;
 }
 
+.struct_member_name
+{
+  text-align: right;
+}
+
+.struct_member_annotations
+{
+  color: #555753;
+}
+
 div.table table
 {
   border-collapse: collapse;
@@ -323,6 +333,12 @@ h2 .extralinks, h3 .extralinks
   font-weight: normal;
 }
 
+.structfield
+{
+  font-style: normal;
+  font-weight: normal;
+}
+
 /* code listings */
 
 .listing_code .programlisting .cbracket   { color: #a40000; } /* tango: scarlet red 3 */


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