diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2011-03-22 11:46:56 +1300 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2011-03-22 11:46:56 +1300 |
commit | ee76b956e90a1a24bda09561d74fe20931089c57 (patch) | |
tree | b1b167e46678e2f6d28faade55a6b22309230b7e | |
parent | 1cc90931f32a4c8af26295c9670f73e122dc72f0 (diff) | |
download | asciidoc-ee76b956e90a1a24bda09561d74fe20931089c57.tar.gz |
- a2x: allow environment variables and tilda home directories in resouce
manifest files.
- a2x: don't process non-existent resource directories.
-rwxr-xr-x | a2x.py | 8 | ||||
-rw-r--r-- | doc/a2x.1.txt | 7 |
2 files changed, 11 insertions, 4 deletions
@@ -420,6 +420,8 @@ class A2X(AttrDict): for r in open(self.resource_manifest): self.resources.append(r.strip()) for r in self.resources: + r = os.path.expanduser(r) + r = os.path.expandvars(r) if r.endswith(('/','\\')): if os.path.isdir(r): self.resource_dirs.append(r) @@ -432,7 +434,11 @@ class A2X(AttrDict): # Lastly search among images and stylesheets distributed with asciidoc. for p in (os.path.dirname(self.asciidoc), CONF_DIR): for d in ('images','stylesheets'): - self.resource_dirs.append(os.path.join(p,d)) + d = os.path.join(p,d) + if os.path.isdir(d): + self.resource_dirs.append(d) + verbose('resource files: %s' % self.resource_files) + verbose('resource directories: %s' % self.resource_dirs) if not self.doctype and self.format == 'manpage': self.doctype = 'manpage' if self.doctype: diff --git a/doc/a2x.1.txt b/doc/a2x.1.txt index 15c6759..70a24e7 100644 --- a/doc/a2x.1.txt +++ b/doc/a2x.1.txt @@ -84,6 +84,7 @@ OPTIONS *-m, --resource-manifest*='FILE':: 'FILE' contains a list resources (one per line). Manifest 'FILE' entries are formatted just like *--resource* option arguments. + Environment variables and tilda home directories are allowed. *--stylesheet*='STYLESHEET':: The file name of the CSS stylesheet file that is used to style HTML @@ -191,8 +192,8 @@ There are two distinct mechanisms for specifying additional resources: . A resouce file which will be copied to the output destination directory. -Resources are defined by the *--resource* option value and can be -either of the following two formats: +Resources are specified by *--resource* option values and can be one +of the following two formats: <resource_dir> <resource_file>[=<destination_file>] @@ -226,7 +227,7 @@ Resource specifier examples: ../images/ doc/README.txt=README.txt - /home/srackham/images/tiger.png=images/tiger.png + ~/images/tiger.png=images/tiger.png EXAMPLES |