summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Rackham <srackham@methods.co.nz>2013-01-15 11:08:43 +1300
committerStuart Rackham <srackham@methods.co.nz>2013-01-15 11:08:43 +1300
commit5606215e9faa2069195026debcf2fa53634b97cd (patch)
tree4e4cf95c6b351d1fe63551d79ad4cef70b00f1cb
parent183202177b51e44f9d2664c46fb2f2a3a3fd79a2 (diff)
downloadasciidoc-5606215e9faa2069195026debcf2fa53634b97cd.tar.gz
a2x: the --destination-dir option now works correctly when specifying
a DocBook XML source file. See https://groups.google.com/group/asciidoc/browse_thread/thread/95eefd39149bd675
-rwxr-xr-xa2x.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/a2x.py b/a2x.py
index 1b192a2..91e7a92 100755
--- a/a2x.py
+++ b/a2x.py
@@ -376,7 +376,8 @@ class A2X(AttrDict):
self.to_backend()
else:
self.__getattribute__('to_'+self.format)()
- if not (self.keep_artifacts or self.format == 'docbook' or self.skip_asciidoc):
+ if not (self.keep_artifacts or self.format == 'docbook' or
+ self.dst_path('.xml') == self.asciidoc_file):
shell_rm(self.dst_path('.xml'))
def load_conf(self):
@@ -443,7 +444,7 @@ class A2X(AttrDict):
'''
if not os.path.isfile(self.asciidoc_file):
die('missing SOURCE_FILE: %s' % self.asciidoc_file)
- self.asciidoc_file = os.path.abspath(self.asciidoc_file)
+ self.asciidoc_file = os.path.realpath(self.asciidoc_file)
if not self.destination_dir:
self.destination_dir = os.path.dirname(self.asciidoc_file)
else:
@@ -539,7 +540,7 @@ class A2X(AttrDict):
Return name of file or directory in the destination directory with
the same name as the asciidoc source file but with extension ext.
'''
- return os.path.join(self.destination_dir, self.basename(ext))
+ return os.path.realpath(os.path.join(self.destination_dir, self.basename(ext)))
def basename(self, ext):
'''
@@ -638,6 +639,8 @@ class A2X(AttrDict):
'''
docbook_file = self.dst_path('.xml')
if self.skip_asciidoc:
+ if docbook_file != self.asciidoc_file:
+ shell_copy(self.asciidoc_file, docbook_file)
if not os.path.isfile(docbook_file):
die('missing docbook file: %s' % docbook_file)
return