}
}
-function macro(call, LOCAL, line, files, n, args) {
- "cd " sh_escape(ENVIRON["MD_MACROS"]) "; printf '%s/' *" |getline line;
- split(line, files, "/");
- for (n in files) { files[files[n]] = ""; delete files[n]; }
- delete files[""];
-
+function macro(call, LOCAL, line, args) {
argsplit(call, args);
call="";
for (n = 1; n in args; n++) call = call sh_escape(args[n]) " ";
- if (args[1] in files) {
+ if (args[1] in MACROS) {
RS=""; ORS=""; line="";
"printf '%s' " sh_escape(file) " | " sh_escape(ENVIRON["MD_MACROS"]) "/" call | getline line;
return line;
}
BEGIN {
- if (ENVIRON["MD_MACROS"]) { AllowMacros = "true"; }
+ if (ENVIRON["MD_MACROS"]) {
+ AllowMacros = "true";
+ "cd " sh_escape(ENVIRON["MD_MACROS"]) "; printf '%s/' *" |getline macro_list;
+ split(macro_list, MACROS, "/");
+ for (n in MACROS) { MACROS[MACROS[n]] = ""; delete MACROS[n]; }
+ delete MACROS[""];
+ }
}