mirror of https://github.com/Nonannet/copapy.git
ci: coloring fixed
This commit is contained in:
parent
fcc5480126
commit
39b803c17d
|
|
@ -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('>', '>')
|
text = text.replace('>', '>')
|
||||||
text = text.replace('<', '<')
|
text = text.replace('<', '<')
|
||||||
|
|
||||||
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" +", " ", 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(' ', ' ') + '<br>')
|
print(line + '<br>')
|
||||||
|
|
||||||
if "Disassembly of section .text:" in line:
|
if "Disassembly of section .text:" in line:
|
||||||
outp_flag = True
|
outp_flag = True
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue