Mercurial > moin > 1.9
changeset 5297:44dca95e51ab
parser highlight: enables link to help page for messages
author | Reimar Bauer <rb.proj AT googlemail DOT com> |
---|---|
date | Fri, 20 Nov 2009 09:28:49 +0100 |
parents | 5830f61d4718 |
children | d57b74bc4cbd |
files | MoinMoin/formatter/text_html.py MoinMoin/parser/highlight.py |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/formatter/text_html.py Thu Nov 19 17:47:24 2009 +0100 +++ b/MoinMoin/formatter/text_html.py Fri Nov 20 09:28:49 2009 +0100 @@ -888,7 +888,8 @@ if msg: attr = {'class': 'codemsg'} res.append(self._open('div', attr={'class': 'codemsg'})) - res.append(self.text(msg)) + # the msg string is not escaped + res.append(msg) res.append(self._close('div')) # Open the code div - using left to right always!
--- a/MoinMoin/parser/highlight.py Thu Nov 19 17:47:24 2009 +0100 +++ b/MoinMoin/parser/highlight.py Fri Nov 20 09:28:49 2009 +0100 @@ -14,9 +14,10 @@ import pygments.formatter from pygments.token import Token -from MoinMoin import config +from MoinMoin import config, wikiutil from MoinMoin.parser import parse_start_step from MoinMoin.support.python_compatibility import hash_new +from MoinMoin.Page import Page Dependencies = [] extensions = [] @@ -150,8 +151,13 @@ try: lexer = pygments.lexers.get_lexer_by_name(self.syntax) except pygments.util.ClassNotFound: - msg = _("Syntax highlighting not supported for '%(syntax)s', see %(highlight_help_page)s.") % {"syntax": self.syntax, - "highlight_help_page": "HelpOnParsers" + f = self.request.formatter + url = ''.join([ + f.url(1, href=Page(self.request, _("HelpOnParsers")).url(self.request, escape=0)), + _("HelpOnParsers"), + f.url(0)]) + msg = _("Syntax highlighting not supported for '%(syntax)s', see %(highlight_help_page)s.") % {"syntax": wikiutil.escape(self.syntax), + "highlight_help_page": url } lexer = pygments.lexers.TextLexer() fmt.result.append(formatter.code_area(1, self._code_id, self.parsername, self.show_nums, self.num_start, self.num_step, msg))