mirror of
https://git.ludikovsky.name/git/fugitive.git
synced 2024-10-05 15:35:29 +02:00
replaced '\s' by '[[:space:]]' in grep calls to fix compatibility issues
This commit is contained in:
parent
2042c0abba
commit
0ba2a3b30d
36
html-gen.sh
36
html-gen.sh
|
@ -105,29 +105,29 @@ sanit_mail() {
|
||||||
|
|
||||||
replace_condition() {
|
replace_condition() {
|
||||||
if [ "$2" = "" ]; then
|
if [ "$2" = "" ]; then
|
||||||
sed "s/<?fugitive\s\+\(end\)\?ifset:$1\s*?>/\n\0\n/g" | \
|
sed "s/<?fugitive[[:space:]]\+\(end\)\?ifset:$1[[:space:]]*?>/\n\0\n/g" | \
|
||||||
sed "/<?fugitive\s\+ifset:$1\s*?>/,/<?fugitive\s\+endifset:$1\s*?>/bdel
|
sed "/<?fugitive[[:space:]]\+ifset:$1[[:space:]]*?>/,/<?fugitive[[:space:]]\+endifset:$1[[:space:]]*?>/bdel
|
||||||
b
|
b
|
||||||
:del
|
:del
|
||||||
s/<?fugitive\s\+endifset:$1\s*?>.*//
|
s/<?fugitive[[:space:]]\+endifset:$1[[:space:]]*?>.*//
|
||||||
/<?fugitive\s\+endifset:$1\s*?>/b
|
/<?fugitive[[:space:]]\+endifset:$1[[:space:]]*?>/b
|
||||||
d"
|
d"
|
||||||
else
|
else
|
||||||
sed "s/<?fugitive\s\+\(end\)\?ifset:$1\s*?>//"
|
sed "s/<?fugitive[[:space:]]\+\(end\)\?ifset:$1[[:space:]]*?>//"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
replace_str() {
|
replace_str() {
|
||||||
esc=`echo $2 | sed 's/\//\\\\\//g'`
|
esc=`echo $2 | sed 's/\//\\\\\//g'`
|
||||||
replace_condition "$1" "$2" | \
|
replace_condition "$1" "$2" | \
|
||||||
sed "s/<?fugitive\s\+$1\s*?>/$esc/g"
|
sed "s/<?fugitive[[:space:]]\+$1[[:space:]]*?>/$esc/g"
|
||||||
}
|
}
|
||||||
|
|
||||||
# REMEMBER: 2nd arg should be a tempfile!
|
# REMEMBER: 2nd arg should be a tempfile!
|
||||||
replace_file() {
|
replace_file() {
|
||||||
if [ -f "$2" ]; then
|
if [ -f "$2" ]; then
|
||||||
sed "s/<?fugitive\s\+$1\s*?>/\n\0\n/g" | \
|
sed "s/<?fugitive[[:space:]]\+$1[[:space:]]*?>/\n\0\n/g" | \
|
||||||
sed "/<?fugitive\s\+$1\s*?>/ {
|
sed "/<?fugitive[[:space:]]\+$1[[:space:]]*?>/ {
|
||||||
r $2
|
r $2
|
||||||
d }"
|
d }"
|
||||||
rm "$2"
|
rm "$2"
|
||||||
|
@ -141,14 +141,14 @@ replace_includes() {
|
||||||
buf2=`mktemp`
|
buf2=`mktemp`
|
||||||
cat > "$buf"
|
cat > "$buf"
|
||||||
includes=`cat "$buf" | \
|
includes=`cat "$buf" | \
|
||||||
sed "s/<?fugitive\s\+include:.\+\s*?>/\n\0\n/g" | \
|
sed "s/<?fugitive[[:space:]]\+include:.\+[[:space:]]*?>/\n\0\n/g" | \
|
||||||
grep -E "<\?fugitive\s+include:.+\s*\?>" | \
|
grep -E "<\?fugitive[[:space:]]+include:.+[[:space:]]*\?>" | \
|
||||||
sed "s/^<?fugitive\s\+include://;s/\s*?>$//"`
|
sed "s/^<?fugitive[[:space:]]\+include://;s/[[:space:]]*?>$//"`
|
||||||
for i in $includes; do
|
for i in $includes; do
|
||||||
esc=`echo -n $i | sed 's/\//\\\\\//g'`
|
esc=`echo -n $i | sed 's/\//\\\\\//g'`
|
||||||
inc="$templates_dir/$i"
|
inc="$templates_dir/$i"
|
||||||
cat "$buf" | \
|
cat "$buf" | \
|
||||||
sed "/<?fugitive\s\+include:$esc\s*?>/ {
|
sed "/<?fugitive[[:space:]]\+include:$esc[[:space:]]*?>/ {
|
||||||
r $inc
|
r $inc
|
||||||
d }" > "$buf2"
|
d }" > "$buf2"
|
||||||
tmpbuf="$buf"
|
tmpbuf="$buf"
|
||||||
|
@ -256,7 +256,7 @@ replace_foreach () {
|
||||||
fe="foreach:$1"
|
fe="foreach:$1"
|
||||||
cat > "$temp"
|
cat > "$temp"
|
||||||
cat "$temp" | \
|
cat "$temp" | \
|
||||||
sed -n "/<?fugitive\s\+$fe\s*?>/,/<?fugitive\s\+end$fe\s*?>/p" | \
|
sed -n "/<?fugitive[[:space:]]\+$fe[[:space:]]*?>/,/<?fugitive[[:space:]]\+end$fe[[:space:]]*?>/p" | \
|
||||||
tail -n +2 | head -n -1 > "$foreach_body"
|
tail -n +2 | head -n -1 > "$foreach_body"
|
||||||
if [ ! -s "$foreach_body" ]; then
|
if [ ! -s "$foreach_body" ]; then
|
||||||
cat "$temp"
|
cat "$temp"
|
||||||
|
@ -264,8 +264,8 @@ replace_foreach () {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
cat "$temp" | \
|
cat "$temp" | \
|
||||||
sed "s/<?fugitive\s\+$fe\s*?>/<?fugitive foreach_body ?>\n\0/" | \
|
sed "s/<?fugitive[[:space:]]\+$fe[[:space:]]*?>/<?fugitive foreach_body ?>\n\0/" | \
|
||||||
sed "/<?fugitive\s\+$fe\s*?>/,/<?fugitive\s\+end$fe\s*?>/d" | \
|
sed "/<?fugitive[[:space:]]\+$fe[[:space:]]*?>/,/<?fugitive[[:space:]]\+end$fe[[:space:]]*?>/d" | \
|
||||||
cat > "$tmpfile"
|
cat > "$tmpfile"
|
||||||
for i in `cat "$2"`; do
|
for i in `cat "$2"`; do
|
||||||
cat "$foreach_body" | replace_$1_info "$i"
|
cat "$foreach_body" | replace_$1_info "$i"
|
||||||
|
@ -287,7 +287,7 @@ generate_article() {
|
||||||
replace_str "blog_url" "$blog_url" | \
|
replace_str "blog_url" "$blog_url" | \
|
||||||
replace_commit_info "-1" | \
|
replace_commit_info "-1" | \
|
||||||
replace_article_info "$art" | \
|
replace_article_info "$art" | \
|
||||||
sed "/^\s*$/d" > "$public_dir/$art.html"
|
sed "/^[[:space:]]*$/d" > "$public_dir/$art.html"
|
||||||
if [ "$preproc" != "" ]; then mv "$preproc_bak" "$1"; fi
|
if [ "$preproc" != "" ]; then mv "$preproc_bak" "$1"; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ if [ $modification -gt 0 ]; then
|
||||||
replace_str "page_title" "archives" | \
|
replace_str "page_title" "archives" | \
|
||||||
replace_str "blog_url" "$blog_url" | \
|
replace_str "blog_url" "$blog_url" | \
|
||||||
replace_commit_info "-1" | \
|
replace_commit_info "-1" | \
|
||||||
sed "/^\s*$/d" > "$public_dir/archives.html"
|
sed "/^[[:space:]]*$/d" > "$public_dir/archives.html"
|
||||||
echo "done."
|
echo "done."
|
||||||
echo -n "[fugitive] Generating $public_dir/feed.xml... "
|
echo -n "[fugitive] Generating $public_dir/feed.xml... "
|
||||||
last_5_articles=`mktemp`
|
last_5_articles=`mktemp`
|
||||||
|
@ -375,7 +375,7 @@ if [ $modification -gt 0 ]; then
|
||||||
replace_str "page_title" "feed" | \
|
replace_str "page_title" "feed" | \
|
||||||
replace_str "blog_url" "$blog_url" | \
|
replace_str "blog_url" "$blog_url" | \
|
||||||
replace_commit_info "-1" | \
|
replace_commit_info "-1" | \
|
||||||
sed "/^\s*$/d" > "$public_dir/feed.xml"
|
sed "/^[[:space:]]*$/d" > "$public_dir/feed.xml"
|
||||||
echo "done."
|
echo "done."
|
||||||
rm "$last_5_articles" "$last_5_commits"
|
rm "$last_5_articles" "$last_5_commits"
|
||||||
echo -n "[fugitive] Using last published article as index page... "
|
echo -n "[fugitive] Using last published article as index page... "
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
replace_string() {
|
replace_string() {
|
||||||
sed "s/<?fugitive-install\s\+$1\s*?>/$2/"
|
sed "s/<?fugitive-install[[:space:]]\+$1[[:space:]]*?>/$2/"
|
||||||
}
|
}
|
||||||
|
|
||||||
fugitive_write_template() {
|
fugitive_write_template() {
|
||||||
|
|
Loading…
Reference in a new issue