Commit | Line | Data |
---|---|---|
52e3f698 JH |
1 | The attachment plugin's Insert Links button currently only knows |
2 | how to insert plain wikilinks and img directives (for images). | |
3 | ||
4 | [[wishlist]]: Generalize this, so a plugin can cause arbitrary text | |
5 | to be inserted for a particular file. --[[Joey]] | |
6 | ||
7 | Design: | |
8 | ||
9 | Add an insertlinks hook. Each plugin using the hook would be called, | |
10 | and passed the filename of the attachment. If it knows how to handle | |
11 | the file type, it returns a the text that should be inserted on the page. | |
12 | If not, it returns undef, and the next plugin is tried. | |
13 | ||
14 | This would mean writing plugins in order to handle links for | |
15 | special kinds of attachments. To avoid that for simple stuff, | |
16 | a fallback plugin could run last and look for a template | |
17 | named like `templates/embed_$extension`, and insert a directive like: | |
18 | ||
19 | \[[!template id=embed_vp8 file=my_movie.vp8]] | |
20 | ||
21 | Then to handle a new file type, a user could just make a template | |
22 | that expands to some relevant html. In the example above, | |
23 | `templates/embed_vp8` could make a html5 video tag, possibly with some | |
24 | flash fallback code even. |