]> git.plutz.net Git - shellwiki/commitdiff
bugfix: don't rewrite external links in included pages
authorPaul Hänsch <paul@plutz.net>
Wed, 18 May 2022 21:43:04 +0000 (23:43 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 18 May 2022 21:43:04 +0000 (23:43 +0200)
macros/include

index cf6286daff98cadac941b6ba5fe6d13667adb2c3..d35c2a30c625a5b9938971a9411e9fc6978a948a 100755 (executable)
@@ -57,7 +57,9 @@ page_glob "$page" \
     | md \
     | grep -vx ''
   ) | sed -E '
+    s;(<[^>]+ )(href|src)="([^"]+://[^"]*|[mM][aA][iI][lL][tT][oO]:[^"]*)"([^>]*>);\1\2="/#safe/\3"\4;g
     s;(<[^>]+ )(href|src)="([^#/"][^"]*)"([^>]*>);\1\2="'"${refpfx}"'\3"\4;g
+    s;(<[^>]+ )(href|src)="/#safe/([^"]*)"([^>]*>);\1\2="\3"\4;g
   '
   printf '</div>'
 done