diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2009-09-11 10:27:42 +1200 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2009-09-11 10:27:42 +1200 |
commit | be3ed5361b4a9d3cb4fdb8ed9576c9f54609412a (patch) | |
tree | 0e83d066ff9fd7fc8180545eecb5d8e4dce6af3d /asciidoc.py | |
parent | ae00cc90cdd88003e4a19a86e780311cf078b3f9 (diff) | |
download | asciidoc-py3-be3ed5361b4a9d3cb4fdb8ed9576c9f54609412a.tar.gz |
Reinstated 8.4.4 default lang attribute behavior. See http://groups.google.com/group/asciidoc/browse_frm/thread/d29924043e21cb6a
Diffstat (limited to 'asciidoc.py')
-rwxr-xr-x | asciidoc.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/asciidoc.py b/asciidoc.py index 9299af2..67c0960 100755 --- a/asciidoc.py +++ b/asciidoc.py @@ -1180,14 +1180,19 @@ class Document: Load language configuration file. """ lang = self.attributes.get('lang') - message.linenos = linenos - if lang: + if lang is None: + filename = 'lang-en.conf' # Default language file. + else: filename = 'lang-' + lang + '.conf' - if not config.load_from_dirs(filename): - message.warning('missing language conf file: %s' % filename) + message.linenos = linenos + if config.load_from_dirs(filename): self.attributes['lang'] = lang # Reinstate new lang attribute. else: - message.error('language attribute (lang) is not defined') + if lang is None: + # The default language file must exist. + message.error('missing conf file: %s' % filename, halt=True) + else: + message.warning('missing language conf file: %s' % filename) message.linenos = None # Restore default line number behavior. def set_deprecated_attribute(self,old,new): """ @@ -1219,7 +1224,7 @@ class Document: if AttributeEntry.isnext(): finished = False AttributeEntry.translate() - if AttributeEntry.name == 'lang': + if AttributeEntry.name == 'lang' and 'lang' not in config.cmd_attrs: self.load_lang(linenos=True) if attr_count > 0: message.error('lang attribute should be first entry') |