X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/a0e06556db4a5c67f1fdf6f6dc4b6d275137b996..2b1857135def154369e4ee33a565861272643b43:/doc/forum/link_to_an_image_inside_the_wiki_without_inlining_it.mdwn?ds=sidebyside diff --git a/doc/forum/link_to_an_image_inside_the_wiki_without_inlining_it.mdwn b/doc/forum/link_to_an_image_inside_the_wiki_without_inlining_it.mdwn index f58b6b359..3f2713678 100644 --- a/doc/forum/link_to_an_image_inside_the_wiki_without_inlining_it.mdwn +++ b/doc/forum/link_to_an_image_inside_the_wiki_without_inlining_it.mdwn @@ -1,3 +1,5 @@ +[[!template id=gitbranch branch=wtk/linktoimageonly author="[[wtk]]"]] + how can I create a link to an image which is part of the wiki, without having it inserted in my page? I tought this: @@ -6,7 +8,7 @@ I tought this: would work, but it doesn't. -Any hints? +Any hints? --[[jerojasro]] > Well, currently the syntax above will display the image > inline with the specified link text used as an alt attribute. Although @@ -14,12 +16,12 @@ Any hints? > > A few places that use that (found with `git grep '\[\[' | egrep 'png|gif|jpeg|jpg' |grep \|`): > -> * [[logos]] uses it to provide useful alt texts for the logos. (This -> could easily be changed to use [[ikiwiki/directives/img]] though.) +> * [[logo]] uses it to provide useful alt texts for the logos. (This +> could easily be changed to use [[ikiwiki/directive/img]] though.) > * The `change.tmpl` template uses it to display > the [[diff|wikiicons/diff.png]] with a very useful "diff" alt text. -> Using [[ikiwiki/directives/img]] here would mean that the -> [[ikiwiki/plugins/recentchanges]] plugin would depend upon the img +> Using [[ikiwiki/directive/img]] here would mean that the +> [[plugins/recentchanges]] plugin would depend upon the img > plugin. > > I do like your suggestion, it makes more sense than the current behavior. @@ -39,3 +41,32 @@ Any hints? > Anyway, the cheap and simple answer to your question is to use html > or markdown instead of a [[ikiwiki/wikilink]]. Ie, > `[look at this](img/lolcat.jpg)`. --[[Joey]] + +> > thanks a lot, that's a quite straightforward solution. I actually wrote a +> > broken plugin to do that, and now I can ditch it --[[jerojasro]] + +>>> The plugin approach is not a bad idea if you want either the ability +>>> to: +>>> +>>> * Have things that are wikilink-aware (like [[plugins/brokenlinks]] +>>> treat your link to the image as a wikilink. +>>> * Use standard wikilink path stuff (and not have to worry about +>>> a relative html link breaking if the page it's on is inlined, for +>>> example). +>>> +>>> I can help you bang that plugin into shape if need be. --[[Joey]] + +>>>> both my plugin and your suggestion yield broken html links when inlining the page (although probably that's what is expected from your suggestion (`[]()`)) +>>>> +>>>> I thought using the `bestlink` function would take care of that, but alas, it doesn't. +>>>> Get the "plugin" [here](http://devnull.li/~jerojasro/files/linktoimgonly.pm), see the broken +>>>> links generated [here](http://devnull.li/~jerojasro/blog/posts/job_offers/) and the source +>>>> file for that page [here](http://git.devnull.li/cgi-bin/gitweb.cgi?p=blog-jerojasro.git;a=blob;f=posts/job_offers.mdwn;hb=HEAD) --[[jerojasro]] + +>>>>> Use this --[[Joey]] + + return htmllink($params{page}, $params{destpage}, $params{"img"}, + linktext => $params{text}, + noimageinline => 1); + +> [[patch]]: I've updated this plugin for the current ikiwiki. --[[wtk]]