summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorentin Noël <corentin.noel@collabora.com>2023-02-24 13:07:25 +0100
committerCorentin Noël <corentin.noel@collabora.com>2023-02-24 13:18:56 +0100
commitdcaf4a44c67cafdd1bdb8c2630cfdf211a8c6b83 (patch)
tree8b98e57bb431f38e7040ce4939b55efe22522496
parent9ff2e441f2626bbdf47f0cb38a5f2c19bd30c420 (diff)
downloadgtk-doc-tintou/escape-annotation.tar.gz
mkdb: Escape <> characters in annotationstintou/escape-annotation
Allows to use nested element-type like GLib.HashTable<utf8,utf8> which is allowed by the introspection.
-rw-r--r--gtkdoc/mkdb.py3
-rw-r--r--tests/annotations/docs/tester-sections.txt1
-rw-r--r--tests/annotations/src/tester.c15
-rw-r--r--tests/annotations/src/tester.h1
4 files changed, 20 insertions, 0 deletions
diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py
index 98fd5eb..1e16f4a 100644
--- a/gtkdoc/mkdb.py
+++ b/gtkdoc/mkdb.py
@@ -2686,6 +2686,9 @@ def ExpandAnnotation(symbol, param_desc):
annotations = re.split(r'\)\s*\(', m.group(1))
logging.info("annotations for %s: '%s'\n", symbol, m.group(1))
for annotation in annotations:
+ # The element-type annotation for instance allows to use GHashTable<utf8,utf8> as annotation
+ annotation = re.sub(r'<', r'&lt;', annotation)
+ annotation = re.sub(r'>', r'&gt;', annotation)
# need to search for the longest key-match in %AnnotationDefinition
match_length = 0
match_annotation = ''
diff --git a/tests/annotations/docs/tester-sections.txt b/tests/annotations/docs/tester-sections.txt
index 3b33f0b..7dc0d44 100644
--- a/tests/annotations/docs/tester-sections.txt
+++ b/tests/annotations/docs/tester-sections.txt
@@ -7,6 +7,7 @@ annotation_allow_none
annotation_nullable
annotation_not_nullable
annotation_elementtype
+annotation_complex_elementtype
annotation_elementtype_transfer
annotation_elementtype_returns
annotation_outparams
diff --git a/tests/annotations/src/tester.c b/tests/annotations/src/tester.c
index ae38512..c8e3a83 100644
--- a/tests/annotations/src/tester.c
+++ b/tests/annotations/src/tester.c
@@ -96,6 +96,21 @@ annotation_elementtype (const GList *list)
}
/**
+ * annotation_complex_elementtype:
+ * @table: (element-type utf8 GHashTable<utf8,utf8>): table that matches strings
+ * to a #GHashTable of key and value strings.
+ *
+ * Document optional parameters.
+ *
+ * Returns: %TRUE for success
+ */
+gboolean
+annotation_complex_elementtype (const GHashTable *table)
+{
+ return TRUE;
+}
+
+/**
* annotation_elementtype_transfer:
* @list: (element-type utf8) (transfer full): list of #GObject instances to search
*
diff --git a/tests/annotations/src/tester.h b/tests/annotations/src/tester.h
index 002de4a..e253505 100644
--- a/tests/annotations/src/tester.h
+++ b/tests/annotations/src/tester.h
@@ -21,6 +21,7 @@ gchar * annotation_nullable (const gchar *uri, const gchar *label);
gchar * annotation_not_nullable (const gchar *uri, const gchar *label);
gboolean annotation_elementtype (const GList *list);
+gboolean annotation_complex_elementtype (const GHashTable *table);
gboolean annotation_elementtype_transfer (const GList *list);
GList *annotation_elementtype_returns (void);