diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-07-27 15:14:20 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-07-27 15:14:20 +0000 |
commit | 8decfc845598f08bb7a212a57b9d44761ca08a6a (patch) | |
tree | 7065020f1e2ea795ed59641031c3991c3bb37117 | |
parent | 71cd4921c1b5ace031c3235d2dc99f813db289e3 (diff) |
web commit by arpitjain11
-rw-r--r-- | doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn b/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn new file mode 100644 index 000000000..1c0914336 --- /dev/null +++ b/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn @@ -0,0 +1,44 @@ +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]]
\ No newline at end of file |