diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2012-02-26 17:20:59 +1300 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2012-02-26 17:20:59 +1300 |
commit | 7d09e89a5b7546a04f32aa85741d8d7ca1c36143 (patch) | |
tree | 6bcdd87d1a83f780090e5d34bfaae463e1781386 | |
parent | c3c975e9e15628dfadc07b0d4de94d6c71be8fea (diff) | |
download | asciidoc-7d09e89a5b7546a04f32aa85741d8d7ca1c36143.tar.gz |
Added `backend-confdir` intrinsic attribute. In the case of a backend
plugin this refers to the plugin's directory.
-rwxr-xr-x | asciidoc.py | 17 | ||||
-rw-r--r-- | doc/asciidoc.txt | 3 |
2 files changed, 12 insertions, 8 deletions
diff --git a/asciidoc.py b/asciidoc.py index 602119a..b6c2ba0 100755 --- a/asciidoc.py +++ b/asciidoc.py @@ -4712,25 +4712,26 @@ class Config: """ Load the backend configuration files from dirs list. If dirs not specified try all the well known locations. - Return True if a backend conf file was found. + If a <backend>.conf file was found return it's full path name, + if not found return None. """ + result = None if dirs is None: dirs = self.get_load_dirs() - loaded = False conf = document.backend + '.conf' conf2 = document.backend + '-' + document.doctype + '.conf' # First search for filter backends. for d in [os.path.join(d, 'backends', document.backend) for d in dirs]: if self.load_file(conf,d): - loaded = True + result = os.path.join(d, conf) self.load_file(conf2,d) - if not loaded: + if not result: # Search in the normal locations. for d in dirs: if self.load_file(conf,d): - loaded = True + result = os.path.join(d, conf) self.load_file(conf2,d) - return loaded + return result def load_filters(self, dirs=None): """ @@ -5918,8 +5919,10 @@ def asciidoc(backend, doctype, confiles, infile, outfile, options): # Load backend configuration files. if '-e' not in options: f = document.backend + '.conf' - if not config.load_backend(): + conffile = config.load_backend() + if not conffile: raise EAsciiDoc,'missing backend conf file: %s' % f + document.attributes['backend-confdir'] = os.path.dirname(conffile) # backend is now known. document.attributes['backend-'+document.backend] = '' document.attributes[document.backend+'-'+document.doctype] = '' diff --git a/doc/asciidoc.txt b/doc/asciidoc.txt index decc979..d64e5ff 100644 --- a/doc/asciidoc.txt +++ b/doc/asciidoc.txt @@ -210,7 +210,7 @@ backend <<X101,plugins>>. - A backend plugin is used just like the built-in backends. - Backend plugins <<X27,take precedence>> over built-in backends with the same name. -- You can use the `{asciidoc-confdir}` <<X60, intrinsic attribute>> to +- You can use the `{backend-confdir}` <<X60, intrinsic attribute>> to refer to the built-in backend configuration file location from backend plugin configuration files. - By default backends plugins are installed in @@ -4555,6 +4555,7 @@ predefined intrinsic attributes: {backend-<backend>} empty string '' {<backend>-<doctype>} empty string '' {backend} document backend specified by `-b` option + {backend-confdir} the directory containing the <backend>.conf file {backslash} backslash character {basebackend-<base>} empty string '' {basebackend} html or docbook |