projects
/
populate.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
517f149
)
ampersand management added
v0.1.4
author
Matteo Nastasi
<nastasi@alternativeoutput.it>
Sun, 5 Feb 2012 16:58:52 +0000
(17:58 +0100)
committer
Matteo Nastasi
<nastasi@alternativeoutput.it>
Sun, 5 Feb 2012 16:58:52 +0000
(17:58 +0100)
populate.sh
patch
|
blob
|
history
diff --git
a/populate.sh
b/populate.sh
index
6dec3fa
..
e39c3cd
100755
(executable)
--- a/
populate.sh
+++ b/
populate.sh
@@
-1,6
+1,6
@@
#!/bin/bash
# set -x
#!/bin/bash
# set -x
-
+# export PS4='+${BASH_SOURCE}:${LINENO}:${FUNCNAME[0]}: '
#
# populate.sh
#
#
# populate.sh
#
@@
-99,7
+99,7
@@
function unsedify() {
else
cat
fi
else
cat
fi
- ) | sed 's/\(["\\\/\$]\)/\\\1/g'
+ ) | sed 's/\(["\\\/\$
&
]\)/\\\1/g'
return 0
}
return 0
}
@@
-113,7
+113,7
@@
function formatify() {
fi
) | (
if [ "$1" = "tex" ]; then
fi
) | (
if [ "$1" = "tex" ]; then
- sed 's/à/\\`a/g;s/è/\\`e/g;s/ì/\\`i/g;s/ò/\\`o/g;s/ù/\\`u/g;s/áéíóú/\\'"'"'a/g;
+ sed 's/
&/\\&/g;s/
à/\\`a/g;s/è/\\`e/g;s/ì/\\`i/g;s/ò/\\`o/g;s/ù/\\`u/g;s/áéíóú/\\'"'"'a/g;
s/é/\\'"'"'e/g;s/í/\\'"'"'i/g;s/ó/\\'"'"'o/g;s/ú/\\'"'"'u/g;s/°/\$\^\\circ\$/g;
s/<i>/\\textit{/g;s/<b>/\\textbf{/g;s/<\/[ib]>/}/g;
s/<url>/\n<url>\n/g;s/<\/url>/\n<\/url>\n/g;' | \
s/é/\\'"'"'e/g;s/í/\\'"'"'i/g;s/ó/\\'"'"'o/g;s/ú/\\'"'"'u/g;s/°/\$\^\\circ\$/g;
s/<i>/\\textit{/g;s/<b>/\\textbf{/g;s/<\/[ib]>/}/g;
s/<url>/\n<url>\n/g;s/<\/url>/\n<\/url>\n/g;' | \
@@
-121,7
+121,7
@@
function formatify() {
sed 's/<url>/URL: \\textit\{/g;s/<\/url>/\}/g;
s/“/``/g;s/”/'"''"'/g;s/<lang:tex>//g;s/<\/lang:tex>//g;s/<lang:[^>]*>.*<\/lang:[^>]*>//g'
elif [ "$1" = "htm" ]; then
sed 's/<url>/URL: \\textit\{/g;s/<\/url>/\}/g;
s/“/``/g;s/”/'"''"'/g;s/<lang:tex>//g;s/<\/lang:tex>//g;s/<lang:[^>]*>.*<\/lang:[^>]*>//g'
elif [ "$1" = "htm" ]; then
- sed "s/${NEWLI}${NEWLI}/<br>${NEWLI}/g;"'
+ sed "s/
&/&/g;s/
${NEWLI}${NEWLI}/<br>${NEWLI}/g;"'
s/<url>\([^<]*\)<\/url>/<a href="\1">\1<\/a>/g;
s/<lang:htm>//g;s/<\/lang:htm>//g;s/<lang:[^>]*>.*<\/lang:[^>]*>//g'
fi
s/<url>\([^<]*\)<\/url>/<a href="\1">\1<\/a>/g;
s/<lang:htm>//g;s/<\/lang:htm>//g;s/<lang:[^>]*>.*<\/lang:[^>]*>//g'
fi
@@
-278,7
+278,7
@@
function populator() {
done
fi
tag_val="`echo "${!tag_ele}" | sed "s/\$/$NEWLI/g" | tr -d '\n' | sed "s/$NEWLI\$//g" \
done
fi
tag_val="`echo "${!tag_ele}" | sed "s/\$/$NEWLI/g" | tr -d '\n' | sed "s/$NEWLI\$//g" \
- | formatify
$frmt
`"
+ | formatify
"$frmt"
`"
debecho " tag_val: $tag_val"
# TAG replacement
debecho " tag_val: $tag_val"
# TAG replacement
@@
-343,7
+343,7
@@
function populator() {
done
# TAG replacement
tag_val="`echo "${!tag_ele}" | sed "s/\$/$NEWLI/g" | tr -d '\n' | sed "s/$NEWLI\$//g" \
done
# TAG replacement
tag_val="`echo "${!tag_ele}" | sed "s/\$/$NEWLI/g" | tr -d '\n' | sed "s/$NEWLI\$//g" \
- | formatify
$frmt
| unsedify`"
+ | formatify
"$frmt"
| unsedify`"
cat $TMP3FILE | sed "s/#${tag_var}#/$tag_val/g" >$TMP4FILE
cat $TMP3FILE | sed "s/#${tag_var}#/$tag_val/g" >$TMP4FILE