[glibmm] docextract_to_xml.py: Minor fix in internal data
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] docextract_to_xml.py: Minor fix in internal data
- Date: Thu, 4 Jun 2015 14:06:40 +0000 (UTC)
commit 7f6feb8bbbe2b233248b6916253473a62ee6eed4
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Thu Jun 4 16:03:45 2015 +0200
docextract_to_xml.py: Minor fix in internal data
* tools/defs_gen/docextract.py:
* tools/defs_gen/docextract_to_xml.py: Keep 'SECTION:' in section names when
data is stored in a dictionary (map, hash table). As before, don't write it
to the 'section' elements in the generated xml file.
tools/defs_gen/docextract.py | 2 +-
tools/defs_gen/docextract_to_xml.py | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/tools/defs_gen/docextract.py b/tools/defs_gen/docextract.py
index 7ee2ef5..1b18f56 100644
--- a/tools/defs_gen/docextract.py
+++ b/tools/defs_gen/docextract.py
@@ -70,7 +70,7 @@ function_name_pattern = re.compile(r'^([a-z]\w*)\s*:?(\s*\(.*\)\s*){0,2}\s*$')
signal_name_pattern = re.compile(r'^([A-Z]\w+::[a-z0-9-]+)\s*:?(\s*\(.*\)\s*){0,2}\s*$')
property_name_pattern = re.compile(r'^([A-Z]\w+:[a-z0-9-]+)\s*:?(\s*\(.*\)\s*){0,2}\s*$')
enum_name_pattern = re.compile(r'^([A-Z]\w+)\s*:?(\s*\(.*\)\s*){0,2}\s*$')
-section_name_pattern = re.compile(r'^SECTION:([a-z0-9_-]+)\s*:?(\s*\(.*\)\s*){0,2}\s*$')
+section_name_pattern = re.compile(r'^(SECTION:[a-z0-9_-]+)\s*:?(\s*\(.*\)\s*){0,2}\s*$')
return_pattern = re.compile(r'^ ?(returns:|return\s+value:)(.*\n?)$', re.IGNORECASE)
deprecated_pattern = re.compile(r'^(deprecated\s*:\s*.*\n?)$', re.IGNORECASE)
rename_to_pattern = re.compile(r'^(rename\s+to)\s*:\s*(.*\n?)$', re.IGNORECASE)
diff --git a/tools/defs_gen/docextract_to_xml.py b/tools/defs_gen/docextract_to_xml.py
index 3bf75c6..a322135 100755
--- a/tools/defs_gen/docextract_to_xml.py
+++ b/tools/defs_gen/docextract_to_xml.py
@@ -116,8 +116,17 @@ if __name__ == '__main__':
elif block_type == 'property' and not with_properties:
continue
# Likewise for sections.
- elif block_type == 'section' and not with_sections:
- continue
+ elif block_type == 'section':
+ if not with_sections:
+ continue
+ # Delete 'SECTION:' from the name.
+ # (It could easily be deleted by docextract.extract(), but then
+ # there would be a theoretical risk that a section name would
+ # be identical to a function name, when all kinds of elements
+ # are stored in the docs dictionary with their names as key.)
+ last_colon_pos = name.rfind(':')
+ if last_colon_pos >= 0:
+ name = name[last_colon_pos+1:]
# Likewise for enums.
elif block_type == 'enum' and not with_enums:
continue
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]