ci: coloring fixed

This commit is contained in:
Nicolas 2025-10-15 23:15:47 +02:00
parent fcc5480126
commit 39b803c17d
1 changed files with 7 additions and 5 deletions

View File

@ -1,29 +1,31 @@
import argparse import argparse
import re import re
def main(): def main() -> None:
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("path", type=str, help="Input file path") parser.add_argument("path", type=str, help="Input file path")
#parser.add_argument("--abi", type=str, default="", help="Optionaler String (Standard: '')")
args = parser.parse_args() args = parser.parse_args()
regex = r"(\:\n)(.*?)(^[^\n]+\n[^\n]+result_.*?\n\n)" regex = r"(\:\n)(.*?)(^[^\n]+\n[^\n]+result_.*?\n\n)"
subst = "\\g<1><b>\\g<2></b>\\g<3>" subst = "\\g<1><b>\\g<2></b><span style=\"color:grey\">\\g<3></span>"
with open(args.path, 'rt') as f: with open(args.path, 'rt') as f:
text = f.read() text = f.read()
outp_flag = "Disassembly of section .text" not in text outp_flag = "Disassembly of section .text" not in text
text = text.replace('\t', ' ' * 4)
text = text.replace('>', '&gt;') text = text.replace('>', '&gt;')
text = text.replace('<', '&lt;') text = text.replace('<', '&lt;')
text = re.sub(regex, subst, text, 0, re.MULTILINE | re.DOTALL) text = re.sub(regex, subst, text, 0, re.MULTILINE | re.DOTALL)
text = re.sub(r" +", "&nbsp;", text, 0, re.MULTILINE | re.DOTALL)
print('<code>') print('<code>')
for line in text.splitlines(): for line in text.splitlines():
if outp_flag: if outp_flag:
print(line.replace(' ', '&nbsp;') + '<br>') print(line + '<br>')
if "Disassembly of section .text:" in line: if "Disassembly of section .text:" in line:
outp_flag = True outp_flag = True
@ -31,4 +33,4 @@ def main():
print('</code>') print('</code>')
if __name__ == "__main__": if __name__ == "__main__":
main() main()