summaryrefslogtreecommitdiff
path: root/xml2po
diff options
context:
space:
mode:
authorDanilo Šegan <danilo@src.gnome.org>2006-03-31 20:07:17 +0000
committerDanilo Šegan <danilo@src.gnome.org>2006-03-31 20:07:17 +0000
commit0cea51c4199783c4221f43e3cc537638579e664f (patch)
treebaf9c4e700e61628d7dd68b5071d19c5524f4f92 /xml2po
parentcbf62f0301aff684755efbf5818f573dc9219dd1 (diff)
downloadgnome-doc-utils-0cea51c4199783c4221f43e3cc537638579e664f.tar.gz
Fix keep-entities option handling when merging.
Diffstat (limited to 'xml2po')
-rw-r--r--xml2po/ChangeLog8
-rw-r--r--xml2po/TODO7
-rw-r--r--xml2po/tests/ChangeLog11
-rw-r--r--xml2po/tests/keepents.po20
-rw-r--r--xml2po/tests/keepents.pot20
-rw-r--r--xml2po/tests/keepents.xml7
-rw-r--r--xml2po/tests/keepents.xml.out7
-rwxr-xr-xxml2po/tests/test.py2
-rwxr-xr-xxml2po/xml2po.py8
9 files changed, 81 insertions, 9 deletions
diff --git a/xml2po/ChangeLog b/xml2po/ChangeLog
index 8242802..3a24a71 100644
--- a/xml2po/ChangeLog
+++ b/xml2po/ChangeLog
@@ -1,5 +1,13 @@
2006-03-31 Danilo Šegan <danilo@gnome.org>
+ Fixes bug #336765.
+
+ * xml2po.py (replaceNodeContentsWithText): integrate DTD when
+ keeping entities.
+ * TODO: Document this fix.
+
+2006-03-31 Danilo Šegan <danilo@gnome.org>
+
Fixes bug #172784.
* xml2po.py (isFinalNode): ignore blank nodes.
diff --git a/xml2po/TODO b/xml2po/TODO
index a2a2f4e..d27bbf9 100644
--- a/xml2po/TODO
+++ b/xml2po/TODO
@@ -36,13 +36,12 @@ TODO:
dramatically down; some of the things should be transferred to
libxml2 (like using node.isText()).
-BUGS:
-
- o Merging with "-k" (keep-entities) option doesn't work correctly
-
DONE:
+ o [BUG FIXED with at least libxml2 2.6.21]
+ Merging with "-k" (keep-entities) option doesn't work correctly
+
o add "-a" option to automatically detect final tags (should be
simple, use something like worthOutputting in isFinalTag)
diff --git a/xml2po/tests/ChangeLog b/xml2po/tests/ChangeLog
index d21b85d..ccb2011 100644
--- a/xml2po/tests/ChangeLog
+++ b/xml2po/tests/ChangeLog
@@ -1,7 +1,14 @@
2006-03-31 Danilo Šegan <danilo@gnome.org>
- * footnotes.xml, footnotes.xml.out, footnotes.pot, footnotes.po:
- * test.py (SIMPLETESTS):
+ * keepents.xml, keepents.xml.out, keepents.pot, keepents.po,
+ test.py:
+
+ Added 'keepents.xml' test case.
+
+2006-03-31 Danilo Šegan <danilo@gnome.org>
+
+ * footnotes.xml, footnotes.xml.out, footnotes.pot, footnotes.po,
+ test.py:
Added 'footnotes.xml' test case.
diff --git a/xml2po/tests/keepents.po b/xml2po/tests/keepents.po
new file mode 100644
index 0000000..d993db1
--- /dev/null
+++ b/xml2po/tests/keepents.po
@@ -0,0 +1,20 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: keep entities test\n"
+"POT-Creation-Date: 2006-03-31 21:47+0200\n"
+"PO-Revision-Date: 2006-03-31 21:48+0200\n"
+"Last-Translator: Данило\n"
+"Language-Team: српски\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: keepents.xml:6(title)
+msgid "&language; is best language!"
+msgstr "&language; је најбољши језик!"
+
+#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
+#: keepents.xml:0(None)
+msgid "translator-credits"
+msgstr ""
+
diff --git a/xml2po/tests/keepents.pot b/xml2po/tests/keepents.pot
new file mode 100644
index 0000000..f36bdad
--- /dev/null
+++ b/xml2po/tests/keepents.pot
@@ -0,0 +1,20 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: keepents.xml:6(title)
+msgid "&language; is best language!"
+msgstr ""
+
+#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
+#: keepents.xml:0(None)
+msgid "translator-credits"
+msgstr ""
+
diff --git a/xml2po/tests/keepents.xml b/xml2po/tests/keepents.xml
new file mode 100644
index 0000000..f5886ac
--- /dev/null
+++ b/xml2po/tests/keepents.xml
@@ -0,0 +1,7 @@
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+"http://www.docbook.org/xml/4.4/docbookx.dtd" [
+<!ENTITY % language "Serbian">
+]>
+<article>
+<title>&language; is best language!</title>
+</article>
diff --git a/xml2po/tests/keepents.xml.out b/xml2po/tests/keepents.xml.out
new file mode 100644
index 0000000..6bc4604
--- /dev/null
+++ b/xml2po/tests/keepents.xml.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.docbook.org/xml/4.4/docbookx.dtd" [
+<!ENTITY % language "Serbian">
+]>
+<article lang="keepents">
+<title>&language; је најбољши језик!</title>
+</article>
diff --git a/xml2po/tests/test.py b/xml2po/tests/test.py
index 082faf1..512eed9 100755
--- a/xml2po/tests/test.py
+++ b/xml2po/tests/test.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import sys, os
-SIMPLETESTS = ['deep-finals.xml', 'deep-nonfinals.xml', 'attribute-entities.xml', 'docbook.xml', 'utf8-original.xml', 'footnotes.xml' ]
+SIMPLETESTS = ['deep-finals.xml', 'deep-nonfinals.xml', 'attribute-entities.xml', 'docbook.xml', 'utf8-original.xml', 'footnotes.xml', 'keepents.xml' ]
OTHERTESTS = [ ('relnotes', 'test.sh') ]
diff --git a/xml2po/xml2po.py b/xml2po/xml2po.py
index d512744..9461f21 100755
--- a/xml2po/xml2po.py
+++ b/xml2po/xml2po.py
@@ -305,6 +305,7 @@ def getCommentForNode(node):
def replaceNodeContentsWithText(node,text):
"""Replaces all subnodes of a node with contents of text treated as XML."""
+
if node.children:
starttag = node.name #startTagForNode(node)
endtag = endTagForNode(node)
@@ -312,8 +313,11 @@ def replaceNodeContentsWithText(node,text):
# Lets add document DTD so entities are resolved
dtd = doc.intSubset()
tmp = ''
- if expand_entities: # FIXME: we get a "Segmentation fault" in libxml2.parseMemory() when we include DTD otherwise
- tmp = dtd.serialize('utf-8')
+ # NOTE: We used to get a "Segmentation fault" in libxml2.parseMemory() when we included DTD
+ # when not expand_entities!
+ # libxml 2.6.21 is known to work, need to see what's the minimal version.
+ #if expand_entities:
+ tmp = dtd.serialize('utf-8')
tmp = tmp + '<%s>%s</%s>' % (starttag, text, endtag)
except:
tmp = '<%s>%s</%s>' % (starttag, text, endtag)