[PATCH] Include content of the news article in the website RSS
Fixes Trac ticket #844 --- Makefile | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index db2ac28..a22232c 100644 --- a/Makefile +++ b/Makefile @@ -19,19 +19,35 @@ htdocs/%.html: src/% src/%_title $(PAGE_DEPS) htdocs/main.rss: htdocs/index.html echo '<?xml version="1.0" encoding="UTF-8" ?>' > $@ - echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' >> $@ + echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $@ echo '<channel>' >> $@ echo ' <title>FFmpeg RSS</title>' >> $@ echo ' <link>http://ffmpeg.org</link>' >> $@ echo ' <description>FFmpeg RSS</description>' >> $@ echo ' <atom:link href="http://ffmpeg.org/main.rss" rel="self" type="application/rss+xml" />' >> $@ - grep '<a *id=".*" *></a><h3>.*20..,.*</h3>' $< | sed 'sX<a *id="\(.*\)" *> *</a> *<h3>\(.*20..\), *\(.*\)</h3>X\ + NSTART='' + while read line; do \ + if echo "$$line" | grep '<h1>Older entries are in the .*news archive' -q ; then \ + break; \ + fi; \ + if echo "$$line" | grep '<a *id=".*" *></a><h3>.*20..,.*</h3>' -q ; then \ + if [ $$NSTART ]; then \ + echo " ]]></content:encoded>" >> $@; \ + echo " </item>" >> $@ ; echo >> $@; \ + fi; \ + echo "$$line" | sed 'sX<a *id="\(.*\)" *> *</a> *<h3>\(.*20..\), *\(.*\)</h3>X\ <item>\ <title>\2, \3</title>\ <link>http://ffmpeg.org/index.html#\1</link>\ - <guid>http://ffmpeg.org/index.html#\1</guid>\ - </item>\ -X' >> $@ + <guid>http://ffmpeg.org/index.html#\1</guid>X' >> $@; \ + echo -n ' <content:encoded><![CDATA[' >> $@; \ + NSTART='yes'; \ + elif [ $$NSTART -a "$$line" ]; then \ + echo " $$line" >> $@; \ + fi; \ + done < $< + echo ' ]]></content:encoded>' >> $@ + echo ' </item>' >> $@ echo '</channel>' >> $@ echo '</rss>' >> $@ -- 1.8.4.5
On Thu, Apr 24, 2014 at 02:35:35AM +0200, Gerion Entrup wrote:
Fixes Trac ticket #844 --- Makefile | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
if someone reviews this, ill apply it [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates
Hi Gerion, AFAICT your patch would be OK to apply. I would make some minor adjustments about the variable naming and indentation, but do not bother I will do it on top your work. Regarding the warning of the content vs description fields as children of item, I do not think it should matter much as we previously had neither. Though while I was doing some tests and some cosmetics, I did some experimentation and came up with the attached alternative. What do you and/or others think of it? Besides validation I couldn't yet properly test what feed readers make of it. So please forgive me if it causes obvious problems with your reader. Alexander On 2014-04-24 02:35 +0200, Gerion Entrup wrote:
Fixes Trac ticket #844 --- Makefile | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile index db2ac28..a22232c 100644 --- a/Makefile +++ b/Makefile @@ -19,19 +19,35 @@ htdocs/%.html: src/% src/%_title $(PAGE_DEPS)
htdocs/main.rss: htdocs/index.html echo '<?xml version="1.0" encoding="UTF-8" ?>' > $@ - echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' >> $@ + echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $@ echo '<channel>' >> $@ echo ' <title>FFmpeg RSS</title>' >> $@ echo ' <link>http://ffmpeg.org</link>' >> $@ echo ' <description>FFmpeg RSS</description>' >> $@ echo ' <atom:link href="http://ffmpeg.org/main.rss" rel="self" type="application/rss+xml" />' >> $@ - grep '<a *id=".*" *></a><h3>.*20..,.*</h3>' $< | sed 'sX<a *id="\(.*\)" *> *</a> *<h3>\(.*20..\), *\(.*\)</h3>X\ + NSTART='' + while read line; do \ + if echo "$$line" | grep '<h1>Older entries are in the .*news archive' -q ; then \ + break; \ + fi; \ + if echo "$$line" | grep '<a *id=".*" *></a><h3>.*20..,.*</h3>' -q ; then \ + if [ $$NSTART ]; then \ + echo " ]]></content:encoded>" >> $@; \ + echo " </item>" >> $@ ; echo >> $@; \ + fi; \ + echo "$$line" | sed 'sX<a *id="\(.*\)" *> *</a> *<h3>\(.*20..\), *\(.*\)</h3>X\ <item>\ <title>\2, \3</title>\ <link>http://ffmpeg.org/index.html#\1</link>\ - <guid>http://ffmpeg.org/index.html#\1</guid>\ - </item>\ -X' >> $@ + <guid>http://ffmpeg.org/index.html#\1</guid>X' >> $@; \ + echo -n ' <content:encoded><![CDATA[' >> $@; \ + NSTART='yes'; \ + elif [ $$NSTART -a "$$line" ]; then \ + echo " $$line" >> $@; \ + fi; \ + done < $< + echo ' ]]></content:encoded>' >> $@ + echo ' </item>' >> $@ echo '</channel>' >> $@ echo '</rss>' >> $@
-- 1.8.4.5
alternative. What do you and/or others think of it?
Besides validation I couldn't yet properly test what feed readers make of it. So please forgive me if it causes obvious problems with your reader. (As said offline already) My reader works with it. It would be nice to set the
Am Donnerstag 01 Mai 2014, 23:48:29 schrieb Alexander Strasser: pubtime as well (an example: <pubDate>Wed, 07 May 2014 18:28:18 CEST</pubDate>). This command should work more less to build the date: date '+%a, %d %b %Y %T %Z' -d parsed_date (similar to date '+%c' btw) you have to keep in mind the locale, too. See here (http://cyber.law.harvard.edu/rss/rss.html#optionalChannelElements) for the spec. Gerion
On 2014-04-24 02:35 +0200, Gerion Entrup wrote:
Fixes Trac ticket #844 --- Makefile | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile index db2ac28..a22232c 100644 --- a/Makefile +++ b/Makefile @@ -19,19 +19,35 @@ htdocs/%.html: src/% src/%_title $(PAGE_DEPS)
htdocs/main.rss: htdocs/index.html echo '<?xml version="1.0" encoding="UTF-8" ?>' > $@ - echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' $@ + echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $@ echo '<channel>' >> $@ echo ' <title>FFmpeg RSS</title>' >> $@ echo ' <link>http://ffmpeg.org</link>' >> $@ echo ' <description>FFmpeg RSS</description>' >> $@ echo ' <atom:link href="http://ffmpeg.org/main.rss" rel="self" type="application/rss+xml" />' >> $@ - grep '<a *id=".*" *></a><h3>.*20..,.*</h3>' $< | sed 'sX<a *id="\(.*\)" *> *</a> *<h3>\(.*20..\), *\(.*\)</h3>X\ + NSTART='' + while read line; do \ + if echo "$$line" | grep '<h1>Older entries are in the .*news archive' -q ; then \ + break; \ + fi; \ + if echo "$$line" | grep '<a *id=".*" *></a><h3>.*20..,.*</h3>' - q ; then \ + if [ $$NSTART ]; then \ + echo " ]]></content:encoded>" >> $@; \ + echo " </item>" >> $@ ; echo >> $@; \ + fi; \ + echo "$$line" | sed 'sX<a *id="\(.*\)" *> *</a> *<h3>\(.*20..\), *\(.*\)</h3>X\ <item>\ <title>\2, \3</title>\ <link>http://ffmpeg.org/index.html#\1</link>\ - <guid>http://ffmpeg.org/index.html#\1</guid>\ - </item>\ -X' >> $@ + <guid>http://ffmpeg.org/index.html#\1</guid>X' >> $@; \ + echo -n ' <content:encoded><![CDATA[' >> $@; \ + NSTART='yes'; \ + elif [ $$NSTART -a "$$line" ]; then \ + echo " $$line" >> $@; \ + fi; \ + done < $< + echo ' ]]></content:encoded>' >> $@ + echo ' </item>' >> $@ echo '</channel>' >> $@ echo '</rss>' >> $@
Hi Gerion! On 2014-05-11 01:37 +0200, Gerion Entrup wrote:
Am Donnerstag 01 Mai 2014, 23:48:29 schrieb Alexander Strasser:
alternative. What do you and/or others think of it?
Besides validation I couldn't yet properly test what feed readers make of it. So please forgive me if it causes obvious problems with your reader. (As said offline already) My reader works with it.
I sent a new series for this: Subject: [PATCH 0/5] web: Extend RSS
It would be nice to set the pubtime as well (an example: <pubDate>Wed, 07 May 2014 18:28:18 CEST</pubDate>). This command should work more less to build the date: date '+%a, %d %b %Y %T %Z' -d parsed_date (similar to date '+%c' btw) you have to keep in mind the locale, too.
Good point. Actually I think I need to check where the time formatting code in my new patch is getting the locale from...
See here (http://cyber.law.harvard.edu/rss/rss.html#optionalChannelElements) for the spec.
[...] Alexander
Hi! On 2014-05-23 00:28 +0200, Alexander Strasser wrote:
On 2014-05-11 01:37 +0200, Gerion Entrup wrote:
Am Donnerstag 01 Mai 2014, 23:48:29 schrieb Alexander Strasser:
alternative. What do you and/or others think of it?
Besides validation I couldn't yet properly test what feed readers make of it. So please forgive me if it causes obvious problems with your reader. (As said offline already) My reader works with it.
My patch still works I think. I would like to commit it, though it won't be flexible enough to add much other stuff that needs more elaborate logic. I want to apply it, because it is a neat feature to have now. Any objections to this? In the not-so-short term I intend to widen security checks for the repo on the server to other files than just the Makefile. I already started this work, but need to fix one known problem before I can put it to work on the server.
I sent a new series for this:
Subject: [PATCH 0/5] web: Extend RSS
When what I described in the above paragraph is online, I could push the better solution that I quoted above. Alexander
It would be nice to set the pubtime as well (an example: <pubDate>Wed, 07 May 2014 18:28:18 CEST</pubDate>). This command should work more less to build the date: date '+%a, %d %b %Y %T %Z' -d parsed_date (similar to date '+%c' btw) you have to keep in mind the locale, too.
Good point. Actually I think I need to check where the time formatting code in my new patch is getting the locale from...
See here (http://cyber.law.harvard.edu/rss/rss.html#optionalChannelElements) for the spec.
[...]
On Thu, Aug 28, 2014 at 7:26 AM, Alexander Strasser <eclipse7@gmx.net> wrote:
Hi!
On 2014-05-23 00:28 +0200, Alexander Strasser wrote:
On 2014-05-11 01:37 +0200, Gerion Entrup wrote:
Am Donnerstag 01 Mai 2014, 23:48:29 schrieb Alexander Strasser:
alternative. What do you and/or others think of it?
Besides validation I couldn't yet properly test what feed readers make of it. So please forgive me if it causes obvious problems with your reader. (As said offline already) My reader works with it.
My patch still works I think. I would like to commit it, though it won't be flexible enough to add much other stuff that needs more elaborate logic. I want to apply it, because it is a neat feature to have now.
Good to hear you are still working on this.
Any objections to this?
LGTM from me, assuming it is tested and works. I slightly prefer your patch over Gerion's, but both are OK.
In the not-so-short term I intend to widen security checks for the repo on the server to other files than just the Makefile. I already started this work, but need to fix one known problem before I can put it to work on the server.
Yes, that would be much better. The awk and sed hack is getting too cumbersome. Or we could just change the server host. Timothy
On 2014-08-28 07:23 -0700, Timothy Gu wrote:
On Thu, Aug 28, 2014 at 7:26 AM, Alexander Strasser <eclipse7@gmx.net> wrote:
Hi!
On 2014-05-23 00:28 +0200, Alexander Strasser wrote:
On 2014-05-11 01:37 +0200, Gerion Entrup wrote:
Am Donnerstag 01 Mai 2014, 23:48:29 schrieb Alexander Strasser:
alternative. What do you and/or others think of it?
Besides validation I couldn't yet properly test what feed readers make of it. So please forgive me if it causes obvious problems with your reader. (As said offline already) My reader works with it.
My patch still works I think. I would like to commit it, though it won't be flexible enough to add much other stuff that needs more elaborate logic. I want to apply it, because it is a neat feature to have now.
Good to hear you are still working on this.
Any objections to this?
LGTM from me, assuming it is tested and works. I slightly prefer your patch over Gerion's, but both are OK.
Thanks. Pushed mine. Alexander
In the not-so-short term I intend to widen security checks for the repo on the server to other files than just the Makefile. I already started this work, but need to fix one known problem before I can put it to work on the server.
Yes, that would be much better. The awk and sed hack is getting too cumbersome. Or we could just change the server host.
participants (4)
-
Alexander Strasser -
Gerion Entrup -
Michael Niedermayer -
Timothy Gu