pygobject r998 - in trunk: . codegen
- From: daniel svn gnome org
- To: svn-commits-list gnome org
- Subject: pygobject r998 - in trunk: . codegen
- Date: Tue, 27 Jan 2009 16:21:13 +0000 (UTC)
Author: daniel
Date: Tue Jan 27 16:21:13 2009
New Revision: 998
URL: http://svn.gnome.org/viewvc/pygobject?rev=998&view=rev
Log:
* 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.
Modified:
trunk/ChangeLog
trunk/codegen/docextract_to_xml.py
Modified: trunk/codegen/docextract_to_xml.py
==============================================================================
--- trunk/codegen/docextract_to_xml.py (original)
+++ trunk/codegen/docextract_to_xml.py Tue Jan 27 16:21:13 2009
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]