Skip to content

Commit 1bd4580

Browse files
committed
Use portable sed regex for BSD/GNU compatibility
1 parent 54e9512 commit 1bd4580

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if hash mmark &>/dev/null; then
2222
readme_lang="${readme#README}"
2323
readme_lang="${readme_lang%.md}"
2424
mmark -html -css //bach.sh/solarized-dark.min.css "$readme" | tee "index${readme_lang}.1.html"
25-
title="$(grep '<h1 ' "index${readme_lang}.1.html" | sed -e "s/<[^>]\+>//g" -e 's|/|\\/|g')"
25+
title="$(grep '<h1 ' "index${readme_lang}.1.html" | sed -e "s/<[^>]*>//g")"
2626
cat "index${readme_lang}.1.html" | sed "/<title>/s/>/>${title}/" | tee "index${readme_lang}.html" >/dev/null
2727
rm "index${readme_lang}.1.html"
2828
done

tests/release.test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test-convert-to-html() {
5656
@mocktrue hash mmark
5757
@mock grep '<h1 ' index.1.html === @stdout "<h1 id=\"title\">Bach Unit Testing Framework for Bash</h1>"
5858
@mock grep '<h1 ' index-zh_CN.1.html === @stdout "<h1 id=\"title\">Bash 脚本的 Bach 单元测试框架</h1>"
59-
@allow-real sed -e "s/<[^>]\+>//g" -e 's|/|\\/|g'
59+
@allow-real sed -e "s/<[^>]*>//g"
6060
@mock cat index-zh_CN.1.html
6161
@mock cat index.1.html
6262
@mock tee index-zh_CN.1.html
@@ -70,10 +70,10 @@ test-convert-to-html-assert() {
7070
test-pass-a-valid-tag-assert
7171

7272
mmark -html -css //bach.sh/solarized-dark.min.css README-zh_CN.md
73-
sed "/<title>/s/>/><h1 id=\"title\">Bash 脚本的 Bach 单元测试框架<\\/h1>/"
73+
sed "/<title>/s/>/>Bash 脚本的 Bach 单元测试框架/"
7474
rm index-zh_CN.1.html
7575

7676
mmark -html -css //bach.sh/solarized-dark.min.css README.md
77-
sed "/<title>/s/>/><h1 id=\"title\">Bach Unit Testing Framework for Bash<\\/h1>/"
77+
sed "/<title>/s/>/>Bach Unit Testing Framework for Bash/"
7878
rm index.1.html
7979
}

0 commit comments

Comments
 (0)