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

Unified Diff: grit/gather/admin_template.py

Issue 1442863002: Remove contents of grit's SVN repository. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 1 month 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/__init__.py ('k') | grit/gather/admin_template_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/gather/admin_template.py
===================================================================
--- grit/gather/admin_template.py (revision 202)
+++ grit/gather/admin_template.py (working copy)
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-'''Gatherer for administrative template files.
-'''
-
-import re
-
-from grit.gather import regexp
-from grit import exception
-from grit import lazy_re
-
-
-class MalformedAdminTemplateException(exception.Base):
- '''This file doesn't look like a .adm file to me.'''
- pass
-
-
-class AdmGatherer(regexp.RegexpGatherer):
- '''Gatherer for the translateable portions of an admin template.
-
- This gatherer currently makes the following assumptions:
- - there is only one [strings] section and it is always the last section
- of the file
- - translateable strings do not need to be escaped.
- '''
-
- # Finds the strings section as the group named 'strings'
- _STRINGS_SECTION = lazy_re.compile(
- '(?P<first_part>.+^\[strings\])(?P<strings>.+)\Z',
- re.MULTILINE | re.DOTALL)
-
- # Finds the translateable sections from within the [strings] section.
- _TRANSLATEABLES = lazy_re.compile(
- '^\s*[A-Za-z0-9_]+\s*=\s*"(?P<text>.+)"\s*$',
- re.MULTILINE)
-
- def Escape(self, text):
- return text.replace('\n', '\\n')
-
- def UnEscape(self, text):
- return text.replace('\\n', '\n')
-
- def Parse(self):
- if self.have_parsed_:
- return
- self.have_parsed_ = True
-
- self.text_ = self._LoadInputFile().strip()
- m = self._STRINGS_SECTION.match(self.text_)
- if not m:
- raise MalformedAdminTemplateException()
- # Add the first part, which is all nontranslateable, to the skeleton
- self._AddNontranslateableChunk(m.group('first_part'))
- # Then parse the rest using the _TRANSLATEABLES regexp.
- self._RegExpParse(self._TRANSLATEABLES, m.group('strings'))
-
- def GetTextualIds(self):
- return [self.extkey]
« no previous file with comments | « grit/gather/__init__.py ('k') | grit/gather/admin_template_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698