changeset 5858:be11f1e64e73

Page.py: added message with information about highlight regexp and link to non-highlighted version (disabled by default in config).
author Eugene Syromyatnikov <evgsyr@gmail.com>
date Mon, 21 May 2012 01:04:38 +0400
parents a89531afebe8
children 570e430cd08c
files MoinMoin/Page.py MoinMoin/config/multiconfig.py
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Sun May 20 22:59:04 2012 +0400
+++ b/MoinMoin/Page.py	Mon May 21 01:04:38 2012 +0400
@@ -1063,6 +1063,20 @@
                                           'error': wikiutil.escape(str(err)),
                                       }, "warning")
                 self.hilite_re = None
+            else:
+                if getattr(request.cfg, "show_highlight_msg", False):
+                    request.theme.add_msg(_(u'Text matching regular expression '
+                        '"%(regex)s" is highlighted. %(switch_link)s.') % {
+                            'regex': wikiutil.escape(self.hilite_re),
+                            'switch_link': ''.join([
+                                request.formatter.url(1, request.getQualifiedURL(
+                                   self.url(request, dict([i for i in
+                                   request.values.iteritems()
+                                   if i[0] != 'highlight'])))),
+                                _(u"Switch to non-highlighted view"),
+                                request.formatter.url(0)
+                            ])
+                        }, "info")
 
         if 'deprecated' in pi:
             # deprecated page, append last backup version to current contents
--- a/MoinMoin/config/multiconfig.py	Sun May 20 22:59:04 2012 +0400
+++ b/MoinMoin/config/multiconfig.py	Mon May 21 01:04:38 2012 +0400
@@ -946,7 +946,9 @@
         'up': ('page_parent_page', {}, _("Up"), "up"),
      },
      "dict of {'iconname': (url, title, icon-img-key), ...}. Available only in classic theme."),
-
+    ('show_highlight_msg', False, "Show message that page has highlighted text "
+                                  "and provide link to non-highlighted "
+                                  "version."),
   )),
   # ==========================================================================
   'editor': ('Editor related', None, (