python-tldp/tldp/doctypes/linuxdoc.py

39 lines
937 B
Python
Raw Normal View History

2016-02-11 03:22:23 +00:00
#! /usr/bin/python
2016-02-11 17:15:50 +00:00
from __future__ import print_function
import os
2016-02-11 03:22:23 +00:00
from ..utils import logger
2016-02-11 17:15:50 +00:00
from ..outputs import OutputDir
2016-02-11 03:22:23 +00:00
from .common import SignatureChecker
2016-02-11 17:15:50 +00:00
class Linuxdoc(SignatureChecker, OutputDir):
2016-02-11 03:22:23 +00:00
extensions = ['.sgml']
signatures = ['<!doctype linuxdoc system', ]
2016-02-11 17:15:50 +00:00
def __init__(self):
2016-02-11 03:22:23 +00:00
pass
2016-02-11 17:15:50 +00:00
def create_txt(self):
cmd = ['html2text', '-style', 'pretty', '-nobs',
self.htmls_name]
stdout = self.txt_name
2016-02-11 03:22:23 +00:00
def create_pdf(self):
2016-02-11 17:15:50 +00:00
cmd = ['htmldoc', '--size', 'universal', '-t', 'pdf',
'--firstpage', 'p1', '--outfile', self.pdf_name,
self.htmls_name]
2016-02-11 03:22:23 +00:00
def create_html(self):
2016-02-11 17:15:50 +00:00
cmd = ['sgml2html', self.filename]
os.symlink(self.html_name, 'index.html')
2016-02-11 03:22:23 +00:00
def create_htmls(self):
2016-02-11 17:15:50 +00:00
cmd = ['sgml2html', '--split=0', self.filename]
os.rename(self.html_name, self.htmls_name)
2016-02-11 03:22:23 +00:00
#
# -- end of file