Show More
@@ -100,6 +100,13 b' def count(i):' | |||||
100 | """List or text. Returns the length as an integer.""" |
|
100 | """List or text. Returns the length as an integer.""" | |
101 | return len(i) |
|
101 | return len(i) | |
102 |
|
102 | |||
|
103 | @templatefilter('dirname') | |||
|
104 | def dirname(path): | |||
|
105 | """Any text. Treats the text as a path, and strips the last | |||
|
106 | component of the path after splitting by the path separator. | |||
|
107 | """ | |||
|
108 | return os.path.dirname(path) | |||
|
109 | ||||
103 | @templatefilter('domain') |
|
110 | @templatefilter('domain') | |
104 | def domain(author): |
|
111 | def domain(author): | |
105 | """Any text. Finds the first string that looks like an email |
|
112 | """Any text. Finds the first string that looks like an email |
@@ -2232,6 +2232,10 b' Filename filters:' | |||||
2232 |
|
2232 | |||
2233 | $ hg debugtemplate '{"foo/bar"|basename}|{"foo/"|basename}|{"foo"|basename}|\n' |
|
2233 | $ hg debugtemplate '{"foo/bar"|basename}|{"foo/"|basename}|{"foo"|basename}|\n' | |
2234 | bar||foo| |
|
2234 | bar||foo| | |
|
2235 | $ hg debugtemplate '{"foo/bar"|dirname}|{"foo/"|dirname}|{"foo"|dirname}|\n' | |||
|
2236 | foo|foo|| | |||
|
2237 | $ hg debugtemplate '{"foo/bar"|stripdir}|{"foo/"|stripdir}|{"foo"|stripdir}|\n' | |||
|
2238 | foo|foo|foo| | |||
2235 |
|
2239 | |||
2236 | Add a dummy commit to make up for the instability of the above: |
|
2240 | Add a dummy commit to make up for the instability of the above: | |
2237 |
|
2241 |
General Comments 0
You need to be logged in to leave comments.
Login now