Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: grit/format/policy_templates/writers/xml_formatted_writer.py

Issue 227073006: Added a policy writer for iOS Plists. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: grit/format/policy_templates/writers/xml_formatted_writer.py
diff --git a/grit/format/policy_templates/writers/xml_formatted_writer.py b/grit/format/policy_templates/writers/xml_formatted_writer.py
index b28d8b672db91cbf9040541cf6b3c6e8bf48ed5d..dad3717bfdc1140b55f2d8ad56dec1e8895a4210 100644
--- a/grit/format/policy_templates/writers/xml_formatted_writer.py
+++ b/grit/format/policy_templates/writers/xml_formatted_writer.py
@@ -53,7 +53,11 @@ class XMLFormattedWriter(template_writer.TemplateWriter):
attribute.value = value
parent.setAttributeNode(attribute)
- def ToPrettyXml(self, doc):
+ def AddComment(self, parent, comment):
+ '''Adds a comment node.'''
+ parent.appendChild(parent.ownerDocument.createComment(comment))
+
+ def ToPrettyXml(self, doc, **kwargs):
# return doc.toprettyxml(indent=' ')
# The above pretty-printer does not print the doctype and adds spaces
# around texts, e.g.:
@@ -66,7 +70,7 @@ class XMLFormattedWriter(template_writer.TemplateWriter):
# So we use the poor man's pretty printer here. It assumes that there are
# no mixed-content nodes.
# Get all the XML content in a one-line string.
- xml = doc.toxml()
+ xml = doc.toxml(**kwargs)
# Determine where the line breaks will be. (They will only be between tags.)
lines = xml[1:len(xml) - 1].split('><')
indent = ''

Powered by Google App Engine
This is Rietveld 408576698