RSS page for tags (and other pages)

Angel Ezquerra angel.ezquerra at gmail.com
Fri Nov 30 15:54:41 CST 2012


On Fri, Nov 30, 2012 at 8:15 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Fri, 2012-11-30 at 00:37 +0100, Angel Ezquerra wrote:
>> On Thu, Nov 29, 2012 at 8:53 PM, Matt Mackall <mpm at selenic.com> wrote:
>> > On Thu, 2012-11-29 at 17:55 +0100, Angel Ezquerra wrote:
>> >> Hi,
>> >>
>> >> today, playing around with the rss web.style I noticed that it is
>> >> possible for hgweb to generate an RSS feed that only shows the tagged
>> >> the revisions for example, if you select the "rss" style.
>> >>
>> >> However, if you click on the RSS or Atom button that is located on the
>> >> tags page you get an RSS feed of all the revisions, not of the tagged
>> >> revisions as could be expected. That button links to {url}rss-log. I
>> >> tried manually going to {url}rss-log/tags or even {url}/tags/rss-log
>> >> but that does not work.
>> >>
>> >> I looked for "rss-log" on the mercurial source code but I did not find
>> >> any references to it except on the template files. I'd like to fix
>> >> this issue since I think it would be nice to be able to "subscribe" to
>> >> a tag page and get notifications whenever someone adds a new tag, for
>> >> example. You could even suscribe to a file and be notified when the
>> >> file is modified, etc, which I think would be really powerful.
>> >>
>> >> Does someone have an idea of where is the "rss-log" handled?
>> >> Alternatively, is there a way to ask the web server to serve a page as
>> >> if the "rss" web style had been selected?
>> >
>> > Internally, hgweb has no special support for RSS. It's simply a style.
>> > The rss-log/ link is in the form [<style>-]<page>/.
>> >
>> > Implementing RSS for tags is probably a matter of copying
>> > templates/rss/log.tmpl to tags.tmpl, fixing it up, and editing the other
>> > templates that link to it. Same for atom. Consult paper/tags.tmpl to see
>> > what sort of data is available in the tags page context.
>>
>> Thank you Matt,
>>
>> I was not aware of the "[<style>-]<page>" syntax, which is great.
>>
>> One problem that I see is that the RSS and Atom links are created by
>> the footer template, which is not aware (AFAIK) of the name of the
>> current file (i.e. whether it is the "log", "tags" or "bookmarks"
>> page, for example). Is there some way to pass that information to the
>> footer.tmpl when it is inserted on tags.tmpl for example?
>
> I see. You're probably looking at the gitweb style.
>
> As it happens, the standard style (paper) already has tags RSS support:
>
> http://www.selenic.com/hg/tags
>
> ..and has since it was introduced in 2008.
>

Sorry Matt, but I don't understand what you mean.

The paper style does not have any RSS or Atom links as far as I can
see. The gitweb and monoblue styles have a tags page and that page has
RSS and Atom links at the bottom. However those RSS links do not point
to a feed of the repository tags, but to a feed of the repository
revisions.

What I want to achieve is to make the RSS links "context aware" so
that users can subscribe to the different pages. For example,
subscribing to the RSS link on the tag page would let you be notified
whenever a new tag were created on a particular repository.

In order to do this I have two problems:

1. the RSS and Atom links are added by the footer template (at least
that is the case for the gitweb and the monoblue styles). The
footer.tmpl file contains the following code:

        <ul class="rss-logo">
            <li><a href="{url}rss-log">RSS</a></li>
            <li><a href="{url}atom-log">Atom</a></li>
        </ul>

That is, the "-log" part is hard coded, so all RSS and Atom links on
all pages link to the "global" log feed, rather than to the specific
feed for the current page (i.e. rss-tags for tags, rss-bookmarks,
etc).

What I'd like to do is to somehow tell the footer.tmpl that it should
link to another rss feed. Something such as:

            <li><a href="{url}rss-{page}">RSS</a></li>

The footer is inserted on the tags.tmpl (for example) by simply doing: {footer}
Is it possible to do something like: "{page:tags%footer}" or something
of the sort to tell the footer.tmpl which page is using it?

2. The tags page for the RSS style does not show the description for
the tag revision. The rss tagentry.tmpl contains the following code:

<description><![CDATA[{tag|strip|escape|addbreaks}]]></description>

I tried to change it to:

<description>
<![CDATA[{tag|strip|escape|addbreaks}]]>
<![CDATA[{desc|strip|escape|addbreaks|nonempty}]]>
</description>

which is what is done on the changelogentry.tmpl, but that does not
work. It seems that the tags.tmpl is not aware of the "desc" field. I
also don't really understand the CDATA part. I did not find references
to it on the mercurial source code either.

Maybe these are basic questions. If there is some documentation or
somewhere where I can learn more about the templater please let me
know. I think fixing these would make the RSS capabilities of
mercurial more flexible and powerful.

Thanks,

Angel


More information about the Mercurial-devel mailing list