Introduction
Introduction Statistics Contact Development Disclaimer Help
sed: improve regex (locale-aware), simplify - static-site-scripts - static site…
git clone git://git.codemadness.org/static-site-scripts
Log
Files
Refs
README
LICENSE
---
commit 18cdce8ba9f18ec16383297af25d4cd25e0fede3
parent 501f05e74049ca84d3a314c4e740c0b38671fe60
Author: Hiltjo Posthuma <[email protected]>
Date: Sun, 11 Oct 2015 16:55:28 +0200
sed: improve regex (locale-aware), simplify
Diffstat:
M generate.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/generate.sh b/generate.sh
@@ -45,8 +45,8 @@ fi
#makeid(title), format "Some title" to "some-title".
makeid() {
- printf '%s\n' "$1" | tr '[:upper:]' '[:lower:]' | sed -e 's@[^a-zA-Z0-…
- -e 's@[-]*$@@g' -e 's@^[-]*@@g'
+ printf '%s\n' "$1" | tr '[:upper:]' '[:lower:]' | \
+ sed -e 's@[^[:alnum:]]\{1,\}@-@g' -e 's@-*$@@g' -e 's@^-*@@g'
}
# initial values for page variables, use some site vars as global defaults.
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.