/usr/lib/python3/dist-packages/markups/abstract.py is in python3-markups 0.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # This file is part of python-markups module
# License: BSD
# Copyright: (C) Dmitry Shachnev, 2012
class AbstractMarkup(object):
"""Abstract class for markup languages"""
file_extensions = ()
def __init__(self, filename=None):
self.filename = filename
self.enable_cache = False
self.cache = {}
def available():
return True
def get_document_title(self, text):
return ''
def get_document_body(self, text):
raise NotImplementedError
def get_stylesheet(self, text=''):
return ''
def get_javascript(self, text='', webenv=False):
return ''
def get_whole_html(self, text, custom_headers='', include_stylesheet=True,
fallback_title='', webenv=False):
self.enable_cache = True
body = self.get_document_body(text)
stylesheet = ('<style type="text/css">\n' + self.get_stylesheet(text)
+ '</style>\n' if include_stylesheet else '')
title = self.get_document_title(text)
if not title:
title = fallback_title
title_string = ('<title>' + title + '</title>\n') if title else ''
javascript = self.get_javascript(text, webenv)
self.enable_cache = False
self.cache = {}
return (
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n'
'<html>\n<head>\n'
'<meta http-equiv="content-type" content="text/html; charset=utf-8">\n'
+ custom_headers + title_string + stylesheet + javascript
+ '</head>\n<body>\n' + body + '</body>\n</html>\n'
)
|