diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-07-27 16:44:13 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-07-27 16:44:13 +0000 |
commit | a517b38a8ff6e6c7d0c4ea289bf7f640c4d7aab1 (patch) | |
tree | 1a3322f4f035b528c364a588a288fd0c75b349dc /doc | |
parent | d94bd350bda3c87f581791324db5a696235caf78 (diff) |
web commit by arpitjain11
Diffstat (limited to 'doc')
-rw-r--r-- | doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn | 80 |
1 files changed, 40 insertions, 40 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 index b2f67ebc0..37660a7b8 100644 --- a/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn +++ b/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn @@ -2,45 +2,45 @@ This patch adds function bestdir() which returns best directory from the directo ------- -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; - + 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 |