summaryrefslogtreecommitdiff
path: root/a2x.py
diff options
context:
space:
mode:
authorStuart Rackham <srackham@methods.co.nz>2011-03-22 11:46:56 +1300
committerStuart Rackham <srackham@methods.co.nz>2011-03-22 11:46:56 +1300
commitee76b956e90a1a24bda09561d74fe20931089c57 (patch)
treeb1b167e46678e2f6d28faade55a6b22309230b7e /a2x.py
parent1cc90931f32a4c8af26295c9670f73e122dc72f0 (diff)
downloadasciidoc-ee76b956e90a1a24bda09561d74fe20931089c57.tar.gz
- a2x: allow environment variables and tilda home directories in resouce
manifest files. - a2x: don't process non-existent resource directories.
Diffstat (limited to 'a2x.py')
-rwxr-xr-xa2x.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/a2x.py b/a2x.py
index 7cb3235..14773ee 100755
--- a/a2x.py
+++ b/a2x.py
@@ -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: