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-11 19:29:23 +00:00
|
|
|
from __future__ import absolute_import, division, print_function
|
2016-02-11 17:15:50 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
|
2016-02-23 19:05:28 +00:00
|
|
|
from tldp.utils import logger, which, execute
|
|
|
|
from tldp.utils import arg_isexecutable, isexecutable
|
|
|
|
from tldp.doctypes.common import BaseDoctype, SignatureChecker
|
2016-02-11 03:22:23 +00:00
|
|
|
|
|
|
|
|
2016-02-22 20:32:35 +00:00
|
|
|
def config_fragment(p):
|
2016-02-23 19:05:28 +00:00
|
|
|
p.add_argument('--linuxdoc-sgml2html', type=arg_isexecutable,
|
2016-02-22 20:32:35 +00:00
|
|
|
default=which('sgml2html'),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to sgml2html [%(default)s]')
|
2016-02-23 19:05:28 +00:00
|
|
|
p.add_argument('--linuxdoc-html2text', type=arg_isexecutable,
|
2016-02-22 20:32:35 +00:00
|
|
|
default=which('html2text'),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to html2text [%(default)s]')
|
2016-02-23 19:05:28 +00:00
|
|
|
p.add_argument('--linuxdoc-htmldoc', type=arg_isexecutable,
|
2016-02-22 20:32:35 +00:00
|
|
|
default=which('htmldoc'),
|
2016-02-23 17:08:08 +00:00
|
|
|
help='full path to htmldoc [%(default)s]')
|
2016-02-22 01:49:14 +00:00
|
|
|
|
|
|
|
|
2016-02-15 22:04:09 +00:00
|
|
|
class Linuxdoc(BaseDoctype, SignatureChecker):
|
2016-02-12 20:49:50 +00:00
|
|
|
formatname = 'Linuxdoc'
|
2016-02-11 03:22:23 +00:00
|
|
|
extensions = ['.sgml']
|
|
|
|
signatures = ['<!doctype linuxdoc system', ]
|
|
|
|
|
2016-02-23 19:05:28 +00:00
|
|
|
required = {'linuxdoc_sgml2html': isexecutable,
|
|
|
|
'linuxdoc_html2text': isexecutable,
|
|
|
|
'linuxdoc_htmldoc': isexecutable,
|
|
|
|
}
|
|
|
|
|
2016-02-24 06:44:17 +00:00
|
|
|
buildorder = ['buildall']
|
|
|
|
buildscript = '''#! /bin/bash
|
|
|
|
#
|
|
|
|
# -- generate LDP outputs from DocBook XML 4.x
|
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
cd "{output.dirname}"
|
|
|
|
|
|
|
|
# -- implicitly creates {output.name_html}
|
|
|
|
"{config.linuxdoc_sgml2html}" \\
|
|
|
|
--split=0 \\
|
|
|
|
"{source.filename}"
|
|
|
|
|
|
|
|
# -- .... so, it must be rename to {output.name_htmls}
|
|
|
|
mv \\
|
|
|
|
--no-clobber \\
|
|
|
|
--verbose \\
|
|
|
|
-- "{output.name_html}" "{output.name_htmls}"
|
|
|
|
|
|
|
|
"{config.linuxdoc_html2text}" > "{output.name_txt}" \\
|
|
|
|
-style pretty \\
|
|
|
|
-nobs \\
|
|
|
|
"{output.name_htmls}"
|
|
|
|
|
|
|
|
"{config.linuxdoc_htmldoc}" \\
|
|
|
|
--size universal \\
|
|
|
|
-t pdf \\
|
|
|
|
--firstpage p1 \\
|
|
|
|
--outfile "{output.name_pdf}" \\
|
|
|
|
"{output.name_htmls}"
|
|
|
|
|
|
|
|
# -- implicitly creates {output.name_html}
|
|
|
|
"{config.linuxdoc_sgml2html}" \\
|
|
|
|
"{source.filename}"
|
|
|
|
|
|
|
|
ln \
|
|
|
|
--symbolic \
|
|
|
|
--relative \
|
|
|
|
--verbose \
|
|
|
|
-- "{output.name_html}" "{output.name_indexhtml}"
|
|
|
|
|
|
|
|
# -- end of file'''
|
|
|
|
|
|
|
|
def buildall(self):
|
|
|
|
return self.shellscript(self.buildscript)
|
2016-02-11 03:22:23 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# -- end of file
|