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).
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.
camel should be renamed to camelcase or something else
- seeing a patch would be better
- also for the gui editor
Discussion - Additional ideas from submitter
suggestion: rename camel to wikiname
allow these settings for #pragma wikiname: on, off, and auto
on = (default) behavior as is currently the standard (WikiName feature is enabled)
off = WikiName feature is disabled
The auto setting will allow each page to have a dynamically built list of bona fide WikiNames; whenever the software recognizes a WikiName (per the current pattern-matching rules) between double-brackets, it adds that WikiName to this list. Thereafter, any WikiName outside of double brackets which is a member of that list is made into a link (WikiName feature selectively enabled). In practice, the author encloses a WikiName in double-brackets once (towards the start of the page), and a link is made for that WikiName wherever else it may appear afterwards in that page.
Half a patch for 1.8
if you enter a CamelCase link in the gui editor, it won't be converted to correct link markup if link_camelcase is False
- wikiutil.pagelink_markup does not have a request param, thus can't create the correct link without an api change (adding request param)
- ... maybe more related stuff ...