add pre-parsing inline includer for pdf
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 4 Jul 2022 09:54:23 +0000 (10:54 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 4 Jul 2022 09:54:27 +0000 (10:54 +0100)
openpower/Makefile
openpower/mdwn_inline.py [new file with mode: 0755]
openpower/sv/bitmanip.mdwn
openpower/sv/remap.mdwn

index 29298872f204f80a4cbaebb84713c7bfd17f293b..c7fb3fa3997a0ff174cdba47ce9642d5f1c074c2 100755 (executable)
@@ -47,9 +47,10 @@ tex:
        pandoc -f markdown -t latex --top-level-division=section \
                --filter pandoc_img.py \
             -N -o tex_out/svstep.tex sv/svstep.mdwn
+       ./mdwn_inline.py sv/remap.mdwn tex_out/remap.mdwn
        pandoc -f markdown -t latex --top-level-division=section \
                --filter pandoc_img.py \
-            -N -o tex_out/remap.tex sv/remap.mdwn
+            -N -o tex_out/remap.tex tex_out/remap.mdwn
        pandoc -f markdown -t latex --top-level-division=section \
                --filter pandoc_img.py \
             -N -o tex_out/mv_swizzle.tex sv/mv.swizzle.mdwn
@@ -66,9 +67,10 @@ tex:
        pandoc -f markdown -t latex --top-level-division=section \
                --filter pandoc_img.py \
                        -N -o tex_out/cr_int_predication.tex sv/cr_int_predication.mdwn
+       ./mdwn_inline.py sv/bitmanip.mdwn tex_out/bitmanip.mdwn
        pandoc -f markdown -t latex --top-level-division=section \
                --filter pandoc_img.py \
-                       -N -o tex_out/bitmanip.tex sv/bitmanip.mdwn
+                       -N -o tex_out/bitmanip.tex tex_out/bitmanip.mdwn
        pandoc -f markdown -t latex --top-level-division=section \
                --filter pandoc_img.py \
                        -N -o tex_out/fcvt.tex sv/fcvt.mdwn
diff --git a/openpower/mdwn_inline.py b/openpower/mdwn_inline.py
new file mode 100755 (executable)
index 0000000..6d8a7b4
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+
+import sys
+
+with open(sys.argv[2], "w") as o:
+    with open(sys.argv[1], "r") as f:
+        for line in f.readlines():
+            if not line.startswith("[[!inline"):
+                o.write(line)
+                continue
+            print (line.strip())
+            # assume first thing is pagename
+            line = line.split('"')
+            fname = line[1]
+            print ("\t", fname)
+            if fname.endswith(".py"):
+                if fname.startswith("gf_reference"):
+                    with open("../../nmigen-gf/"+fname) as inc:
+                        o.write(inc.read())
+            else:
+                with open("../%s.mdwn" % fname) as inc:
+                    o.write(inc.read())
index 88ef46df87f76c7adeacfa2f7ffa7a2fc071cd11..8ad8f23a4f452a14c40c8d46247095d01cc245d9 100644 (file)
@@ -52,7 +52,7 @@ Useful resource:
 * <https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders>
 * <https://maths-people.anu.edu.au/~brent/pd/rpb232tr.pdf>
 
-[[!inline quick="yes" raw="yes" pages="openpower/sv/draft_opcode_tables"]]
+[[!inline pages="openpower/sv/draft_opcode_tables" quick="yes" raw="yes" ]]
 
 # binary and ternary bitops
 
index d76593a259d337e709102b9cef4dfc02205b67fd..5219d9885ea959e6bd8a2230ab5e26efc32a9022 100644 (file)
@@ -177,7 +177,7 @@ instruction which matches the above SPR:
 There are four "shape" SPRs, SHAPE0-3, 32-bits in each,
 which have the same format.  
 
-[[!inline raw="yes" pages="openpower/sv/shape_table_format" ]]
+[[!inline pages="openpower/sv/shape_table_format" raw="yes" ]]
 
 # svshape instruction  <a name="svshape"> </a>
 
@@ -321,13 +321,13 @@ The algorithm below shows how REMAP works more clearly, and may be
 executed as a python program:
 
 ```
-[[!inline quick="yes" raw="yes" pages="openpower/sv/remap.py" ]]
+[[!inline pages="openpower/sv/remap.py" quick="yes" raw="yes" ]]
 ```
 
 An easier-to-read version (using python iterators) shows the loop nesting:
 
 ```
-[[!inline quick="yes" raw="yes" pages="openpower/sv/remapyield.py" ]]
+[[!inline pages="openpower/sv/remapyield.py" quick="yes" raw="yes" ]]
 ```
 
 Each element index from the for-loop `0..VL-1`