138 staticurl = (self.config('web', 'staticurl') |
138 staticurl = (self.config('web', 'staticurl') |
139 or req.apppath.rstrip('/') + '/static/') |
139 or req.apppath.rstrip('/') + '/static/') |
140 if not staticurl.endswith('/'): |
140 if not staticurl.endswith('/'): |
141 staticurl += '/' |
141 staticurl += '/' |
142 |
142 |
143 # some functions for the templater |
|
144 |
|
145 def motd(**map): |
|
146 yield self.config('web', 'motd') |
|
147 |
|
148 # figure out which style to use |
143 # figure out which style to use |
149 |
144 |
150 vars = {} |
145 vars = {} |
151 styles, (style, mapfile) = getstyle(req, self.config, |
146 styles, (style, mapfile) = getstyle(req, self.config, |
152 self.templatepath) |
147 self.templatepath) |
175 'logoimg': logoimg, |
170 'logoimg': logoimg, |
176 'staticurl': staticurl, |
171 'staticurl': staticurl, |
177 'urlbase': req.advertisedbaseurl, |
172 'urlbase': req.advertisedbaseurl, |
178 'repo': self.reponame, |
173 'repo': self.reponame, |
179 'encoding': encoding.encoding, |
174 'encoding': encoding.encoding, |
180 'motd': motd, |
|
181 'sessionvars': sessionvars, |
175 'sessionvars': sessionvars, |
182 'pathdef': makebreadcrumb(req.apppath), |
176 'pathdef': makebreadcrumb(req.apppath), |
183 'style': style, |
177 'style': style, |
184 'nonce': self.nonce, |
178 'nonce': self.nonce, |
185 } |
179 } |
|
180 templatekeyword = registrar.templatekeyword(defaults) |
|
181 @templatekeyword('motd', requires=()) |
|
182 def motd(context, mapping): |
|
183 yield self.config('web', 'motd') |
|
184 |
186 tres = formatter.templateresources(self.repo.ui, self.repo) |
185 tres = formatter.templateresources(self.repo.ui, self.repo) |
187 tmpl = templater.templater.frommapfile(mapfile, |
186 tmpl = templater.templater.frommapfile(mapfile, |
188 filters=filters, |
187 filters=filters, |
189 defaults=defaults, |
188 defaults=defaults, |
190 resources=tres) |
189 resources=tres) |