This patch adds function bestdir() which returns best directory from the directory structure. This is in addition to the bestlink() function which is there in IkiWiki.pm ------- Index: IkiWiki.pm =================================================================== --- IkiWiki.pm (revision 9) +++ IkiWiki.pm (working copy) @@ -391,6 +391,35 @@ return ""; } +sub bestdir ($$) { + my $page=shift; + my $link=shift; + my $cwd=$page; + + if ($link=~s/^\/+//) { + $cwd=""; + } + + do { + my $l=$cwd; + $l.="/" if length $l; + $l.=$link; + if (-d "$config{srcdir}/$l") { + return $l; + } + } while $cwd=~s!/?[^/]+$!!; + + if (length $config{userdir}) { + my $l = "$config{userdir}/".lc($link); + + if (-d $l) { + return $l; + } + } + + return ""; +} + sub isinlinableimage ($) { my $file=shift; ---- -[[users/arpitjain]] [[!tag patch]] =master'>refslogtreecommitdiff
path: root/tags/02/f7/20180423110002.68A028912@lxp5.free-owl.de/unread
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2023-06-27 09:35:08 +0200
committerJonas Smedegaard <dr@jones.dk>2023-06-27 09:35:08 +0200
commitfd54908da2b05c526dd3bee9b6dcd093214a220d (patch)
treec69c845069c99d1d01044f6fafda7c08433329c6 /tags/02/f7/20180423110002.68A028912@lxp5.free-owl.de/unread
parentba46132213560cf3335d53560d519c0ec0190da2 (diff)
master
Diffstat (limited to 'tags/02/f7/20180423110002.68A028912@lxp5.free-owl.de/unread')