|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21571/root/usr/share/xml2po/ |
Upload File : |
# Copyright (c) 2006 Danilo Segan <danilo@kvota.net>.
import libxml2
from docbook import docbookXmlMode
class ubuntuXmlMode (docbookXmlMode):
"""Special-casing Ubuntu DocBook website documentation."""
def postProcessXmlTranslation(self, doc, language, translators):
"""Sets a language and translators in "doc" tree."""
# Call ancestor method
docbookXmlMode.postProcessXmlTranslation(self, doc, language, translators)
try:
child = doc.docEntity('language')
newent = doc.addDocEntity('my_internal_hacky_language_entity_decl', libxml2.XML_INTERNAL_GENERAL_ENTITY, None, None, language)
newent.setName('language')
child.replaceNode(newent)
except:
newent = doc.addDocEntity('language', libxml2.XML_INTERNAL_GENERAL_ENTITY, None, None, language)