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

Unified Diff: grit/node/structure.py

Issue 10386189: Add chrome_html gatherer, which inlines html and automatically generates image set… (Closed) Base URL: http://git.chromium.org/external/grit-i18n.git@master
Patch Set: Add chrome_html_unittest to test_suite_all. Created 8 years, 7 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
« no previous file with comments | « grit/gather/interface.py ('k') | grit/test_suite_all.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/node/structure.py
diff --git a/grit/node/structure.py b/grit/node/structure.py
index 5b30037d1d2ec1860fb7137f68a2fb32b5449613..faf13250ddd90a40f2715ae2269d303a8cca4f79 100644
--- a/grit/node/structure.py
+++ b/grit/node/structure.py
@@ -16,6 +16,7 @@ from grit import exception
from grit import util
import grit.gather.admin_template
+import grit.gather.chrome_html
import grit.gather.igoogle_strings
import grit.gather.muppet_strings
import grit.gather.policy_json
@@ -30,6 +31,7 @@ import grit.format.rc_header
_GATHERERS = {
'accelerators' : grit.gather.rc.Accelerators,
'admin_template' : grit.gather.admin_template.AdmGatherer,
+ 'chrome_html' : grit.gather.chrome_html.ChromeHtml,
'dialog' : grit.gather.rc.Dialog,
'igoogle' : grit.gather.igoogle_strings.IgoogleStrings,
'menu' : grit.gather.rc.Menu,
@@ -47,6 +49,7 @@ _GATHERERS = {
_RC_FORMATTERS = {
'accelerators' : grit.format.rc.RcSection(),
'admin_template' : grit.format.rc.RcInclude('ADM'),
+ 'chrome_html' : grit.format.rc.RcInclude('HTML'),
'dialog' : grit.format.rc.RcSection(),
'igoogle' : grit.format.rc.RcInclude('XML'),
'menu' : grit.format.rc.RcSection(),
@@ -118,8 +121,22 @@ class StructureNode(base.Node):
else:
return []
+ def GetDataPackPair(self, lang, encoding):
+ """Returns a (id, string|None) pair that represents the resource id and raw
+ bytes of the data (or None if no resource is generated). This is used to
+ generate the data pack data file.
+ """
+ from grit.format import rc_header
+ id_map = rc_header.Item.tids_
+ id = id_map[self.GetTextualIds()[0]]
+ data = ''
+ if self.gatherer:
+ data = self.gatherer.GetData(lang, encoding)
+ return id, data
+
def GetTextualIds(self):
- if self.gatherer and self.attrs['type'] not in ['tr_html', 'admin_template', 'txt']:
+ if self.gatherer and self.attrs['type'] not in [
+ 'chrome_html', 'tr_html', 'admin_template', 'txt']:
return self.gatherer.GetTextualIds()
else:
return [self.attrs['name']]
@@ -146,6 +163,8 @@ class StructureNode(base.Node):
self.attrs['name'],
self.attrs['encoding'])
self.gatherer.SetUberClique(self.UberClique())
+ if hasattr(self.GetRoot(), 'defines'):
+ self.gatherer.SetDefines(self.GetRoot().defines)
self.gatherer.SetAttributes(self.attrs)
self.gatherer.Parse()
« no previous file with comments | « grit/gather/interface.py ('k') | grit/test_suite_all.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698