diff extensions/kwarchive.py @ 72:7484b3254940

Added a new "filter" for $Author$: filter nothing and print the complete Mercurial user information as one word
author Franz Glasner <hg@dom66.de>
date Tue, 28 Nov 2017 00:30:02 +0100
parents d0a1521cb164
children 8e77ed36c333
line wrap: on
line diff
--- a/extensions/kwarchive.py	Mon Nov 27 16:16:24 2017 +0100
+++ b/extensions/kwarchive.py	Tue Nov 28 00:30:02 2017 +0100
@@ -121,6 +121,7 @@
     :``user``:    the short representation of a user name or email address
     :``person``:  the name before an email address as per RFC 5322
     :``email``:   the email address
+    :``none``:    the complete user information w/o filtering
 
     Returns 0 on success.
 
@@ -203,6 +204,7 @@
     :``user``:    the short representation of a user name or email address
     :``person``:  the name before an email address as per RFC 5322
     :``email``:   the email address
+    :``none``:    the complete user information w/o filtering
 
     Returns 0 on success.
 
@@ -350,6 +352,8 @@
         keywords["Author"] = templatefilters.utf8(templatefilters.person(ctx.user()).replace(' ', '+'))
     elif user_filter == "email":
         keywords["Author"] = templatefilters.email(ctx.user())
+    elif user_filter == "none":
+        keywords["Author"] = templatefilters.utf8(ctx.user().replace(' ', '+'))
 
     return keywords
 
@@ -366,6 +370,6 @@
 
 def get_checked_user_filter(opts):
     uf = opts.get("user_filter")
-    if not uf in ("person", "user", "email"):
+    if not uf in ("person", "user", "email", "none"):
         raise error.Abort(_("user filter must be any of `user', `person' or `email'"))
     return uf