WikiExporter

From Inkscape Wiki
Revision as of 10:20, 13 February 2005 by LionKimbro (talk | contribs) (* will probably work on *this* wiki..!)
Jump to navigation Jump to search

I've written 4 files that, together, make it so you can save to an OddMuse wiki.

(I believe that means it should work for this wiki, as well, though I haven't tried it.)

Basically, it goes like this:

  • A script is called from Inkscape when the user saves,
  • the script reads the SVG document to figure out what directory it was saved to,
  • the script reads it to figure out what filename was used as well,
  • information about the target wiki is read from the directory the SVG was saved to,
  • the Inkscape SVG is uploaded to the wiki,
  • and a PNG version is uploaded to the wiki as well.

This all requires 4 files:

  • odd_output.inx -- Inkscape extension definition
  • svg2oddmuse.sh -- coordinates most everything
  • svgattrs.py -- scans the SVG file for <svg ...> attributes
  • wikiupload.py -- oddmuse upload script

Furthermore, the user creates a custom file, "notes.txt". The file details the username and wiki URL for svg2oddmuse.sh.

The full description of how it works is on CommunityWiki.

Next, I intend to write code to read Inkscape SVG from the wiki as well.

The process is kind of hacky; I imagine that when one of the ExtensionArchitectureProposals is chosen and implemented, it'll be a lot nicer.

Drawing Area?

Right now, I've hard coded it to export the page.

The relevant code looks like this:

inkscape --file="$INK_SVG" --export-png="$DOCBASE/$DOCNAME.png" --export-area "0:0:595.28:841.89" > /dev/null

I tried removing the --export-area, and all I got were tiny little 123 byte files.

Ideally, my code would send off only the drawing, not the whole page.

Questions:

  • Does the CLI interface support this in version 0.40? (Maybe I'm just missing it.)
  • Is there a way I can easily get the information from the SVG? (Maybe I'm just missing it.)

Bitmaps to data URLs?

I saw in the examples, that a PNG was turned into a binary64 encoded data URL.

I haven't written the code to locate PNG references, and replace them with data URLs.

But, this is something that I think should be done with it.

Question:

  • Is there a way to turn PNG images into data: URLs within Inkscape?
  • From the CLI?