From 52e3f698bc8fafdab4d911d925d214981ebd8d25 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 14 Aug 2010 20:17:12 -0400 Subject: [PATCH] respond, open wishlist todo item with design --- doc/plugins/filecheck/discussion.mdwn | 49 +++++++++++++++++++++++---- doc/todo/generic_insert_links | 24 +++++++++++++ 2 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 doc/todo/generic_insert_links diff --git a/doc/plugins/filecheck/discussion.mdwn b/doc/plugins/filecheck/discussion.mdwn index 9a3bcddfc..6ef780772 100644 --- a/doc/plugins/filecheck/discussion.mdwn +++ b/doc/plugins/filecheck/discussion.mdwn @@ -18,17 +18,54 @@ if ::magic() returns undef? --[[DavidBremner]] --- -At first I need to thank you for ikiwiki - it is what I was always looking for - coming from a whole bunch of wiki engines, this is the most intelligent and least bloated one. +At first I need to thank you for ikiwiki - it is what I was always looking +for - coming from a whole bunch of wiki engines, this is the most +intelligent and least bloated one. -My question is about the [[plugins/attachment]] plugin in conjunction with [[plugins/filecheck]]: I am using soundmanger2 js-library for having attached media files of all sorts played inline a page. +My question is about the [[plugins/attachment]] plugin in conjunction with +[[plugins/filecheck]]: I am using soundmanger2 js-library for having +attached media files of all sorts played inline a page. -To achieve this soundmanager2 asks for an id inside a ul-tag surrounding the a-tag. I was wondering if the Insert Link button could be provided with a more elegant solution than to have this code snippet to be filled in by hand every time you use it to insert links for attached media files. And in fact there apparently is a way in attachment.pm. +To achieve this soundmanager2 asks for an id inside a ul-tag surrounding +the a-tag. I was wondering if the Insert Link button could be provided with +a more elegant solution than to have this code snippet to be filled in by +hand every time you use it to insert links for attached media files. And in +fact there apparently is a way in attachment.pm. -While I can see that it is not needed for everyone inserting links to attached media files to have ul- and li-tags surrounding the link itself as well as being supplied with an id fill in, for me it would be the most straight forward solution. Pitty is I don't have the time to wrap my head around perl to write a patch myself. Is there any way to have this made an option which can be called via templates? +While I can see that it is not needed for everyone inserting links to +attached media files to have ul- and li-tags surrounding the link itself as +well as being supplied with an id fill in, for me it would be the most +straight forward solution. Pitty is I don't have the time to wrap my head +around perl to write a patch myself. Is there any way to have this made an +option which can be called via templates? -For sure I would like to donate for such a patch as well as I will do it for ikiwiki anyway, because it is such a fine application. +For sure I would like to donate for such a patch as well as I will do it +for ikiwiki anyway, because it is such a fine application. -If you are not familiar with soundmanager2: It is a very straight forward solution to inline mediafiles, using the usual flash as well as html5 solutions (used by soundcloud.com, freesound.org and the like). Worth a look anyway [schillmania.com](http://www.schillmania.com/) +If you are not familiar with soundmanager2: It is a very straight forward +solution to inline mediafiles, using the usual flash as well as html5 +solutions (used by soundcloud.com, freesound.org and the like). Worth a +look anyway [schillmania.com](http://www.schillmania.com/) Boris +> The behavior of "Insert Links" is currently hardcoded to support images +> and has a fallback for other files. What you want is a +> [[todo/generic_insert_links]] that can insert a template directive. +> Then you could make a template that generates the html needed for +> soundmanager2. I've written down a design at +> [[todo/generic_insert_links]]; I am currently very busy and not sure +> when I will get around to writing it, but with it on the todo list +> I shouldn't forget. --[[Joey]] +> +> You could make a [[ikiwiki/directive/template]] for soundmanager2 +> now, and manually insert the template directive for now +> when you want to embed a sound file. Something like this: + + \[[!template id=embed_mp3 file=your.mp3]] + +> Then in templates/embed_mp3.mdwn, something vaguely like this: + + diff --git a/doc/todo/generic_insert_links b/doc/todo/generic_insert_links new file mode 100644 index 000000000..050f32ee7 --- /dev/null +++ b/doc/todo/generic_insert_links @@ -0,0 +1,24 @@ +The attachment plugin's Insert Links button currently only knows +how to insert plain wikilinks and img directives (for images). + +[[wishlist]]: Generalize this, so a plugin can cause arbitrary text +to be inserted for a particular file. --[[Joey]] + +Design: + +Add an insertlinks hook. Each plugin using the hook would be called, +and passed the filename of the attachment. If it knows how to handle +the file type, it returns a the text that should be inserted on the page. +If not, it returns undef, and the next plugin is tried. + +This would mean writing plugins in order to handle links for +special kinds of attachments. To avoid that for simple stuff, +a fallback plugin could run last and look for a template +named like `templates/embed_$extension`, and insert a directive like: + + \[[!template id=embed_vp8 file=my_movie.vp8]] + +Then to handle a new file type, a user could just make a template +that expands to some relevant html. In the example above, +`templates/embed_vp8` could make a html5 video tag, possibly with some +flash fallback code even. -- 2.44.0