]> git.plutz.net Git - shellwiki/blobdiff - macros/include
monospace fint for editor
[shellwiki] / macros / include
index 97f35a4a2d27c84bdd171a7e089365e980971877..cf6286daff98cadac941b6ba5fe6d13667adb2c3 100755 (executable)
@@ -51,13 +51,13 @@ page_glob "$page" \
     continue
   fi
   printf '<div class="macro include" page="%s">' "$(HTML "$glob")"
-  ( cd "${mdfile%/*}"
+  refpfx="$(HTML "$glob" |sed 's;[\;&\;];\\&;g')"
+  ( cd -- "${mdfile%/*}"
     sed -n "${from},${to}p" <"$mdfile" \
-    | sed -E '1,20{ /^%[a-z]+/d; }' \
     | md \
     | grep -vx ''
   ) | sed -E '
-    s;(<[^>]+ )(href|src)="([^#/"][^"]*)"([^>]*>);\1\2="'"$(HTML "$glob")"'\3"\4;g
+    s;(<[^>]+ )(href|src)="([^#/"][^"]*)"([^>]*>);\1\2="'"${refpfx}"'\3"\4;g
   '
   printf '</div>'
 done