edithtml.sh: argument quoting.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2020-06-15 13:14:16 +01:00
parent 673be69531
commit d0d4abac2e
1 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@ if [ "x$1" = "x--rst" ]; then
sed -i.sedbak 's|</head>|<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"></head>|' $2 sed -i.sedbak 's|</head>|<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"></head>|' $2
sed -i.sedbak 's|http://cdn.mathjax.org/mathjax/latest/MathJax.js|https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js|' $2 sed -i.sedbak 's|http://cdn.mathjax.org/mathjax/latest/MathJax.js|https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js|' $2
else else
cat - $2 >$2.prefix <<EOF cat - "$2" >"$2".prefix <<EOF
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@ -26,14 +26,14 @@ else
</head> </head>
<body> <body>
EOF EOF
cat $2.prefix - >$2 <<EOF cat "$2.prefix" - >"$2" <<EOF
</body> </body>
</html> </html>
EOF EOF
rm -f $2.prefix rm -f "$2".prefix
fi fi
sed -i.sedbak 's|<a href="\([^":]*\).rst">|<a href="\1">|g' $2 sed -i.sedbak 's|<a href="\([^":]*\).rst">|<a href="\1">|g' "$2"
perl -i.sedbak -p0e 's|<section id="([^"]*)">\s*.?\s*<h([1-9])>([^<]*(?:<code>[^<]*</code>[^<]*)?)</h([1-9])>|<section id="\1"><h\2><span class="section-heading">\3</span><span class="section-anchor"> <a href="#\1"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h\4>|g' "$2" perl -i.sedbak -p0e 's|<section id="([^"]*)">\s*.?\s*<h([1-9])>([^<]*(?:<code>[^<]*</code>[^<]*)?)</h([1-9])>|<section id="\1"><h\2><span class="section-heading">\3</span><span class="section-anchor"> <a href="#\1"><img width="24" height="24" src="assets/images/section-anchor.png" alt=""></a></span></h\4>|g' "$2"