diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2011-01-24 10:57:43 +1300 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2011-01-24 10:57:43 +1300 |
commit | 94ce43849fba354dce5b806cb90f1c0bc9f01359 (patch) | |
tree | b09ef76050c6aa53acb1c8b7cfb70b3fb71f7a57 | |
parent | bdf6885fe82d65fa17821a55ab62ac79d9d98632 (diff) | |
download | asciidoc-94ce43849fba354dce5b806cb90f1c0bc9f01359.tar.gz |
Implemented conf-files attribute to allow configuration files to be specified
in the source document. Suggested by Lex Trotman, see: http://groups.google.com/group/asciidoc/browse_thread/thread/b11066a828ab45b9
-rwxr-xr-x | asciidoc.py | 9 | ||||
-rw-r--r-- | doc/asciidoc.txt | 17 |
2 files changed, 17 insertions, 9 deletions
diff --git a/asciidoc.py b/asciidoc.py index 350d676..16ddd7f 100755 --- a/asciidoc.py +++ b/asciidoc.py @@ -5344,9 +5344,12 @@ def asciidoc(backend, doctype, confiles, infile, outfile, options): The AsciiDoc document is read from file object src the translated DocBook file written to file object dst.""" def load_conffiles(include=[], exclude=[]): - # Load conf files specified on the command-line. - if confiles: - for f in confiles: + # Load conf files specified on the command-line and by the conf-files attribute. + files = document.attributes.get('conf-files','') + files = [f.strip() for f in files.split('|') if f.strip()] + files += confiles + if files: + for f in files: if os.path.isfile(f): config.load_file(f, include=include, exclude=exclude) else: diff --git a/doc/asciidoc.txt b/doc/asciidoc.txt index f88fd0b..f63d00d 100644 --- a/doc/asciidoc.txt +++ b/doc/asciidoc.txt @@ -3602,8 +3602,8 @@ replaced by text from the source element. Use the `{brvbar}` attribute reference if you need a literal | character in the template. [[X27]] -Configuration File Names and Locations -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Configuration file names, precedence and locations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Configuration files have a `.conf` file name extension; they are loaded from the following locations: @@ -3617,10 +3617,15 @@ loaded from the following locations: multiple local copies of AsciiDoc to coexist on the same host PC. 3. The user's `$HOME/.asciidoc` directory (if it exists). 4. The directory containing the AsciiDoc source file. -5. Explicit configuration files specified with the asciidoc(1) - `--conf-file`) command-line option. The `--conf-file` option can - be specified multiple times, in which case configuration files will - be processed in the same order they appear on the command-line. +5. Explicit configuration files specified using: + - The `conf-files` attribute (one or more file names separated by a + `|` character). These files are loaded in the order they are + specified and prior to files specified using the `--conf-file` + command-line option. + - The asciidoc(1) `--conf-file`) command-line option. The + `--conf-file` option can be specified multiple times, in which + case configuration files will be processed in the same order they + appear on the command-line. Configuration files from the above locations are loaded in the following order: |