changeset 21486:16352b34e32e

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.
author Steven Brown <StevenGBrown@gmail.com>
date Sat, 17 May 2014 17:10:23 +0800
parents ec273709c49e
children c26464ce0781
files mercurial/templates/atom/changelogentry.tmpl mercurial/templates/rss/changelogentry.tmpl mercurial/templates/rss/filelogentry.tmpl tests/test-hgweb-commands.t
diffstat 4 files changed, 22 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/atom/changelogentry.tmpl	Sat May 17 17:09:46 2014 +0800
+++ b/mercurial/templates/atom/changelogentry.tmpl	Sat May 17 17:10:23 2014 +0800
@@ -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>
--- a/mercurial/templates/rss/changelogentry.tmpl	Sat May 17 17:09:46 2014 +0800
+++ b/mercurial/templates/rss/changelogentry.tmpl	Sat May 17 17:10:23 2014 +0800
@@ -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>
--- a/mercurial/templates/rss/filelogentry.tmpl	Sat May 17 17:09:46 2014 +0800
+++ b/mercurial/templates/rss/filelogentry.tmpl	Sat May 17 17:10:23 2014 +0800
@@ -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>
--- a/tests/test-hgweb-commands.t	Sat May 17 17:09:46 2014 +0800
+++ b/tests/test-hgweb-commands.t	Sat May 17 17:10:23 2014 +0800
@@ -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>&#116;&#101;&#115;&#116;</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>