[gtk-doc] Add support for reference links



commit 49fb0d60370a2409495ca03a55b2810b69840e9c
Author: William Jon McCann <william jon mccann gmail com>
Date:   Thu Feb 6 19:26:59 2014 -0500

    Add support for reference links
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723812

 gtkdoc-mkdb.in              |   18 ++++++++++++++++--
 tests/gobject/src/gobject.c |    4 ++--
 2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index aa34f08..209d21a 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -4988,14 +4988,19 @@ sub MarkDownParseSpanElementsInner {
             $element{"#"} = $2;
           }
           $offset += length ($&);
+        } elsif ($remaining_text =~ /^\s*\[([^\]]*?)\]/) {
+          $element{"ref"} = $1;
+          $offset += length ($&);
         } else {
           undef %element;
         }
       }
 
       if (%element) {
-        $element{"»"} =~ s/&/&amp;/g;
-        $element{"»"} =~ s/</&lt;/g;
+        if ($element{"»"}) {
+          $element{"»"} =~ s/&/&amp;/g;
+          $element{"»"} =~ s/</&lt;/g;
+        }
         if ($element{"!"}) {
           $markup .= "<inlinemediaobject><imageobject><imagedata fileref=\"" . $element{"»"} . 
"\"></imagedata></imageobject>";
 
@@ -5004,6 +5009,15 @@ sub MarkDownParseSpanElementsInner {
           }
 
           $markup .= "</inlinemediaobject>";
+        } elsif ($element{"ref"}) {
+          $element{"a"} = &MarkDownParseSpanElementsInner ($element{"a"}, \ markers_rest);
+          $markup .= "<link linkend=\"" . $element{"ref"} . "\"";
+
+          if (defined ($element{"#"})) {
+            # title attribute not supported
+          }
+
+          $markup .= ">" . $element{"a"} . "</link>";
         } else {
           $element{"a"} = &MarkDownParseSpanElementsInner ($element{"a"}, \ markers_rest);
           $markup .= "<ulink url=\"" . $element{"»"} . "\"";
diff --git a/tests/gobject/src/gobject.c b/tests/gobject/src/gobject.c
index 353a9ee..1bcf64e 100644
--- a/tests/gobject/src/gobject.c
+++ b/tests/gobject/src/gobject.c
@@ -39,7 +39,7 @@
  * g_object_unref (myobj);
  * ]|
  *
- * # Examples #
+ * # Examples # {#examples}
  *
  * Here are a few examples.
  *
@@ -122,7 +122,7 @@
  *
  * 1. Really
  *
- *    Has a paragraph.
+ *    Has a paragraph with a [link to the examples][examples].
  *
  * 1. Is
  *


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