From 497a49162f7c8b5c1d7c653087b0ac6c8e5765f9 Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Wed, 5 Jul 2017 13:39:04 -0400 Subject: 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 --- www/publish.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'www') 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_^\(.*\)__' +sed -i -e 's_^\(.*\)__' $FILE.html -- cgit v1.2.3-70-g09d2