mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 00:28:25 +01:00
Added a "htmlembedded" output format.
This format behaves the same as the old "html" output. Consequently, the ordinary "html" output now hot-links the JQuery script to ajax.googleapis.com. This results in a generated file with roughly half the stitching code compared to previously.
This commit is contained in:
parent
58fbd0f3e1
commit
45429d9a35
3 changed files with 9 additions and 5 deletions
|
@ -25,7 +25,7 @@ import basedir
|
|||
import os
|
||||
import zipfile
|
||||
|
||||
__available_formats__ = ["html", "text", "xml"]
|
||||
__available_formats__ = ["html", "htmlembedded", "text", "xml"]
|
||||
__default_format__ = __available_formats__[1]
|
||||
__selected_format__ = __default_format__
|
||||
|
||||
|
@ -56,10 +56,9 @@ def __get_zip_file_content__(name, file_name="/html/flot.zip"):
|
|||
return content.decode("utf-8", "replace")
|
||||
|
||||
def output_header():
|
||||
if __selected_format__ == "html":
|
||||
if __selected_format__ == "html" or __selected_format__ == "htmlembedded":
|
||||
base = basedir.get_basedir()
|
||||
html_header = __output_html_template__(base + "/html/html.header")
|
||||
jquery_js = __get_zip_file_content__("jquery.js")
|
||||
tablesorter_js = __get_zip_file_content__("jquery.tablesorter.min.js", "/html/jquery.tablesorter.min.js.zip")
|
||||
flot_js = __get_zip_file_content__("jquery.flot.js")
|
||||
pie_js = __get_zip_file_content__("jquery.flot.pie.js")
|
||||
|
@ -69,6 +68,11 @@ def output_header():
|
|||
logo_file.close()
|
||||
logo = base64.b64encode(logo)
|
||||
|
||||
if __selected_format__ == "htmlembedded":
|
||||
jquery_js = ">" + __get_zip_file_content__("jquery.js")
|
||||
else:
|
||||
jquery_js = " src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js\">"
|
||||
|
||||
print(html_header.format(version = version.__version__,
|
||||
jquery = jquery_js,
|
||||
jquery_tablesorter = tablesorter_js,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
|
||||
<title>Generated by gitinspector {version}</title>
|
||||
<script type="application/javascript">{jquery}</script>
|
||||
<script type="application/javascript"{jquery}</script>
|
||||
<script type="application/javascript">{jquery_tablesorter}</script>
|
||||
<script type="application/javascript">{jquery_flot}</script>
|
||||
<script type="application/javascript">{jquery_flot_pie}</script>
|
||||
|
|
|
@ -32,7 +32,7 @@ class Outputable(object):
|
|||
print(_("XML output not yet supported in") + " \"" + self.__class__.__name__ + "\".")
|
||||
|
||||
def output(outputable):
|
||||
if format.get_selected() == "html":
|
||||
if format.get_selected() == "html" or format.get_selected() == "htmlembedded":
|
||||
outputable.output_html()
|
||||
elif format.get_selected() == "text":
|
||||
outputable.output_text()
|
||||
|
|
Loading…
Reference in a new issue