summaryrefslogtreecommitdiff
path: root/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn
blob: 68222946948dbf4e82bcd1c4e9ac525584c4614e (plain)

I have a working minimal implementation letting the rst renderer resolve undefined native rST links to ikiwiki pages. I have posted it as one patch at:

Preview commit: http://github.com/engla/ikiwiki/commit/486fd79e520da1d462f00f40e7a90ab07e9c6fdf
Repository: git://github.com/engla/ikiwiki.git

Design issues of the patch:

Right now it changes rendering so that undefined pages (previous errors) are resolved to either ikiwiki pages or link to "#". It could be changed (trivially) so that undefined pages give the same error as before. Since it only resolves links that would previously error out, impact on current installations should be minimal.

The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to generate backlinks). Can the parse output be safely reused?

The page content fed to htmlize may be different than that fed to scan, as directives can change the content. If you cached the input and output at scan time, you could reuse the cached data at htmlize time for inputs that are the same -- but that could be a very big cache! --[[Joey]]

I would propose using a simple heuristic: If you see [[ anywhere on the page, don't cache it. It would be an effective cache for pure-rst wikis (without any ikiwiki directives or wikilinks). However, I think that if the cache does not work for a big load, it should not work at all; small loads are small so they don't matter. --ulrik

Desing issues in general:

We resolve rST links without definition, we don't help resolving defined relative links, so we don't support specifying link name and target separately.

I found out this is possible by using rST subsitutions. So to do [[Version history...|releases]] you would use:

|releases|_
.. |releases| replace:: Version history...
Which does not seem to have an inline equivalent. Using non-resolved links there is the alternative:

``Version history _. --ulrik [kaizer.se]

Many other issues with rST are of course unresolved, but some might be solved by implementing custom rST directives (which is a supported extension mechanism).

Patch follows: