My repository contains image sources made with tools like Inkspace, Dia, LibreOffice, Gimp and so on.

Instead of pushing the images themselves into git or manually exporting them to PNG/SVG,
I'd like to keep just the sources in git, and have ikiwiki compile them into the final
images just like it compiles Markdown into HTML. Is it possible to add new files types
and tell ikiwiki how to compile them?

(After reading some plugin docs...)

I just read 'perlintro' yesterday in unrelated context, but... could it maybe be done by writing a plugin like this one, which compiles textile?

http://source.ikiwiki.branchable.com/?p=source.git;a=blob;f=IkiWiki/Plugin/textile.pm;h=56bb4bffce83bf9fa47b1ad731f46c8dc8d9f652;hb=HEAD

-- fr33domlover

Several plugins process data using external programs. You may have a look at:

The first and second plugins I mentionned create an image using an external tool, and integrate it in the page. It may be exactly what you want.

-- Louis

Comment by spalax Fri May 16 06:38:17 2014

Thanks, I already saw those.

I need a plugin of exactly the same kind, but which calls other tools, such as Dia and Inkspace.
In addition, embedding into a page means the same image may end up being generated
many times. So it's best to generate the image as an attachment of some page, and then
all other pages in the wiki can use it. What do you think?

Also, if I write a plugin (and test it of course), where do I publish it so people can
see and enjoy it? Is plugins moderated?

-- fr33domlover

Comment by fr33domlover Sat May 17 07:10:35 2014

I need a plugin of exactly the same kind, but which calls other tools, such as Dia and Inkspace. In addition, embedding into a page means the same image may end up being generated many times. So it's best to generate the image as an attachment of some page, and then all other pages in the wiki can use it. What do you think?

Then the pandoc may be a good start, since you can configure it for Pandoc to take over processing of all .mkdn files, or only files with a different extension. Have a look at it to make your plugin process files with a particular extension. Then, it will be possible to have several pages refer to the same file, generated only once (maybe by storing stuff in %pagestate or %wikistate.

Have a look at write to write your plugin.

Also, if I write a plugin (and test it of course), where do I publish it so people can see and enjoy it? Is plugins moderated?

What is usually done is:

  • you publish your code somewhere (your server, or on github or something like that);
  • you advertise your plugin by creating a subpage of contrib. Use the plugin template (it generates the frame you can see on the right of one of my plugins, for example):

    \[[!template id=plugin name=YourFancyPlugin author="fr33domlover"]]
    

-- Louis

Comment by spalax Sat May 17 09:49:14 2014

Great, thanks. I'll take a look. But it's a bit different, because images are not HTML pages at all.

Thanks for the quick replies :-)

Comment by fr33domlover Sat May 17 10:46:15 2014

Hello, I enventually wrote a plugin that might fit your need: compile.

In setup file, you specify which command is to be applied to files. For instance, to convent odt files to pdf, you can use:

compile_filetypes = '
    "odt": {
      "build": "libreoffice --headless --convert-to pdf %{srcname}s",
      "destname": "%{basename}s.pdf"
    }
  }'

Then, in your wiki pages, you can use \[[!compile files="foo.odt"]]. This will convert file to pdf, and render as a link to the pdf file. If option inline is set, you can also simply use a wikilink [[foo.odt]], which will have the same effect.

The only problem I see is that when linking several times to the same file, it will be compiled several times. I marked it as a feature request to the plugin.

Regards,
-- Louis

Comment by spalax Sat Oct 4 06:37:16 2014