diff options
author | Stuart Rackham <srackham@methods.co.nz> | 2013-01-18 12:47:49 +1300 |
---|---|---|
committer | Stuart Rackham <srackham@methods.co.nz> | 2013-01-18 12:47:49 +1300 |
commit | a409c51212c37909aeda2deb5b097bc5b1a2cbd3 (patch) | |
tree | 57d34035450c39f6ec4a49e7fb46436692b1738e | |
parent | 5606215e9faa2069195026debcf2fa53634b97cd (diff) | |
download | asciidoc-a409c51212c37909aeda2deb5b097bc5b1a2cbd3.tar.gz |
a2x: warning that the --destination-dir option is only applicable for
HTML based output formats (reversing previous commit). See
https://groups.google.com/group/asciidoc/browse_thread/thread/95eefd39149bd675
-rwxr-xr-x | a2x.py | 19 | ||||
-rw-r--r-- | doc/a2x.1.txt | 4 |
2 files changed, 12 insertions, 11 deletions
@@ -376,8 +376,7 @@ class A2X(AttrDict): self.to_backend() else: self.__getattribute__('to_'+self.format)() - if not (self.keep_artifacts or self.format == 'docbook' or - self.dst_path('.xml') == self.asciidoc_file): + if not (self.keep_artifacts or self.format == 'docbook' or self.skip_asciidoc): shell_rm(self.dst_path('.xml')) def load_conf(self): @@ -444,13 +443,19 @@ class A2X(AttrDict): ''' if not os.path.isfile(self.asciidoc_file): die('missing SOURCE_FILE: %s' % self.asciidoc_file) - self.asciidoc_file = os.path.realpath(self.asciidoc_file) + self.asciidoc_file = os.path.abspath(self.asciidoc_file) + if os.path.splitext(self.asciidoc_file)[1].lower() == '.xml': + self.skip_asciidoc = True + else: + self.skip_asciidoc = False if not self.destination_dir: self.destination_dir = os.path.dirname(self.asciidoc_file) else: if not os.path.isdir(self.destination_dir): die('missing --destination-dir: %s' % self.destination_dir) self.destination_dir = os.path.abspath(self.destination_dir) + if not self.format in ('chunked','epub','htmlhelp','xhtml'): + warning('--destination-dir option is only applicable to HTML based outputs') self.resource_dirs = [] self.resource_files = [] if self.resource_manifest: @@ -530,17 +535,13 @@ class A2X(AttrDict): self.xsltproc_opts += ' --stringparam ' + o if self.fop_opts: self.fop = True - if os.path.splitext(self.asciidoc_file)[1].lower() == '.xml': - self.skip_asciidoc = True - else: - self.skip_asciidoc = False def dst_path(self, ext): ''' 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.realpath(os.path.join(self.destination_dir, self.basename(ext))) + return os.path.join(self.destination_dir, self.basename(ext)) def basename(self, ext): ''' @@ -639,8 +640,6 @@ 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 diff --git a/doc/a2x.1.txt b/doc/a2x.1.txt index 3b8d874..2ca7bc8 100644 --- a/doc/a2x.1.txt +++ b/doc/a2x.1.txt @@ -38,7 +38,9 @@ OPTIONS Load configuration file. See <<X2,CONF FILES section>>. *-D, --destination-dir*='DESTINATION_DIR':: - Output directory. Defaults to 'SOURCE_FILE' directory. + Output directory. Defaults to 'SOURCE_FILE' directory. This option + is only applicable to HTML based output formats ('chunked', 'epub', + 'htmlhelp', 'xhtml'). *-d, --doctype*='DOCTYPE':: DocBook document type: 'article', 'manpage' or 'book'. Default |