No Camel Case Parser

Description

Disables CamelCase links.

See FeatureRequests/DisableWikiNames, ParserMarket/NoCamelCase or ParserMarket/NoCamelCase2 for more details.

Download & Release Notes

Download

Release Version

Moin Version

Release Notes

nocamelcase.py

1.0

1.9

Installation

Put the file in the parser directory. See ParserMarket/InstallingParsers for details.

Usage

To use this parser, simply put "#!nocamelcase" after the beginning of the code block, or add "default_markup = 'nocamelcase'" to wikiconfig.py to apply this to all pages.

GUI mode

To work properly with GUI mode, you must modify some MoinMoin sources.

   1 diff -uNr MoinMoin.orig/action/edit.py MoinMoin/action/edit.py
   2 --- MoinMoin.orig/action/edit.py        2010-06-27 06:46:40.000000000 +0900
   3 +++ MoinMoin/action/edit.py     2012-02-08 15:42:46.000000000 +0900
   4 @@ -84,7 +84,7 @@
   5          if lasteditor == 'gui':
   6              # convert input from Graphical editor
   7              format = request.form.get('format', 'wiki')
   8 -            if format == 'wiki':
   9 +            if format == 'wiki' or format == 'nocamelcase':
  10                  converter_name = 'text_html_text_moin_wiki'
  11              else:
  12                  converter_name = 'undefined' # XXX we don't have other converters yet
  13 diff -uNr MoinMoin.orig/formatter/text_gedit.py MoinMoin/formatter/text_gedit.py
  14 --- MoinMoin.orig/formatter/text_gedit.py       2010-06-27 06:46:41.000000000 +0900
  15 +++ MoinMoin/formatter/text_gedit.py    2012-02-08 16:04:34.000000000 +0900
  16 @@ -109,7 +109,10 @@
  17      smiley = icon
  18 
  19      def nowikiword(self, text):
  20 -        return '<span style="background-color:#ffff11">!</span>' + self.text(text)
  21 +        if self.page.pi['format']=='nocamelcase':
  22 +            return self.text(text)
  23 +        else:
  24 +            return '<span style="background-color:#ffff11">!</span>' + self.text(text)
  25 
  26      # Dynamic stuff / Plugins ############################################
  27 
  28 diff -uNr MoinMoin.orig/theme/__init__.py MoinMoin/theme/__init__.py
  29 --- MoinMoin.orig/theme/__init__.py     2010-06-27 06:46:44.000000000 +0900
  30 +++ MoinMoin/theme/__init__.py  2012-02-08 16:10:10.000000000 +0900
  31 @@ -1232,7 +1240,7 @@
  32              The GUI editor currently only works for wiki format.
  33              For simplicity, we also tell it does not work if the admin forces the text editor.
  34          """
  35 -        is_wiki = page.pi['format'] == 'wiki'
  36 +        is_wiki = page.pi['format'] == 'wiki' or page.pi['format'] == 'nocamelcase'
  37          gui_disallowed = self.cfg.editor_force and self.cfg.editor_default == 'text'
  38          return is_wiki and not gui_disallowed
  39 
  40 diff -uNr MoinMoin.orig/wikiutil.py MoinMoin/wikiutil.py
  41 --- MoinMoin.orig/wikiutil.py   2010-06-27 06:46:46.000000000 +0900
  42 +++ MoinMoin/wikiutil.py        2012-02-08 16:15:24.000000000 +0900
  43 @@ -829,7 +829,8 @@
  44  def pagelinkmarkup(pagename, text=None):
  45      """ return markup that can be used as link to page <pagename> """
  46      from MoinMoin.parser.text_moin_wiki import Parser
  47 -    if re.match(Parser.word_rule + "$", pagename, re.U|re.X) and \
  48 +    # make link "[[PageName]]" even if its name is a CamelCase
  49 +    if False and re.match(Parser.word_rule + "$", pagename, re.U|re.X) and \
  50              (text is None or text == pagename):
  51          return pagename
  52      else:

Discussion

MoinMoin: ParserMarket/NoCamelCase1.9 (last edited 2012-02-08 07:43:32 by SixMen)