diff options
author | Waylan Limberg <waylan@gmail.com> | 2011-04-07 03:27:06 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2011-04-07 03:27:06 -0400 |
commit | 303048f9d0da1ba5f917a0abf1da4a090d7a3a49 (patch) | |
tree | 0ce0b19f0e47be89d0859dc0ba3fd81cf3afae9f /markdown/extensions | |
parent | 89425349e0f8162d7ec59d995a26a7d798533e90 (diff) | |
download | markdown-303048f9d0da1ba5f917a0abf1da4a090d7a3a49.tar.gz markdown-303048f9d0da1ba5f917a0abf1da4a090d7a3a49.tar.bz2 markdown-303048f9d0da1ba5f917a0abf1da4a090d7a3a49.zip |
Minor improvement to Extension settings API. Extension.getConfig now accepts a 'default' keyword and added Extension.getConfigs which returns a list of tuples of all settings without the descriptions.
Diffstat (limited to 'markdown/extensions')
-rw-r--r-- | markdown/extensions/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/markdown/extensions/__init__.py b/markdown/extensions/__init__.py index 4c1dcba..3f36bb3 100644 --- a/markdown/extensions/__init__.py +++ b/markdown/extensions/__init__.py @@ -14,15 +14,19 @@ class Extension: """ self.config = configs - def getConfig(self, key): + def getConfig(self, key, default=''): """ Return a setting for the given key or an empty string. """ if key in self.config: return self.config[key][0] else: - return "" + return default + + def getConfigs(self): + """ Return all configs settings as a list of tuples. """ + return [(key, self.getConfig(key)) for key in self.config.keys()] def getConfigInfo(self): - """ Return all config settings as a list of tuples. """ + """ Return all config descriptions as a list of tuples. """ return [(key, self.config[key][1]) for key in self.config.keys()] def setConfig(self, key, value): |