mirror of https://github.com/tLDP/python-tldp
config_fragment becomes staticmethod in class
the config_fragment function becomes a part of each doctype class, allowing better encapsulation of most/all document type handling logic the config_fragment function becomes a staticmethod called argparse
This commit is contained in:
parent
92a9042a74
commit
7903d5f497
|
@ -28,30 +28,6 @@ def xslprint_finder():
|
||||||
return firstfoundfile(l)
|
return firstfoundfile(l)
|
||||||
|
|
||||||
|
|
||||||
def config_fragment(p):
|
|
||||||
p.add_argument('--docbook4xml-xslchunk', type=arg_isreadablefile,
|
|
||||||
default=xslchunk_finder(),
|
|
||||||
help='full path to LDP HTML chunker XSL [%(default)s]')
|
|
||||||
p.add_argument('--docbook4xml-xslsingle', type=arg_isreadablefile,
|
|
||||||
default=xslsingle_finder(),
|
|
||||||
help='full path to LDP HTML single-page XSL [%(default)s]')
|
|
||||||
p.add_argument('--docbook4xml-xslprint', type=arg_isreadablefile,
|
|
||||||
default=xslprint_finder(),
|
|
||||||
help='full path to LDP FO print XSL [%(default)s]')
|
|
||||||
p.add_argument('--docbook4xml-xsltproc', type=arg_isexecutable,
|
|
||||||
default=which('xsltproc'),
|
|
||||||
help='full path to xsltproc [%(default)s]')
|
|
||||||
p.add_argument('--docbook4xml-html2text', type=arg_isexecutable,
|
|
||||||
default=which('html2text'),
|
|
||||||
help='full path to html2text [%(default)s]')
|
|
||||||
p.add_argument('--docbook4xml-fop', type=arg_isexecutable,
|
|
||||||
default=which('fop'),
|
|
||||||
help='full path to fop [%(default)s]')
|
|
||||||
p.add_argument('--docbook4xml-dblatex', type=arg_isexecutable,
|
|
||||||
default=which('dblatex'),
|
|
||||||
help='full path to dblatex [%(default)s]')
|
|
||||||
|
|
||||||
|
|
||||||
class Docbook4XML(BaseDoctype, SignatureChecker):
|
class Docbook4XML(BaseDoctype, SignatureChecker):
|
||||||
formatname = 'DocBook XML 4.x'
|
formatname = 'DocBook XML 4.x'
|
||||||
extensions = ['.xml']
|
extensions = ['.xml']
|
||||||
|
@ -134,5 +110,31 @@ ln \\
|
||||||
def buildall(self):
|
def buildall(self):
|
||||||
return self.shellscript(self.buildscript)
|
return self.shellscript(self.buildscript)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def argparse(p):
|
||||||
|
p.add_argument('--docbook4xml-xslchunk', type=arg_isreadablefile,
|
||||||
|
default=xslchunk_finder(),
|
||||||
|
help='full path to LDP HTML chunker XSL [%(default)s]')
|
||||||
|
p.add_argument('--docbook4xml-xslsingle', type=arg_isreadablefile,
|
||||||
|
default=xslsingle_finder(),
|
||||||
|
help='full path to LDP HTML single-page XSL [%(default)s]')
|
||||||
|
p.add_argument('--docbook4xml-xslprint', type=arg_isreadablefile,
|
||||||
|
default=xslprint_finder(),
|
||||||
|
help='full path to LDP FO print XSL [%(default)s]')
|
||||||
|
p.add_argument('--docbook4xml-xsltproc', type=arg_isexecutable,
|
||||||
|
default=which('xsltproc'),
|
||||||
|
help='full path to xsltproc [%(default)s]')
|
||||||
|
p.add_argument('--docbook4xml-html2text', type=arg_isexecutable,
|
||||||
|
default=which('html2text'),
|
||||||
|
help='full path to html2text [%(default)s]')
|
||||||
|
p.add_argument('--docbook4xml-fop', type=arg_isexecutable,
|
||||||
|
default=which('fop'),
|
||||||
|
help='full path to fop [%(default)s]')
|
||||||
|
p.add_argument('--docbook4xml-dblatex', type=arg_isexecutable,
|
||||||
|
default=which('dblatex'),
|
||||||
|
help='full path to dblatex [%(default)s]')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# -- end of file
|
# -- end of file
|
||||||
|
|
|
@ -5,21 +5,6 @@ from ..utils import logger, which
|
||||||
from .common import SignatureChecker
|
from .common import SignatureChecker
|
||||||
|
|
||||||
|
|
||||||
def config_fragment(p):
|
|
||||||
p.add_argument('--docbook5xml-xsltproc', type=which,
|
|
||||||
default=which('xsltproc'),
|
|
||||||
help='full path to xsltproc [%(default)s]')
|
|
||||||
p.add_argument('--docbook5xml-html2text', type=which,
|
|
||||||
default=which('html2text'),
|
|
||||||
help='full path to html2text [%(default)s]')
|
|
||||||
p.add_argument('--docbook5xml-fop', type=which,
|
|
||||||
default=which('fop'),
|
|
||||||
help='full path to fop [%(default)s]')
|
|
||||||
p.add_argument('--docbook5xml-dblatex', type=which,
|
|
||||||
default=which('dblatex'),
|
|
||||||
help='full path to dblatex [%(default)s]')
|
|
||||||
|
|
||||||
|
|
||||||
class Docbook5XML(SignatureChecker):
|
class Docbook5XML(SignatureChecker):
|
||||||
formatname = 'DocBook XML 5.x'
|
formatname = 'DocBook XML 5.x'
|
||||||
extensions = ['.xml']
|
extensions = ['.xml']
|
||||||
|
@ -39,5 +24,21 @@ class Docbook5XML(SignatureChecker):
|
||||||
def create_htmls(self):
|
def create_htmls(self):
|
||||||
logger.info("Creating single page HTML for %s", self.source.stem)
|
logger.info("Creating single page HTML for %s", self.source.stem)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def argparse(p):
|
||||||
|
p.add_argument('--docbook5xml-xsltproc', type=which,
|
||||||
|
default=which('xsltproc'),
|
||||||
|
help='full path to xsltproc [%(default)s]')
|
||||||
|
p.add_argument('--docbook5xml-html2text', type=which,
|
||||||
|
default=which('html2text'),
|
||||||
|
help='full path to html2text [%(default)s]')
|
||||||
|
p.add_argument('--docbook5xml-fop', type=which,
|
||||||
|
default=which('fop'),
|
||||||
|
help='full path to fop [%(default)s]')
|
||||||
|
p.add_argument('--docbook5xml-dblatex', type=which,
|
||||||
|
default=which('dblatex'),
|
||||||
|
help='full path to dblatex [%(default)s]')
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# -- end of file
|
# -- end of file
|
||||||
|
|
|
@ -27,30 +27,6 @@ def ldpdsl_finder():
|
||||||
return firstfoundfile(locations)
|
return firstfoundfile(locations)
|
||||||
|
|
||||||
|
|
||||||
def config_fragment(p):
|
|
||||||
p.add_argument('--docbooksgml-docbookdsl', type=arg_isreadablefile,
|
|
||||||
default=docbookdsl_finder(),
|
|
||||||
help='full path to html/docbook.dsl [%(default)s]')
|
|
||||||
p.add_argument('--docbooksgml-ldpdsl', type=arg_isreadablefile,
|
|
||||||
default=ldpdsl_finder(),
|
|
||||||
help='full path to ldp/ldp.dsl [%(default)s]')
|
|
||||||
p.add_argument('--docbooksgml-jw', type=arg_isexecutable,
|
|
||||||
default=which('jw'),
|
|
||||||
help='full path to jw [%(default)s]')
|
|
||||||
p.add_argument('--docbooksgml-html2text', type=arg_isexecutable,
|
|
||||||
default=which('html2text'),
|
|
||||||
help='full path to html2text [%(default)s]')
|
|
||||||
p.add_argument('--docbooksgml-openjade', type=arg_isexecutable,
|
|
||||||
default=which('openjade'),
|
|
||||||
help='full path to openjade [%(default)s]')
|
|
||||||
p.add_argument('--docbooksgml-dblatex', type=arg_isexecutable,
|
|
||||||
default=which('dblatex'),
|
|
||||||
help='full path to dblatex [%(default)s]')
|
|
||||||
p.add_argument('--docbooksgml-collateindex', type=arg_isexecutable,
|
|
||||||
default=which('collateindex'),
|
|
||||||
help='full path to collateindex [%(default)s]')
|
|
||||||
|
|
||||||
|
|
||||||
class DocbookSGML(BaseDoctype, SignatureChecker):
|
class DocbookSGML(BaseDoctype, SignatureChecker):
|
||||||
formatname = 'DocBook SGML 3.x/4.x'
|
formatname = 'DocBook SGML 3.x/4.x'
|
||||||
extensions = ['.sgml']
|
extensions = ['.sgml']
|
||||||
|
@ -192,5 +168,31 @@ ln \\
|
||||||
self.indexsgml()
|
self.indexsgml()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def argparse(p):
|
||||||
|
p.add_argument('--docbooksgml-docbookdsl', type=arg_isreadablefile,
|
||||||
|
default=docbookdsl_finder(),
|
||||||
|
help='full path to html/docbook.dsl [%(default)s]')
|
||||||
|
p.add_argument('--docbooksgml-ldpdsl', type=arg_isreadablefile,
|
||||||
|
default=ldpdsl_finder(),
|
||||||
|
help='full path to ldp/ldp.dsl [%(default)s]')
|
||||||
|
p.add_argument('--docbooksgml-jw', type=arg_isexecutable,
|
||||||
|
default=which('jw'),
|
||||||
|
help='full path to jw [%(default)s]')
|
||||||
|
p.add_argument('--docbooksgml-html2text', type=arg_isexecutable,
|
||||||
|
default=which('html2text'),
|
||||||
|
help='full path to html2text [%(default)s]')
|
||||||
|
p.add_argument('--docbooksgml-openjade', type=arg_isexecutable,
|
||||||
|
default=which('openjade'),
|
||||||
|
help='full path to openjade [%(default)s]')
|
||||||
|
p.add_argument('--docbooksgml-dblatex', type=arg_isexecutable,
|
||||||
|
default=which('dblatex'),
|
||||||
|
help='full path to dblatex [%(default)s]')
|
||||||
|
p.add_argument('--docbooksgml-collateindex', type=arg_isexecutable,
|
||||||
|
default=which('collateindex'),
|
||||||
|
help='full path to collateindex [%(default)s]')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# -- end of file
|
# -- end of file
|
||||||
|
|
|
@ -10,18 +10,6 @@ from tldp.utils import arg_isexecutable, isexecutable
|
||||||
from tldp.doctypes.common import BaseDoctype, SignatureChecker
|
from tldp.doctypes.common import BaseDoctype, SignatureChecker
|
||||||
|
|
||||||
|
|
||||||
def config_fragment(p):
|
|
||||||
p.add_argument('--linuxdoc-sgml2html', type=arg_isexecutable,
|
|
||||||
default=which('sgml2html'),
|
|
||||||
help='full path to sgml2html [%(default)s]')
|
|
||||||
p.add_argument('--linuxdoc-html2text', type=arg_isexecutable,
|
|
||||||
default=which('html2text'),
|
|
||||||
help='full path to html2text [%(default)s]')
|
|
||||||
p.add_argument('--linuxdoc-htmldoc', type=arg_isexecutable,
|
|
||||||
default=which('htmldoc'),
|
|
||||||
help='full path to htmldoc [%(default)s]')
|
|
||||||
|
|
||||||
|
|
||||||
class Linuxdoc(BaseDoctype, SignatureChecker):
|
class Linuxdoc(BaseDoctype, SignatureChecker):
|
||||||
formatname = 'Linuxdoc'
|
formatname = 'Linuxdoc'
|
||||||
extensions = ['.sgml']
|
extensions = ['.sgml']
|
||||||
|
@ -81,5 +69,19 @@ ln \
|
||||||
def buildall(self):
|
def buildall(self):
|
||||||
return self.shellscript(self.buildscript)
|
return self.shellscript(self.buildscript)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def argparse(p):
|
||||||
|
p.add_argument('--linuxdoc-sgml2html', type=arg_isexecutable,
|
||||||
|
default=which('sgml2html'),
|
||||||
|
help='full path to sgml2html [%(default)s]')
|
||||||
|
p.add_argument('--linuxdoc-html2text', type=arg_isexecutable,
|
||||||
|
default=which('html2text'),
|
||||||
|
help='full path to html2text [%(default)s]')
|
||||||
|
p.add_argument('--linuxdoc-htmldoc', type=arg_isexecutable,
|
||||||
|
default=which('htmldoc'),
|
||||||
|
help='full path to htmldoc [%(default)s]')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# -- end of file
|
# -- end of file
|
||||||
|
|
Loading…
Reference in New Issue