Hi Jonnan, Eric's already mentioned raphaeljs, which I'd really recommend you check out. You might also get some ideas from the way the jtab guitar tab library works - essentially a "domain specific language" for rendering guitar notation in SVG (see http://jtab.tardate.com and also http://jtab.tardate.com/jtabtwiki-help.htm for how it plugs into TW).
Regards, Paul On Wed, Jul 29, 2009 at 9:11 PM, Jonnan <jonnan.w...@gmail.com> wrote: > > I feel like I must be both reinventing the wheel, and the most > retarded caveman ever to do it,but to expand the functionality of > TiddlyWiki for writing stories, I have been trying to get a macro to > interpret/add inline svg graphics to tiddlywiki. > > I have found all sorts of things where people have gone well beyond > the simple thing I want - science graphs, interactive charts, and so > on, and I've found a code snippet (http://softwareas.com/inline-svg) > for doing inline svg that, going by the reactions of seemingly > competent people that posted at the time, seems to obviously just be > something anyone even slightly competent could cut and paste into a > macro and at least get a simple graphic to work. > > I'm at the "It's so obvious a child could see it - Go find me a > child!" point - I no longer care if I look like a blithering idiot, I > would just like to know what obvious thing I'm missing that makes > turning this: > <<SVG "<circle r=\"50\" cx=\"50\" cy=\"50\" fill=\"green\"/>">> > > config.macros.SVG = > { handler: function (place, macroName, params, wikifier, paramString, > tiddler) > { var svg = params[0] > var svgObject = document.createElement('object'); > svgObject.setAttribute('type', 'image/svg+xml'); > svgObject.setAttribute('data', 'data:image/svg+xml,'+ '<svg>'+svg > +'</svg>'); > $(place).appendChild(svgObject); > } > } > > into a functional macro so much harder than it seems like it should > be? > > I'm almost certain the actual error is on the last line (at least the > macro doesn't deliver an error when it's commented out), but I have > tried pointers, functions 'this', 'here', 'place', and a dozen other > things to get it to actually output the svg into the file as an > object, and I'm obviously missing something. > > With apologies for the order of frustration and a side of being a > whiny ***** - <G>. I don't know javascript/DOM, but this looks like it > should be so bloody simple? > > Thanks again - Jonnan > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~----------~----~----~----~------~----~------~--~---