diff options
author | Mathieu Duponchelle <mduponchelle1@gmail.com> | 2020-09-07 13:54:42 +0000 |
---|---|---|
committer | Mathieu Duponchelle <mduponchelle1@gmail.com> | 2020-09-07 13:54:42 +0000 |
commit | 8b0a7f4cf8f34e79c90af5ee73eff03d876e87e7 (patch) | |
tree | e64f4ffd064fe31dad8d3934add58aa1a5e1b6a3 | |
parent | 25dcd89afabd57f199e33cb253aa7fd7fb91ec01 (diff) | |
parent | de6512b31b614567bf1800406303d1ccfb6d9455 (diff) | |
download | gobject-introspection-8b0a7f4cf8f34e79c90af5ee73eff03d876e87e7.tar.gz |
Merge branch 'fix-350' into 'master'
giscanner: Fix section matching for documentation
Closes #350
See merge request GNOME/gobject-introspection!237
-rw-r--r-- | giscanner/annotationparser.py | 7 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/identifier_section.xml | 34 |
2 files changed, 40 insertions, 1 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index f8257206..c9ff5c2b 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -1357,7 +1357,12 @@ class GtkDocCommentBlockParser(object): result = SECTION_RE.match(line) if result: - identifier_name = 'SECTION:%s' % (result.group('section_name'), ) + # Some projects use kebab-case or CamelCase for section + # names. Convert them all to flat case so we can match + # them easily later on. + identifier_name = 'SECTION:%s' % (result.group('section_name') + .replace("-", "") + .lower(), ) identifier_delimiter = None identifier_fields = None identifier_fields_start = None diff --git a/tests/scanner/annotationparser/gi/identifier_section.xml b/tests/scanner/annotationparser/gi/identifier_section.xml index fad2b2ed..380ab87b 100644 --- a/tests/scanner/annotationparser/gi/identifier_section.xml +++ b/tests/scanner/annotationparser/gi/identifier_section.xml @@ -329,4 +329,38 @@ returns nothing.</description> */</output> </test> + +<test> + <!-- + Section name in different case styles + See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/350 + --> + <input>/** + * SECTION:Meep-App + * @short_description: module for gtk-doc unit test + * + * This file contains non-sense code for the sole purpose of testing the docs. + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:meepapp</name> + </identifier> + <parameters> + <parameter> + <name>short_description</name> + <description>module for gtk-doc unit test</description> + </parameter> + </parameters> + <description>This file contains non-sense code for the sole purpose of testing the docs.</description> + </docblock> + </parser> + <output>/** + * SECTION:meepapp + * @short_description: module for gtk-doc unit test + * + * This file contains non-sense code for the sole purpose of testing the docs. + */</output> +</test> + </tests> |