--- a/mercurial/hgweb.py
+++ b/mercurial/hgweb.py
@@ -164,6 +164,8 @@ class templater:
common_filters = {
"escape": cgi.escape,
+ "strip": lambda x: x.strip(),
+ "rstrip": lambda x: x.rstrip(),
"age": age,
"date": lambda x: util.datestr(x),
"addbreaks": nl2br,