removing boilerplate; go from asciidoc to docbook45

This commit is contained in:
Martin A. Brown 2016-03-08 09:16:33 -08:00
parent 62c9cef32f
commit ffe327ced0
1 changed files with 13 additions and 40 deletions

View File

@ -17,57 +17,30 @@ class Asciidoc(BaseDoctype):
extensions = ['.txt'] extensions = ['.txt']
signatures = [] signatures = []
required = {'asciidoc_sgml2html': isexecutable, required = {'asciidoc_a2x': isexecutable,
'asciidoc_html2text': isexecutable,
'asciidoc_htmldoc': isexecutable,
'asciidoc_a2x': isexecutable,
} }
def make_name_pdf(self): def make_docbook45(self):
s = '''"{config.asciidoc_a2x}" \\ s = '''"{config.asciidoc_asciidoc}" \\
--verbose \\ --backend docbook45 \\
--format pdf \\ --out-file {output.validsource} \\
--destination-dir . \\
"{source.filename}"''' "{source.filename}"'''
return self.shellscript(s) return self.shellscript(s)
def make_name_txt(self): @depends(make_docbook45)
s = 'cp --verbose --target-directory . -- "{source.filename}"' def docbook_subbuild(self):
return self.shellscript(s) config = self.config
source = self.output.validsource
return True
def make_name_htmls(self):
s = '''"{config.asciidoc_a2x}" \\
--verbose \\
--format xhtml \\
--destination-dir . \\
"{source.filename}"'''
return self.shellscript(s)
def make_chunked_html(self):
s = '''"{config.asciidoc_a2x}" \\
--verbose \\
--format chunked \\
--destination-dir . \\
"{source.filename}"'''
return self.shellscript(s)
@depends(make_chunked_html)
def move_chunked_html(self):
s = 'mv --no-clobber -v -- "{output.stem}.chunked" html'
return self.shellscript(s)
@depends(move_chunked_html)
def make_name_html(self):
s = 'ln -sv --relative -- html/index.html {output.name_indexhtml}'
return self.shellscript(s)
@classmethod @classmethod
def argparse(cls, p): def argparse(cls, p):
descrip = 'executables and data files for %s' % (cls.formatname,) descrip = 'executables and data files for %s' % (cls.formatname,)
g = p.add_argument_group(title=cls.__name__, description=descrip) g = p.add_argument_group(title=cls.__name__, description=descrip)
g.add_argument('--asciidoc-a2x', type=arg_isexecutable, g.add_argument('--asciidoc-asciidoc', type=arg_isexecutable,
default=which('a2x'), default=which('asciidoc'),
help='full path to a2x [%(default)s]') help='full path to asciidoc [%(default)s]')
# #
# -- end of file # -- end of file