Short description

As a newbie to MoinMoin, my introduction to "WikiNames" (this automatic creation of a hyperlink from any word in CamelCase form) did not go pleasantly. It came as twenty minutes of frustration (because at first I thought the GUI mode of the editor had a bug), followed by another twenty minutes of research in the help files (funny how the FAQ doesn't say much about it), followed by an hour of placing exclamation points throughout my Wiki pages (on my initial three pages of Wiki content).

Perhaps this WikiName feature is helpful to some, but for my needs it hinders far more than it helps. A search on CamelCase shows that it is a real bone of contention for a number of other folks too.

My request: Add a pragma that enables the author to either turn it on or off (on a per-page basis).

I offer my proof-of-concept code as a prototype (FeatureRequests-PragmaCamelCase-text_moin_wiki.py). The coding changes are trivial. I've implemented them into my copy of v1.8.0.

(1) Only file text_moin_wiki.py in directory parser needs to be changed.

(2) Add a flag member to class Parser (for this example, call it autocamellink); have it initialized to True (or 1) on instantiation so that WikiName is enabled by default.

(3) In method !_!_init!_!_ of class Parser, add code to read in the pragma to control WikiName (for this example, it is pragma camel), such as:

        if self.request.getPragma('camel','') in ['off']:
            self.autocamellink = 0

(4) In method _word_repl of class Parser, add code that sets flag bang_present to True if the pragma disables WikiName. It can be placed immediately after the statement bang_present = groups.get('word_bang'):

        if not bang_present:
            bang_present = (self.autocamellink == 0)

(5) With these code changes, one could place the pragma into the header to enable or disable WikiName on a per-page basis.

#pragma camel off

MountainPeaks not made a link unless pragma camel is on.

(6) One can still use the double brackets syntax to make a WikiName into a link.

#pragma camel off

MountainPeaks not a link because pragma camel is off.

[[RiverValley]] however will is still a link no matter the setting.

Discussion

Discussion - Additional ideas from submitter

Half a patch for 1.8

camelcase_setting.diff

Problems left:


CategoryFeatureRequest

MoinMoin: FeatureRequests/PragmaCamelCase (last edited 2008-11-30 01:26:35 by ThomasWaldmann)