]> git.plutz.net Git - shellwiki/commitdiff
bugfix: filter link prefix for references in included files
authorPaul Hänsch <paul@plutz.net>
Wed, 18 May 2022 20:29:46 +0000 (22:29 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 18 May 2022 20:29:46 +0000 (22:29 +0200)
macros/include

index 790514705c87316c01471db8b0d29442d3227dc0..cf6286daff98cadac941b6ba5fe6d13667adb2c3 100755 (executable)
@@ -51,12 +51,13 @@ page_glob "$page" \
     continue
   fi
   printf '<div class="macro include" page="%s">' "$(HTML "$glob")"
+  refpfx="$(HTML "$glob" |sed 's;[\;&\;];\\&;g')"
   ( cd -- "${mdfile%/*}"
     sed -n "${from},${to}p" <"$mdfile" \
     | 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