diff options
| author | Daniel Elstner <daniel@src.gnome.org> | 2009-01-27 16:21:13 +0000 |
|---|---|---|
| committer | Daniel Elstner <daniel@src.gnome.org> | 2009-01-27 16:21:13 +0000 |
| commit | 90ca9dac132dc396e0f064ff01556740ca09e2b0 (patch) | |
| tree | c191d87721e9b3f088ea4e1381dea5aab8ab43dd | |
| parent | 90ddf11f06d68deeaa8c59b4d83b07808a892281 (diff) | |
| download | pygobject-90ca9dac132dc396e0f064ff01556740ca09e2b0.tar.gz pygobject-90ca9dac132dc396e0f064ff01556740ca09e2b0.tar.xz pygobject-90ca9dac132dc396e0f064ff01556740ca09e2b0.zip | |
Do not escape the ampersand "&" in entity references (bug #568485).
* codegen/docextract_to_xml.py (escape_text): Do not escape the
ampersand "&" in entity references (bug #568485). Replace some
unusual entity references in the output with their literal values.
svn path=/trunk/; revision=998
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rwxr-xr-x | codegen/docextract_to_xml.py | 19 |
2 files changed, 18 insertions, 7 deletions
@@ -1,3 +1,9 @@ +2009-01-27 Daniel Elstner <danielk@openismus.com> + + * codegen/docextract_to_xml.py (escape_text): Do not escape the + ampersand "&" in entity references (bug #568485). Replace some + unusual entity references in the output with their literal values. + 2009-01-14 Paul Pogonyshev <pogonyshev@gmx.net> Bug 566571 – gtk.Buildable interface method override is not diff --git a/codegen/docextract_to_xml.py b/codegen/docextract_to_xml.py index 76ac85d..f8d3bae 100755 --- a/codegen/docextract_to_xml.py +++ b/codegen/docextract_to_xml.py @@ -7,21 +7,26 @@ # # ./docextract_to_xml.py -s /gnome/head/cvs/gtk+/gtk/ -s /gnome/head/cvs/gtk+/docs/reference/gtk/tmpl/ > gtk_docs.xml import getopt +import re import string import sys import docextract def escape_text(unescaped_text): - escaped_text = unescaped_text + # Escape every "&" not part of an entity reference + escaped_text = re.sub(r'&(?![A-Za-z]+;)', '&', unescaped_text) + + # These weird entities turn up in the output... + escaped_text = string.replace(escaped_text, '—', '—') + escaped_text = string.replace(escaped_text, '*', '*') + escaped_text = string.replace(escaped_text, '%', '%') + escaped_text = string.replace(escaped_text, '@', '@') + + # Escape for both tag contents and attribute values escaped_text = string.replace(escaped_text, '<', '<') escaped_text = string.replace(escaped_text, '>', '>') - escaped_text = string.replace(escaped_text, '&', '&') - escaped_text = string.replace(escaped_text, '\'', ''') - escaped_text = string.replace(escaped_text, '\"', '"') - - #Apparently this is an undefined symbol: - escaped_text = string.replace(escaped_text, '—', ' mdash ') + escaped_text = string.replace(escaped_text, '"', '"') return escaped_text |
