patched by Julio B <julio.bacel@gmail.com> to escape xml in feeds
This commit is contained in:
parent
fca7fa9296
commit
ef2d799e81
6
bin/atom
6
bin/atom
|
@ -22,13 +22,15 @@ if [ "$run_user" -eq 0 ]; then
|
|||
printf "<id>gopher://cosmic.voyage/</id>\\n"
|
||||
} > "${gopher_atom}"
|
||||
|
||||
xml_escape_script='s/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g'
|
||||
|
||||
# Loop through listings gophermap
|
||||
loop=0
|
||||
while read -r line; do
|
||||
loop=$((loop+1))
|
||||
if [ "$loop" -lt 20 ]; then
|
||||
log=$(printf "%s" "$line" | awk -F'\t' '{print $2}')
|
||||
title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed 's|^.||')
|
||||
title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed -e 's|^.||' -e "$xml_escape_script")
|
||||
owner=$(stat -c %U "/var/gopher${log}")
|
||||
|
||||
# print item entry for each log
|
||||
|
@ -42,7 +44,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
printf " <id>gopher://cosmic.voyage/0%s</id>\\n" "$(printf "%s" "$log" | sed 's|\ |%20|g')"
|
||||
printf " <updated>%s</updated>\\n" "$(date -d "$(stat -c %y "/var/gopher${log}")" +'%Y-%m-%dT%H:%M:%SZ')"
|
||||
printf " <content type=\"html\"><![CDATA[<pre>\\n"
|
||||
sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' "/var/gopher${log}"
|
||||
sed "$xml_escape_script" "/var/gopher${log}"
|
||||
printf "</pre>]]></content>\\n"
|
||||
printf "</entry>\\n"
|
||||
|
||||
|
|
5
bin/rss
5
bin/rss
|
@ -17,6 +17,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
printf "<description>Messages from the human stellar diaspora</description>\\n"
|
||||
} > "${gopher_rss}"
|
||||
|
||||
xml_escape_script='s/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g'
|
||||
|
||||
# Loop through listings gophermap
|
||||
loop=0
|
||||
|
@ -24,7 +25,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
loop=$((loop+1))
|
||||
if [ "$loop" -lt 20 ]; then
|
||||
log=$(printf "%s" "$line" | awk -F'\t' '{print $2}')
|
||||
title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed 's|^.||')
|
||||
title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed -e 's|^.||' -e "$xml_escape_script")
|
||||
owner=$(stat -c %U "/var/gopher${log}")
|
||||
|
||||
# print item entry for each log
|
||||
|
@ -36,7 +37,7 @@ if [ "$run_user" -eq 0 ]; then
|
|||
printf " <guid>gopher://cosmic.voyage/0%s</guid>\\n" "$(printf "%s" "$log" | sed 's|\ |%20|g')"
|
||||
printf " <pubDate>%s GMT</pubDate>\\n" "$(date -d "$(stat -c %y "/var/gopher${log}")" +'%a, %d %b %Y %H:%M:%S')"
|
||||
printf " <description><![CDATA[<pre>\\n"
|
||||
sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' "/var/gopher${log}"
|
||||
sed "$xml_escape_script" "/var/gopher${log}"
|
||||
printf "</pre>]]></description>\\n"
|
||||
printf "</item>\\n"
|
||||
} >> "${gopher_rss}"
|
||||
|
|
Loading…
Reference in New Issue