-
Notifications
You must be signed in to change notification settings - Fork 0
CategoryIndex
Generates an index of all pages with a particular attribute, using the inline python. Paste this into your page, and press Ctrl-E. If you add a 1: to it you could add it to a script library that you import.
Somewhere on your wiki page you should have [contact: work] to catch that page. You should replace 'contact' and 'work' with attributes and values that you use.
<%
values = pwiki.wikiData.getWordsWithPropertyValue('contact','work')
editor.GotoLine(2)
for val in values:
editor.AddText("%s\n" % val)
%>
This codes does not work with the new API use that one instead:
<%
values = [w for w, k, v in pwiki.wikiData.getPropertyTriples(None, "contact", "work")]
editor.GotoLine(2)
for val in values:
editor.AddText("%s\n" % val)
%>
Possible Problems:
- Make sure your text indentation is correct
I've tried the following code, but I'm getting the following error which I'm unsure how to fix.
Exception: global name 'pwiki' is not defined
If anyone has any ideas, please reply below. thanks!
When you copy/paste from Firefox, you have invalide end-of-line characters in wikidpad. You have to copy to the notepad, for example, and then paste it to Wikidpad. I've had the same problem as you and fixed it that way.
Hope this helps !
If you modify the one line as follows (see the added "[" and "]" the index will generate a proper page link even if the page name by itself is not a wikiword automatically by being written in camel case, i.e. your page name is like "Blog Notes" instead of "BlogNotes" in which former case the generated index does not have a clickable link, to-wit:
editor.AddText("[%s]\n" % val)
Source: http://trac.wikidpad2.webfactional.com/wiki/CategoryIndex