--- /dev/null
+#!/bin/awk -f
+#!/opt/busybox/awk -f
+
+function macro(call, LOCAL, line, files, n, exec) {
+ "cd " ENVIRON["MD_MACROS"] "; printf '%s/' *" |getline line;
+ split(line, files, "/");
+ for (n in files) { files[files[n]] = ""; delete files[n]; }
+ delete files[""];
+
+ split(call, exec);
+
+ if (exec[1] in files) {
+ RS=""; ORS=""; line="";
+ # TODO: proper shell-exec function with argument array
+ "printf '%s' " line " | " ENVIRON["MD_MACROS"] "/" call | getline line;
+ return line;
+ } else {
+ return HTML("<<" call ">>");
+ }
+}
+
+BEGIN {
+ if (ENVIRON["MD_MACROS"]) { AllowMacros = "true"; }
+}