aboutsummaryrefslogtreecommitdiff
path: root/doc/tips/switching_to_usedirs/discussion.mdwn
blob: 79ada00a161fbc9bcfb48d2157c7c323875b6246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
I'm working on an asciidoc plugin and having a problem figuring out how to deal with usedirs.

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.

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.

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.

------
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.

I'll leave this ramble here in case anyone has anything to say about it.  Thank you for listening  :-)

-- [[KarlMW]]

------
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.

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.

-- [[KarlMW]]

The cleaner urls seem worth it to me. The `urlto()` function makes it easy
for ikiwiki code to deal with the path changes. --[[Joey]]