# HG changeset patch # User Steven Brown <StevenGBrown@gmail.com> # Date 1400317823 -28800 # Sat May 17 17:10:23 2014 +0800 # Node ID 16352b34e32e40faab60fef8a0e533759e7a73fe # Parent ec273709c49e3da28953470a9f22e99660479190 hgweb: apply websub filter to the changeset description in rss and atom feeds For example, this is useful for linking from the feed reader to a bug tracker. This follows the existing pattern used within the hgweb templates. With the exception of the raw style, all usages of the changeset "desc" keyword are now followed by either the "firstline" filter or the "websub" filter. When "websub" is used, it always follows the "escape" filter. diff --git a/mercurial/templates/atom/changelogentry.tmpl b/mercurial/templates/atom/changelogentry.tmpl --- a/mercurial/templates/atom/changelogentry.tmpl +++ b/mercurial/templates/atom/changelogentry.tmpl @@ -32,7 +32,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>{desc|strip|escape|addbreaks|nonempty}</td> + <td>{desc|strip|escape|websub|addbreaks|nonempty}</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> diff --git a/mercurial/templates/rss/changelogentry.tmpl b/mercurial/templates/rss/changelogentry.tmpl --- a/mercurial/templates/rss/changelogentry.tmpl +++ b/mercurial/templates/rss/changelogentry.tmpl @@ -27,7 +27,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>{desc|strip|escape|addbreaks|nonempty}</td> + <td>{desc|strip|escape|websub|addbreaks|nonempty}</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> diff --git a/mercurial/templates/rss/filelogentry.tmpl b/mercurial/templates/rss/filelogentry.tmpl --- a/mercurial/templates/rss/filelogentry.tmpl +++ b/mercurial/templates/rss/filelogentry.tmpl @@ -1,7 +1,7 @@ <item> <title>{desc|strip|firstline|strip|escape}</title> <link>{urlbase}{url|urlescape}log{node|short}/{file|urlescape}</link> - <description><![CDATA[{desc|strip|escape|addbreaks|nonempty}]]></description> + <description><![CDATA[{desc|strip|escape|websub|addbreaks|nonempty}]]></description> <author>{author|obfuscate}</author> <pubDate>{date|rfc822date}</pubDate> </item> diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t +++ b/tests/test-hgweb-commands.t @@ -36,6 +36,8 @@ > default.width = 3 > stable.width = 3 > stable.color = FF0000 + > [websub] + > append = s|(.*)|\1(websub)| > EOF $ hg serve --config server.uncompressed=False -n test -p $HGPORT -d --pid-file=hg.pid -E errors.log @@ -98,7 +100,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>branch commit with null character: </td> + <td>branch commit with null character: (websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -141,7 +143,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>branch</td> + <td>branch(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -184,7 +186,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>Added tag 1.0 for changeset 2ef0ac749a14</td> + <td>Added tag 1.0 for changeset 2ef0ac749a14(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -227,7 +229,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>base</td> + <td>base(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -278,7 +280,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>branch commit with null character: </td> + <td>branch commit with null character: (websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -318,7 +320,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>branch</td> + <td>branch(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -358,7 +360,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>Added tag 1.0 for changeset 2ef0ac749a14</td> + <td>Added tag 1.0 for changeset 2ef0ac749a14(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -398,7 +400,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>base</td> + <td>base(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -458,7 +460,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>Added tag 1.0 for changeset 2ef0ac749a14</td> + <td>Added tag 1.0 for changeset 2ef0ac749a14(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -501,7 +503,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>base</td> + <td>base(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -552,7 +554,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>Added tag 1.0 for changeset 2ef0ac749a14</td> + <td>Added tag 1.0 for changeset 2ef0ac749a14(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -592,7 +594,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>base</td> + <td>base(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -650,7 +652,7 @@ </tr> <tr> <th style="text-align:left;vertical-align:top;">description</th> - <td>base</td> + <td>base(websub)</td> </tr> <tr> <th style="text-align:left;vertical-align:top;">files</th> @@ -675,7 +677,7 @@ <item> <title>base</title> <link>http://*:$HGPORT/log2ef0ac749a14/foo</link> (glob) - <description><![CDATA[base]]></description> + <description><![CDATA[base(websub)]]></description> <author>test</author> <pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> </item> @@ -862,7 +864,7 @@ number or hash, or <a href="/help/revsets">revset expression</a>.</div> </form> - <div class="description">base</div> + <div class="description">base(websub)</div> <table id="changesetEntry"> <tr> @@ -1284,7 +1286,7 @@ number or hash, or <a href="/help/revsets">revset expression</a>.</div> </form> - <div class="description">Added tag 1.0 for changeset 2ef0ac749a14</div> + <div class="description">Added tag 1.0 for changeset 2ef0ac749a14(websub)</div> <table id="changesetEntry"> <tr> @@ -1408,7 +1410,7 @@ number or hash, or <a href="/help/revsets">revset expression</a>.</div> </form> - <div class="description">branch</div> + <div class="description">branch(websub)</div> <table id="changesetEntry"> <tr>