mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-27 10:11:15 +00:00
Use Renderer to avoid loading templates ourselves
This commit is contained in:
parent
b3250ab1ca
commit
0d59657dbc
@ -12,7 +12,7 @@
|
|||||||
import colorama
|
import colorama
|
||||||
import html
|
import html
|
||||||
import re
|
import re
|
||||||
import pystache
|
from pystache import Renderer
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(allow_abbrev=False,
|
parser = argparse.ArgumentParser(allow_abbrev=False,
|
||||||
description='Recompilation Compare: compare an original EXE with a recompiled EXE + PDB.')
|
description='Recompilation Compare: compare an original EXE with a recompiled EXE + PDB.')
|
||||||
@ -554,25 +554,17 @@ def can_resolve_register_differences(original_asm, new_asm):
|
|||||||
break
|
break
|
||||||
|
|
||||||
def gen_html(html_file, data):
|
def gen_html(html_file, data):
|
||||||
templatedata = None
|
output_data = Renderer().render_path(get_file_in_script_dir('template.html'),
|
||||||
with open(get_file_in_script_dir('template.html')) as templatefile:
|
|
||||||
templatedata = templatefile.read()
|
|
||||||
|
|
||||||
outputdata = pystache.render(templatedata,
|
|
||||||
{
|
{
|
||||||
"data": ','.join(data)
|
"data": ','.join(data)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
with open(html_file, 'w') as htmlfile:
|
with open(html_file, 'w') as htmlfile:
|
||||||
htmlfile.write(outputdata)
|
htmlfile.write(output_data)
|
||||||
|
|
||||||
|
|
||||||
def gen_svg(svg_file, name_svg, icon, svg_implemented_funcs, total_funcs, raw_accuracy):
|
def gen_svg(svg_file, name_svg, icon, svg_implemented_funcs, total_funcs, raw_accuracy):
|
||||||
templatedata = None
|
|
||||||
with open(get_file_in_script_dir('template.svg')) as templatefile:
|
|
||||||
templatedata = templatefile.read()
|
|
||||||
|
|
||||||
icon_data = None
|
icon_data = None
|
||||||
if icon:
|
if icon:
|
||||||
with open(icon, 'rb') as iconfile:
|
with open(icon, 'rb') as iconfile:
|
||||||
@ -580,7 +572,7 @@ def gen_svg(svg_file, name_svg, icon, svg_implemented_funcs, total_funcs, raw_ac
|
|||||||
|
|
||||||
total_statistic = raw_accuracy / total_funcs
|
total_statistic = raw_accuracy / total_funcs
|
||||||
full_percentbar_width = 127.18422
|
full_percentbar_width = 127.18422
|
||||||
output_data = pystache.render(templatedata,
|
output_data = Renderer().render_path(get_file_in_script_dir('template.svg'),
|
||||||
{
|
{
|
||||||
"name": name_svg,
|
"name": name_svg,
|
||||||
"icon": icon_data,
|
"icon": icon_data,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user