Makefile
... ...
@@ -27,6 +27,7 @@ help:
27 27
%.md: %.raw FORCE
28 28
cat $< \
29 29
| sed -f convert.sed \
30
+ | sed -f fix-code.sed \
30 31
| sed -e "s%/$(@D)/%%g" \
31 32
> $@
32 33
fix-code.sed
... ...
@@ -0,0 +1,23 @@
1
+#!/usr/bin/sed
2
+# Convert unlabelled code
3
+#
4
+
5
+# Code output by action=markdown ends with two spaces (mostly).
6
+/ $/,/\[Get Code]/ {
7
+ # At the end of the block dump the accumulated lines
8
+ /\[Get Code\]/ {
9
+ x
10
+ p
11
+ x
12
+ d
13
+ }
14
+
15
+ # clean whitespace
16
+ s/\s\+$//
17
+ # indent
18
+ s/^/ /
19
+
20
+ # accumulate lines within the code block
21
+ H
22
+ d
23
+}