wok-next view tazwikiss/stuff/var/www/wiki/plugins/wkp_Rss.sh @ rev 6021
Fix: scite (added glib-dev to build depends)
author | Alexander Medvedev <devl547@gmail.com> |
---|---|
date | Sun Aug 15 11:15:54 2010 +0000 (2010-08-15) |
parents | |
children |
line source
1 plugin="Rss"
2 description_fr="Génération d'un flux Rss des derniers changements"
3 description="Generate a Rss streams with last changes"
5 writedPage()
6 {
7 # Attention, bug si https ou port différent de 80 ?
8 ADR_ACCUEIL="http://$SERVER_NAME$SCRIPT_NAME"
9 CONTENT_RSS=""
10 for file in $(ls -l $PWD/$PAGES_DIR/*.txt 2> /dev/null | awk '{ print $9 }' | tail -n 10) ; do
11 filename=$(basename $file ".txt")
12 timestamp=$(filedate $file)
13 CONTENT="$CONTENT<a href=\"?page=$filename\">$filename</a> ($timestamp - <a href=\"./?page=$filename&action=diff\">diff</a>)<br />"
14 CONTENT_RSS="$CONTENT_RSS<item>
15 <title>$filename</title>
16 <pubDate>$timestamp</pubDate>
17 <link>$ADR_ACCUEIL?page=$(urlencode '$filename')</link>
18 <description>$filename $timestamp</description>
19 </item>"
20 done
21 sed -e "s#{WIKI_TITLE}#$WIKI_TITLE#" \
22 -e "s#{ADR_ACCUEIL}#$ADR_ACCUEIL#" \
23 -e "s#{LANG}#$LANG#" \
24 -e "s#{WIKI_DESCRIPTION}#Flux RSS de $WIKI_TITLE#" \
25 -e "s#{CONTENT_RSS}#$CONTENT_RSS#" > rss.xml <<EOT
26 <rss version="0.91">
27 <channel>
28 <title>{WIKI_TITLE}</title>
29 <link>{ADR_ACCUEIL}</link>
30 <description>{WIKI_DESCRIPTION}</description>
31 <language>{LANG}</language>
32 {CONTENT_RSS}
33 </channel>
34 </rss>
35 EOT
36 }
38 template()
39 {
40 html="$(sed 's#{RSS}#<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml" />#' <<EOT
41 $html
42 EOT
43 )"
44 return 0
45 }