[Moin-user] Various newbie questions about links

Nir Soffer nirs at actcom.net.il
Thu Aug 11 03:57:05 EDT 2005


On 11 Aug, 2005, at 3:34, Kenneth McDonald wrote:

> Since this will be a corporate web site, we need to keep a certain 
> amount of control over the site. In addition, we want to make sure the 
> site looks "clean", i.e. not a wiki*; this will keep new users from 
> being confused by the naming, and also (we hope) keep the 
> documentation in a format that might translate over to a book at some 
> point.

You want to use this theme: 
http://moinmoin.wikiwikiweb.de/ModernCmsTheme

> So, the questions:
>
> 1) I'll be disabling CamelCasing, both because we prefer the visuals 
> of ["Titles with Spaces"], and because our product has controls with 
> names like 'SetVal Off', which really wouldn't be nice to use with 
> camel case on. As far as I can tell, the best way to do this is to 
> copy Parser/wiki.py into the plugins directory, and modify it by 
> stripping out the appropriate regex. Are there better ways of doing 
> this? Any subtleties I should be aware of?

You want to use this parser: 
http://moinmoin.wikiwikiweb.de/ParserMarket/NoCamelCase

> 2) We'd like to be able to organize things hierarchically (eg. 
> ["Ref/Controls/Edit Menu/Paste"]), but to be able to refer to certain 
> things via a shorthand (eg., ["Edit:Paste"] might be a shortcut for 
> the above link.) Is there some way of doing this in MoinMoin? If not, 
> is writing a macro the best way to do this? (I've just barely looked 
> at writing macros.) I suppose it could be done by creating "shortcut 
> pages" which simply include the "official page", but perhaps there's a 
> more elegant (and less labor-intensive way) of doing this?

It depends where the link is. On Ref/Controls, the link would be 
["/Edit Menu/Paste"], and on Ref/Controls/Edit Menu, ["/Paste"].

If you want to refer to the page with a shorter name, use the ugly (but 
effective) [:Ref/Controls/Edit Menu/Paste:Edit:Paste] link format.

> 3) In a similar vein to the above question, we'd also like to be able 
> to put arbitrary text in a link, rather than displaying the link text; 
> for example, [[Link(Go here for info, Ref/Controls/Edit Menu/Paste)]] 
> might be a link to the indicated page, but display on the screen with 
> just the text "Go here for info".

See above.

> 4) We'll be keeping edit control over quite a few of the pages to 
> ourselves, but will be allowing users to add comments to a comments 
> page that is inlined via the Include macro. Ideally, we'd like the 
> comments section of a page to be presented in a different style, say 
> with an outline and a slightly different background shade. I know I 
> can probably accomplish this by developing a new macro starting from 
> the Include codebase, but was wondering if there's a simpler way.

I'm also interested with such addition. Here is the solution I thought 
about.

You can use include on the page to get the content from an included sub 
page. To add comments, the simplest thing would be adding a edit link 
to the comment page, like its done here: 
http://moinmoin.wikiwikiweb.de/SimpleBlog/

But if you don't want people to edit each other comments, you don't 
want to use it. You can create a macro which write a form that send the 
comment text to an action, which append the comment to the text of the 
comment page. You can see how to do this here: 
http://moinmoin.wikiwikiweb.de/MoinDev/Storage

You may want to add an acl right named "comment" in your config:
	acl_rights_valid = ["read", "write", "delete", "revert", "admin", 
"comment"]

And add "comment" right for All:
	acl_right_default = u"read,comment"

Now all your pages will be comment-able, unless they have custom acl 
that does not include the "comment" right. To let people comment, you 
will add a [[Comment]] macro.

Comment pages will use this #acl (you don't want comment pages for 
comment pages):
#acl All:read

The tricky part is using PageEditor.saveText to save comment pages. It 
includes acl checking that will not let you save pages without "write" 
right, or worse, add the needed acl on new page without "admin" right. 
The best solution is to create a sub class of PageEditor, maybe 
CommentEditor, that override saveText, with a version that let you 
write to a comment page without "write" acl. The "comment" action will 
use this class to add comments.


Best Regards,

Nir Soffer





More information about the Moin-user mailing list