From e1bed8d0cf8677965beadf535510ec782498c490 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Thu, 14 Dec 2023 18:32:38 +0800 Subject: [PATCH] Extract instructions --- main.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 2baab4c..ef1b091 100644 --- a/main.py +++ b/main.py @@ -1835,7 +1835,7 @@ def all_intrinsics(render=True): { "name": intrinsic, "content": markdown.markdown( - body, + body.strip(), extensions=[ "fenced_code", "codehilite", @@ -1847,13 +1847,22 @@ def all_intrinsics(render=True): } ) else: + insts = [] + for line in body.split("\n"): + if line.startswith("Instruction:"): + # check instruction format + inst = line[12:].strip() + for name in inst.split(";"): + insts.append(name.strip().split(" ")[0]) + # do not render result.append( { "name": intrinsic.split("(")[0] .strip() .split(" ")[-1], - "full_name": intrinsic, + "c_intrinsic": intrinsic, + "instructions": insts, "content": body.strip(), "group": title, "extension": extension,