diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2019-01-05 22:54:01 -0500 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2019-01-05 22:59:44 -0500 |
commit | ed8b0376b890466f9ab553485f12a8b7a3b7c63c (patch) | |
tree | a0cabac25263f4096dcaf6f1f7b3a2e23b83b168 | |
parent | 801a34cecb84314cc9126f6bc51f21e8a4863750 (diff) | |
download | librebootfr-ed8b0376b890466f9ab553485f12a8b7a3b7c63c.tar.gz librebootfr-ed8b0376b890466f9ab553485f12a8b7a3b7c63c.zip |
Rework regexp for .md extension replacement (www)
Related issue #570
The markdown file extension was not consistently replaced with an
HTML extension due to a bug in the regexps used in www/publish.sh
caused by the A-Z character range not being included in the
character alternative.
Along with correcting the aforementioned, this patch allows for more
robust link anchor capturing by allowing the use and replacement of
characters within the ranges a-z, A-Z, 0-9, _ (underscore),
and - (hyphen).
-rwxr-xr-x | www/publish.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/www/publish.sh b/www/publish.sh index 9a8a6abc..eb8df8c6 100755 --- a/www/publish.sh +++ b/www/publish.sh @@ -56,12 +56,12 @@ if [[ $FILE != "./docs/fdl-1.3" && $FILE != "docs/fdl-1.3" && fi # change out .md -> .html -sed -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g' "$TMPFILE" -sed -i -e 's/\.md\(#[a-z\-]*\)*]/.html\1]/g' "$TMPFILE" +sed -i -e 's/\.md\(#[a-zA-Z0-9_-]*\)\?)/.html\1)/g' "$TMPFILE" +sed -i -e 's/\.md\(#[a-zA-Z0-9_-]*\)\?]/.html\1]/g' "$TMPFILE" # change out .md -> .html -sed -i -e 's/\.md\(#[a-z\-]*\)*)/.html\1)/g' "$TMPFILE" -sed -i -e 's/\.md\(#[a-z\-]*\)*]/.html\1]/g' "$TMPFILE" +sed -i -e 's/\.md\(#[a-zA-Z0-9_-]*\)\?)/.html\1)/g' "$TMPFILE" +sed -i -e 's/\.md\(#[a-zA-Z0-9_-]*\)\?]/.html\1]/g' "$TMPFILE" # work around issue #2872 TOC=$(grep -q "^x-toc-enable: true$" "$TMPFILE" && printf '%s\n' "--toc --toc-depth=2") || TOC="" |