From abcc3afb314b1129ada6eb326a6ca124b46fa44c Mon Sep 17 00:00:00 2001 From: MS Date: Wed, 22 Nov 2023 02:52:57 -0500 Subject: [PATCH] Fix reccmp html output for template functions (#296) --- tools/reccmp/reccmp.py | 12 +++++----- tools/reccmp/template.html | 46 +++++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/tools/reccmp/reccmp.py b/tools/reccmp/reccmp.py index 5e295f7d..2cd2e43a 100755 --- a/tools/reccmp/reccmp.py +++ b/tools/reccmp/reccmp.py @@ -10,7 +10,7 @@ import os import sys import colorama -import html +import json import re from isledecomp.dir import walk_source_dir from isledecomp.parser import find_code_blocks @@ -526,14 +526,16 @@ def can_resolve_register_differences(original_asm, new_asm): # If html, record the diffs to an HTML file if html_path: - escaped = html.escape('\\n'.join(udiff).replace('"', '\\"').replace('\n', '\\n')) - htmlinsert.append(f'{{address: "0x{addr:x}", name: "{html.escape(recinfo.name)}", matching: {effective_ratio}, diff: "{escaped}"}}') + htmlinsert.append({"address": f"0x{addr:x}", + "name": recinfo.name, + "matching": effective_ratio, + "diff": '\n'.join(udiff)}) def gen_html(html_file, data): output_data = Renderer().render_path(get_file_in_script_dir('template.html'), { - "data": ','.join(data) + "data": data, } ) @@ -564,7 +566,7 @@ def gen_svg(svg_file, name_svg, icon, svg_implemented_funcs, total_funcs, raw_ac if html_path: - gen_html(html_path, htmlinsert) + gen_html(html_path, json.dumps(htmlinsert)) if verbose: if not found_verbose_target: diff --git a/tools/reccmp/template.html b/tools/reccmp/template.html index 25de983a..2ee17399 100644 --- a/tools/reccmp/template.html +++ b/tools/reccmp/template.html @@ -64,6 +64,11 @@ color: #80FF80; } + .identical { + font-style: italic; + text-align: center; + } + #sortind { margin: 0 0.5em; } @@ -75,23 +80,23 @@ }