2016-02-11 03:22:23 +00:00
|
|
|
#! /usr/bin/python
|
2016-02-18 21:25:02 +00:00
|
|
|
# -*- coding: utf8 -*-
|
2016-02-11 03:22:23 +00:00
|
|
|
|
2016-02-22 20:32:35 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
from ..utils import logger, which, firstfoundfile
|
2016-02-11 03:22:23 +00:00
|
|
|
from .common import SignatureChecker
|
|
|
|
|
|
|
|
|
2016-02-22 20:32:35 +00:00
|
|
|
def docbookdsl_finder():
|
|
|
|
locations = [
|
|
|
|
'/usr/share/sgml/docbook/stylesheet/dsssl/ldp/ldp.dsl',
|
|
|
|
'/usr/share/sgml/docbook/dsssl-stylesheets/html/docbook.dsl']
|
|
|
|
return firstfoundfile(locations)
|
|
|
|
|
|
|
|
|
|
|
|
def ldpdsl_finder():
|
|
|
|
locations = [
|
|
|
|
'/usr/share/sgml/docbook/stylesheet/dsssl/modular/html/docbook.dsl']
|
|
|
|
return firstfoundfile(locations)
|
|
|
|
|
|
|
|
|
|
|
|
def config_fragment(p):
|
|
|
|
p.add_argument('--docbooksgml-docbookdsl', type=str,
|
|
|
|
default=docbookdsl_finder(),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to html/docbook.dsl [%(default)s]')
|
2016-02-22 20:32:35 +00:00
|
|
|
p.add_argument('--docbooksgml-ldpdsl', type=str,
|
|
|
|
default=ldpdsl_finder(),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to ldp/ldp.dsl [%(default)s]')
|
2016-02-22 20:32:35 +00:00
|
|
|
p.add_argument('--docbooksgml-jw', type=which,
|
|
|
|
default=which('jw'),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to jw [%(default)s]')
|
2016-02-22 20:32:35 +00:00
|
|
|
p.add_argument('--docbooksgml-html2text', type=which,
|
|
|
|
default=which('html2text'),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to html2text [%(default)s]')
|
2016-02-22 20:32:35 +00:00
|
|
|
p.add_argument('--docbooksgml-openjade', type=which,
|
|
|
|
default=which('openjade'),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to openjade [%(default)s]')
|
2016-02-22 20:32:35 +00:00
|
|
|
p.add_argument('--docbooksgml-dblatex', type=which,
|
|
|
|
default=which('dblatex'),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to dblatex [%(default)s]')
|
2016-02-22 20:32:35 +00:00
|
|
|
p.add_argument('--docbooksgml-collateindex', type=which,
|
|
|
|
default=which('collateindex'),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to collateindex [%(default)s]')
|
2016-02-22 01:49:14 +00:00
|
|
|
|
|
|
|
|
2016-02-11 03:22:23 +00:00
|
|
|
class DocbookSGML(SignatureChecker):
|
2016-02-17 21:49:33 +00:00
|
|
|
formatname = 'DocBook SGML 3.x/4.x'
|
2016-02-11 03:22:23 +00:00
|
|
|
extensions = ['.sgml']
|
|
|
|
signatures = ['-//Davenport//DTD DocBook V3.0//EN',
|
|
|
|
'-//OASIS//DTD DocBook V3.1//EN',
|
|
|
|
'-//OASIS//DTD DocBook V4.1//EN',
|
|
|
|
'-//OASIS//DTD DocBook V4.2//EN', ]
|
2016-02-12 20:43:45 +00:00
|
|
|
tools = ['jw', 'openjade', 'collateindex.pl', 'html2text', 'dblatex']
|
|
|
|
|
|
|
|
def create_txt(self):
|
|
|
|
logger.info("Creating txt for %s", self.source.stem)
|
|
|
|
|
|
|
|
def create_pdf(self):
|
|
|
|
logger.info("Creating PDF for %s", self.source.stem)
|
|
|
|
|
|
|
|
def create_html(self):
|
|
|
|
logger.info("Creating chunked HTML for %s", self.source.stem)
|
|
|
|
|
|
|
|
def create_htmls(self):
|
|
|
|
logger.info("Creating single page HTML for %s", self.source.stem)
|
2016-02-11 03:22:23 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# -- end of file
|