Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>

[[ 🗃 ^yEzqv rel4tion-wiki ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/yEzqv

SSH: git clone USERNAME@vervis.peers.community:yEzqv

Branches

Tags

master :: editing / help /

selector-pages.mdwn

Sometimes it is useful to have a list of all items of a certain kind, or items for which a certain condition holds. It is somewhat like a database query: Give me all items for which the following condition is true. This is what selector pages do.

On the formal level, assume we have a set of items. Let’s call it S. The set is initially empty, but then it begins to change: Sometimes an item gets added to it. Sometimes an item gets deleted. These events are not automatic and not predicted. They just happen, e.g. maybe people trigger them by doing specific actions. It is then useful to have a list of the items S contains, which gets updated automatically every time an item is added or removed.

Selector pages use the [[ikiwiki/directive/inline]] directive, which basically pastes one page into another but can do much more than that. It is used here to generate a list of all pages matching a specified condition.

For example, a selector page can collect tasks. You can create a page called “tasks” or “todo” or any other meaningful name - let’s call it “TODO” for the example - and then in each page that is a task or contains a task you create a link to the “TODO” page. Now how do you collect the tasks? Ask the inline directive to list all the pages which link to “TODO”.

When you finish a task, you can remove the link to TODO and instead link to some other page, say “done”, so that you can track which tasks were completed.

Another option is to create all TODO pages as subpages of the TODO page. The example below, taken from ikiwiki, does that.

The directive used on the TODO page to generate the list of task pages may look like this:

\[[!inline pages="todo/* and !todo/done and !link(todo/done) and
           !link(patch) and !link(wishlist) and !todo/*/*"
           feedpages="created_after(todo/supporting_comments_via_disussion_pages)"
           actions=yes archive=yes rootpage="todo"
           postformtext="Add a new todo item titled:" show=0]]

This is probably easier to read:

\[[!inline pages="todo/*
               and !todo/done
               and !link(todo/done)
               and !link(patch)
               and !link(wishlist)
               and !todo/*/*"
           feedpages="created_after(todo/supporting_comments_via_disussion_pages)"
           actions=yes
           archive=yes
           rootpage="todo"
           postformtext="Add a new todo item titled:"
           show=0
 ]]

The [[inline directive page|ikiwiki/directive/inline]] explains what each parameter means.

Examples for things you can collect with selector pages:

The inline directive is very flexible: Selector pages are just one specific idea/way to use it. At the time of writing this wiki doesn’t have any selector pages, but it is going to have at least a TODO page. If it does, the following link will hopefully take you there: [[/tickets]].

[See repo JSON]