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

Side by Side Diff: trunk/src/third_party/markdown/extensions/__init__.py

Issue 132753002: Revert 243980 "Docserver: Support markdown for HTML content." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 """
2 Extensions
3 -----------------------------------------------------------------------------
4 """
5
6 from __future__ import unicode_literals
7
8 class Extension(object):
9 """ Base class for extensions to subclass. """
10 def __init__(self, configs = {}):
11 """Create an instance of an Extention.
12
13 Keyword arguments:
14
15 * configs: A dict of configuration setting used by an Extension.
16 """
17 self.config = configs
18
19 def getConfig(self, key, default=''):
20 """ Return a setting for the given key or an empty string. """
21 if key in self.config:
22 return self.config[key][0]
23 else:
24 return default
25
26 def getConfigs(self):
27 """ Return all configs settings as a dict. """
28 return dict([(key, self.getConfig(key)) for key in self.config.keys()])
29
30 def getConfigInfo(self):
31 """ Return all config descriptions as a list of tuples. """
32 return [(key, self.config[key][1]) for key in self.config.keys()]
33
34 def setConfig(self, key, value):
35 """ Set a config setting for `key` with the given `value`. """
36 self.config[key][0] = value
37
38 def extendMarkdown(self, md, md_globals):
39 """
40 Add the various proccesors and patterns to the Markdown Instance.
41
42 This method must be overriden by every extension.
43
44 Keyword arguments:
45
46 * md: The Markdown instance.
47
48 * md_globals: Global variables in the markdown module namespace.
49
50 """
51 raise NotImplementedError('Extension "%s.%s" must define an "extendMarkd own"' \
52 'method.' % (self.__class__.__module__, self.__class__.__name__))
53
OLDNEW
« no previous file with comments | « trunk/src/third_party/markdown/blockprocessors.py ('k') | trunk/src/third_party/markdown/extensions/abbr.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698