On 4/3/2010 11:43 PM, Daniel Camargo wrote:
Hi everyone,
I was wondering if it's possible to create custom link macros like the ones we have for tickets (ie. #1, #2 e etc) for wiki pages.

I'm writing wiki pages to wikify my use cases, test cases and requirement and it would be nice if I could reference them just by adding UC#1, TC#1 and RQ#1.

Have you noticed the InterWiki [1] facility?
With a slightly different syntax, you can easily define such shortcuts (UC:1, TC:1, ...).

Simply add something like:

UC  /wiki/UC$1  # Use Case $1

to the InterMapTxt page (adjust the target as needed for your local installation).

If that's not enough and you need a more complex mapping (as seems to be the case from your UC0001-insert-users => UC#32 example), you need to write a small plugin adding a new custom syntax (IWikiSyntaxProvider [2]). You can then use trac.wiki.api.WikiSystem(env).get_pages(prefix='UC') [3], this should be pretty easy.



Imagine a ticket comment like:

The system should not allow to insert name with numbers, see UC#32 for more details.

This being equivalent to

The system should not allow to insert name with numbers, see [wiki:UC0001-insert-users UC#32] for more details.

Any ideas will be truly appreciated.


Hope this helped,

-- Christian

[1] - http://trac.edgewall.org/wiki/InterWiki
[2] - http://trac.edgewall.org/browser/trunk/sample-plugins/revision_links.py
[3] - http://trac.edgewall.org/browser/trunk/trac/wiki/api.py#L223

--
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to