diff --git a/code/viewer_partial.html b/code/viewer_partial.html
index 342c9bce..525b47e3 100644
--- a/code/viewer_partial.html
+++ b/code/viewer_partial.html
@@ -1,16 +1,31 @@
{% raw %}
-
+
Categories:
+
-
+
-
+
+Filter by content:
+
+
+
+
+
+
+
+Found {{intrinsics.length}} intrinsics.
+
+
+
+
+
{{ intrinsic.name }}
-
+
diff --git a/docs/viewer.md b/docs/viewer.md
index 1d1b026f..cb50c094 100644
--- a/docs/viewer.md
+++ b/docs/viewer.md
@@ -1,5 +1,3 @@
# All Intrinsics
-Search for intrinsics below:
-
{% include 'viewer_partial.html' %}
\ No newline at end of file
diff --git a/main.py b/main.py
index d3debabe..fb451801 100644
--- a/main.py
+++ b/main.py
@@ -3,6 +3,7 @@
import os
import json
import markdown
+import re
def define_env(env):
@@ -1618,18 +1619,22 @@ def all_intrinsics():
code = line.split("{{")[1].split("}}")[0]
# Dangerous! But we trust ourselves.
content = eval(code, env.macros)
- lines = content.split('\n')
- for i in range(len(lines)):
- line = lines[i]
- if line.startswith('##'):
- body = '\n'.join(lines[i+1:])
- intrinsic = line[2:].strip()
- result.append({
- 'name': intrinsic,
- 'content': markdown.markdown(body, extensions=['fenced_code', 'codehilite']),
- 'group': title
- })
- break
+ # handle cases for multiple instructions in one call
+ for part in re.split(r'^## ', content, flags=re.MULTILINE):
+ if len(part.strip()) == 0:
+ continue
+ lines = ('## ' + part).split('\n')
+ for i in range(len(lines)):
+ line = lines[i]
+ if line.startswith('##'):
+ body = '\n'.join(lines[i+1:])
+ intrinsic = line[2:].strip()
+ result.append({
+ 'name': intrinsic,
+ 'content': markdown.markdown(body, extensions=['fenced_code', 'codehilite']),
+ 'group': title
+ })
+ break
return json.dumps(result)
@env.macro