]> sipb.mit.edu Git - ikiwiki.git/blob - doc/tips/switching_to_usedirs/discussion.mdwn
web commit by BrianWilson
[ikiwiki.git] / doc / tips / switching_to_usedirs / discussion.mdwn
1 I'm working on an asciidoc plugin and having a problem figuring out how to deal with usedirs.
2
3 One of the key reasons I use asciidoc is for the ability to do inline includes of scripts with syntax-highlighting.  I also want the script to be linked from the page for easy downloading.
4
5 Formerly, I would have had the asciidoc and the script in the same directory, and all was well (and I have my asciidoc plugin working just fine for this).  With usedirs, the script needs to be in the same dir as the asciidoc source at render time, but in the newly created subdir for download.  The problem is that the page effectively moves down by one directory level when it is rendered from the source to the html tree.
6
7 As far as my needs are concerned, there is no problem - I can just run without usedirs - but it would be nice to find a solution that would work either way.  Just a clean solution to usedirs would be fine (even if it doesn't work without usedirs), since usedirs is now the default.
8
9 ------
10 OK, now that I've written this out, I see a solution.  The include for the syntax-highlighting and the link to the script are not tightly coupled (in fact they're not coupled at all, except by the person writing the page).  So, the solution under usedirs is to specify a current-dir link to the script for the syntax-highlighter, and a parent-dir link for the script.  This could even be made conditional on usedirs being enabled, if one felt so inclined.
11
12 I'll leave this ramble here in case anyone has anything to say about it.  Thank you for listening  :-)
13
14 -- [[KarlMW]]
15
16 ------
17 This may serve only to highlight my naivete, but what are the advantages of the usedirs approach?  I'm not passionately against the option, and I'm confident that there must be benefits for it to have become the default in ikiwiki - I just don't understand why.
18
19 It seems to me that the only advantage is slightly tidier URLs, but with the disadvantage that source files change dir level and relative links need to change too.
20
21 -- [[KarlMW]]
22
23 The cleaner urls seem worth it to me. The `urlto()` function makes it easy
24 for ikiwiki code to deal with the path changes. --[[Joey]]