[gtk-doc] mkdb: also replace entities in non-markdown sections



commit d1c3e1708f079ab91502e83304fb88d74e6f8d0d
Author: Stefan Sauer <ensonic users sf net>
Date:   Wed Aug 9 15:58:35 2017 +0200

    mkdb: also replace entities in non-markdown sections
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=783420

 gtkdoc/mkdb.py                      |    6 ++++++
 tests/bugs/docs/tester-sections.txt |    1 +
 tests/bugs/src/tester.c             |   32 ++++++++++++++++++++++++++++++++
 tests/bugs/src/tester.h             |    1 +
 4 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py
index b7e4413..e103138 100644
--- a/gtkdoc/mkdb.py
+++ b/gtkdoc/mkdb.py
@@ -2669,6 +2669,12 @@ def ExpandAbbreviations(symbol, text):
     """
     # Note: This is a fallback and normally done in the markdown parser
 
+    logging.debug('expand abbreviations for "%s", text: [%s]', symbol, text)
+    m = re.search(r'\|\[[^\n]*\n(.*)\]\|', text, flags=re.M | re.S)
+    if m:
+        logging.debug('replaced entities in code block')
+        text = text[:m.start(1)] + md_to_db.ReplaceEntities(m.group(1)) + text[m.end(1):]
+
     # Convert "|[" and "]|" into the start and end of program listing examples.
     # Support \[<!-- language="C" --> modifiers
     text = re.sub(r'\|\[<!-- language="([^"]+)" -->', r'<informalexample><programlisting 
language="\1"><![CDATA[', text)
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index ca23ab0..fe1013c 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -70,6 +70,7 @@ bug_749142
 deprecation_notice
 bug_741941
 bug_732689
+bug_783420
 gst_play_marshal_BUFFER__BOXED
 <SUBSECTION Standard>
 <SUBSECTION Private>
diff --git a/tests/bugs/src/tester.c b/tests/bugs/src/tester.c
index ec0e31a..cc87ff5 100644
--- a/tests/bugs/src/tester.c
+++ b/tests/bugs/src/tester.c
@@ -461,3 +461,35 @@ void
 bug_749142 (void)
 {
 }
+
+/**
+ * bug_783420:
+ * @in: input
+ * @out: output
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=783420
+ *
+ * |[
+ * #include <tester.h>
+ *
+ * int res;
+ * bug_783420(42, &res);
+ * ]|
+ *
+ * <refsect2 id="subsect">
+ * <title>Subsection</title>
+ * <para>
+ * Lorem ipsum ...
+ * |[
+ * #include <tester.h>
+ *
+ * int res;
+ * bug_783420(42, &res);
+ * ]|
+ * </para>
+ * </refsect2>
+ */
+void
+bug_783420 (int in, int *out)
+{
+}
\ No newline at end of file
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index b664660..4958374 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -506,6 +506,7 @@ void bug_741941(void *object, void *par) G_GNUC_NONNULL(1) G_GNUC_NONNULL(2);
 void bug_732689 (const gchar *spec);
 void bug_749142 (void);
 
+void bug_783420 (int in, int *out);
 
 /**
  * BUG_731417_DEPRECATED:


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