diff options
author | Michael Reed <top@secret> | 2017-07-05 13:39:04 -0400 |
---|---|---|
committer | Michael Reed <top@secret> | 2017-07-05 13:39:04 -0400 |
commit | 497a49162f7c8b5c1d7c653087b0ac6c8e5765f9 (patch) | |
tree | 4406875de167e2a801cb1089c56581b7d2910905 | |
parent | 693c014d21038c100c7ef0425ea5c006d0ba040e (diff) | |
download | librebootfr-497a49162f7c8b5c1d7c653087b0ac6c8e5765f9.tar.gz librebootfr-497a49162f7c8b5c1d7c653087b0ac6c8e5765f9.zip |
docs/publish.sh: Fix sed(1) invocation on OpenBSD
On OpenBSD, publish.sh errors out at the following call
to sed(1) (from "bash -x publish.sh"):
+ sed temp.md -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g'
sed: 1: "temp.md": undefined label 'emp.md'
It seems that "temp.md" is being parsed by sed as a sed command,
not as a named file. This is likely due to OpenBSD's strict
usage requirements for sed:
usage: sed [-aEnru] [-i[extension]] command [file ...]
sed [-aEnru] [-e command] [-f command_file] [-i[extension]] [file ...]
As shown above, the sed command must always come before any named
files. This commit does that, which fixes publish.sh with OpenBSD's sed.
This is also tested and working with GNU sed v4.2.2
-rwxr-xr-x | www/publish.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/www/publish.sh b/www/publish.sh index cdf3a72a..264c95a1 100755 --- a/www/publish.sh +++ b/www/publish.sh @@ -54,12 +54,12 @@ if [ "${FILE}" != "./docs/fdl-1.3" ] && [ "${FILE}" != "./conduct" ]; then fi # change out .md -> .html -sed temp.md -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g' -sed temp.md -i -e 's/\.md\(#[a-z\-]*\)*]/.html\1]/g' +sed -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g' temp.md +sed -i -e 's/\.md\(#[a-z\-]*\)*]/.html\1]/g' temp.md # change out .md -> .html -sed temp.md -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g' -sed temp.md -i -e 's/\.md\(#[a-z\-]*\)*]/.html\1]/g' +sed -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g' temp.md +sed -i -e 's/\.md\(#[a-z\-]*\)*]/.html\1]/g' temp.md # work around issue #2872 TOC=$(grep -q "^x-toc-enable: true$" temp.md && printf '%s\n' "--toc --toc-depth=2") || TOC="" @@ -75,4 +75,4 @@ pandoc $TOC $SMART temp.md -s --css /global.css $OPTS \ pandoc $1 > $FILE.bare.html # generate section title anchors as [link] -sed $FILE.html -i -e 's_^<h\([123]\) id="\(.*\)">\(.*\)</h\1>_<div class="h"><h\1 id="\2">\3</h\1><a aria-hidden="true" href="#\2">[link]</a></div>_' +sed -i -e 's_^<h\([123]\) id="\(.*\)">\(.*\)</h\1>_<div class="h"><h\1 id="\2">\3</h\1><a aria-hidden="true" href="#\2">[link]</a></div>_' $FILE.html |