Difference between revisions of "WikiExporter"

From Inkscape Wiki
Jump to navigation Jump to search
(*success! summary, how it works)
m (link fix)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
I've written 4 files that, together, make it so you can save to an [http://www.oddmuse.org/cgi-bin/wiki OddMuse] wiki.
+
I've written a bunch of little scripts that, together, make it so you can save to and load from an [http://www.oddmuse.org/cgi-bin/wiki [[OddMuse]]] wiki.
 +
 
 +
It renders out both Inkscape .svg and .png versions of the data.
 +
 
 +
You can load from the wiki, make a few edits, hit "Ctrl-S," and the edited document is sent back to the wiki.
 +
 
 +
It's fun!
 +
 
 +
----
 +
 
 +
(I believe that means it should work for ''this'' wiki, as well, though I haven't tried it.)
  
 
Basically, it goes like this:
 
Basically, it goes like this:
Line 18: Line 28:
 
The file details the username and wiki URL for svg2oddmuse.sh.
 
The file details the username and wiki URL for svg2oddmuse.sh.
  
The [http://www.emacswiki.org/cw/InkscapeToOddmuse full description of how it works] is on [http://communitywiki.org/ CommunityWiki.]
+
The [http://www.emacswiki.org/cw/InkscapeToOddmuse full description of how it works] is on [http://communitywiki.org/ [[CommunityWiki]].]
  
 
Next, I intend to write code to ''read'' Inkscape SVG from the wiki as well.
 
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?

Latest revision as of 02:33, 22 January 2006

I've written a bunch of little scripts that, together, make it so you can save to and load from an OddMuse wiki.

It renders out both Inkscape .svg and .png versions of the data.

You can load from the wiki, make a few edits, hit "Ctrl-S," and the edited document is sent back to the wiki.

It's fun!


(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?