In a standard (non-wysiwyg tiddler) I get the same output as for a
wysiwyg tiddler when the tiddler is displayed - an empty SVCG pane -
if I surround the embed statement with <html> and </html> which is
needed, I believe, to tell a standard tiddler to behave as a chunk of
html.

In both cases therefore the formost challenge seem to lie in getting
the drawing to draw on the SVG pane. As the drawing is defined by the
script I'm guessing the problem lies in getting the script executed
when a tiddler is displayed as against when it's edited in the
HTMLArea editor which I can now achieve with the modified scripts
above.

Kevin

On Nov 2, 9:19 pm, kilucas <[EMAIL PROTECTED]> wrote:
> Here's what I found when I tried this.
>
> I placed the following in a wyswiwyg tiddler within Bram Chen's
> HTMLArea using the html view (not the standard editor view):
>
> <embed src="HTMLArea/plugins/AsciiSvg/d.svg" script="border = 0
> initPicture(-10,10)
> axes()
> stroke = 'red'
> p = []
> with (Math)
>   for (t = 0; t < 10.01; t += 0.05)
>     p[p.length] = [t*cos(PI*t), t*sin(PI*t)]
> path(p)" />
>
> It's code from an example of a drawing at the ASCIISVG home page 
> athttp://www1.chapman.edu/~jipsen/svg/asciisvg.htmlbut modified as
> follows:
>
> 1) When I save the original raw "embed statement, the delimeiters for
> the script are changed from single quotes to double quotes and this
> throws errors when the script encounters the "red" attribute. So I
> changed the script delimiters to double quotes and the delimiters
> within the script itself to single quotes
>
> 2) The original example begins <embed width="117" height="117"
> src="d.svg" ... The HTMLArea editor strips out the width and height
> elements - I don't know why. But I think they're being remembered
> because the SVG output seems to be affected by them nonetheless as
> mentioned below
>
> 3) The original example refers to "d.svg" in the wrong location for
> Bram's HTMLArea and I corrected it.
>
> The result was that I did indeed see the drawing when I switched out
> of raw html mode and back to normal viewing within the editor.
>
> Another oddity was that I'd initially used a version of the embed
> statement that omitted the height and width statements and the drawing
> had been truncated on the right. When I replaced the width and height
> statements, the drawing appeared correctly even though html view in
> the editor no longer showed the width and height statements.
>
> However, the drawing only appears as an empty SVG area when I view the
> tiddler oustide the editor. Hence I'm only halfway to the desired
> solution.
>
> If I place the same embed statement in a non-wysiwyg tiddler (so it's
> never been touched by HTMLArea) I just see the embed statement when I
> view the tiddler.
>
> Overall I'm therefore left wondering:
>
> 1) How can I get the drawing displayed when viewing the tiddler? Is
> there perhaps an equivalent place in my TW where I need to get the
> right code to execute at view time instead of edit time?
> 2) Can I stop HTMLArea swapping the script delimeters to single
> quotes?
> 3) can I stop HTMLArea removing thew width and height statements?
> 4) How would I invoke the same drawing from a non-wysiwyg tiddler.
> (Maybe the answer to 1 above will help here).
>
> I'll let you know if I learn more but if anyone has any insights that
> might help further, please by all means let me know.
>
> Thanks
>
> Kevin
>
> On Nov 2, 8:57 pm, kilucas <[EMAIL PROTECTED]> wrote:
>
>
>
> > David's made the following suggestion:
>
> > This is untested so no guarantees, but you can try this:  In
> > AsvgHA.js
> > (or ASCIIsvgHA.js) drawPics, replace
>
> > var sscr = picture.getAttribute("sscr");
> >           if ((sscr != null) && (sscr != "")) {
> >                   try {
> >                           if (isIE) {
> >                                   parseShortScript(sscr);
> >                                   //names the SVG so it can identify
> > itself onclick
> >                                   picture.window.setname(picture.id);
> >                           }
> >                   } catch (e) {}
> >           }
>
> > with
>
> > var sscr = picture.getAttribute("sscr");
> > var src = picture.getAttribute("script");
>
> >           if ((sscr != null) && (sscr != "")) {
> >                   try {
> >                           if (isIE) {
> >                                   parseShortScript(sscr);
> >                                   //names the SVG so it can identify
> > itself onclick
> >                                   picture.window.setname(picture.id);
> >                           }
> >                   } catch (e) {}
> >           } else  if ((src!=null) && (src != "")) {
> >                           try {
> >                              if (isIE) {
> >                                   with (Math) eval(src);
> >                                   picture.window.setname(picture.id);
> >                              }
> >                           } catch(err) {alert(err+"\n"+src)}
> >                   }
>
> > Kevin
>
> > On Oct 28, 12:18 pm, kilucas <[EMAIL PROTECTED]> wrote:
>
> > > I posted some informatiuon about this in the ASCIIMath Google group
> > > where David Lippman and Peter Jipsen, who were both instrumental in
> > > producing the mathematical version of HTMLArea are posting. David got
> > > back to me to suggest there's a bug inASCIIsvgwhich is causing the
> > > problem.
>
> > > I've copied my posting and his reply here (my apologies if that breaks
> > > any form of etiquette) and will see if I can rectify the problem
> > > myself although I'm not that handy with code and this may defeat me.
> > > Maybe someone better skilled might know how to fix this without too
> > > much effort.
>
> > > Bram: Presumably it'd be good to incorporate any solution we find into
> > > your package.
>
> > > Here's my posting, then David's reply:
>
> > > Kevin
> > > I'm using ASCIIMathML andASCIIsvgwith HTMLArea in TiddlyWiki. The
> > > implementation I have 
> > > fromhttp://sourceforge.net/project/showfiles.php?group_id=150646&package_...
> > > invokes a window (called the Equation Grapher Control Panel) in which
> > > I can specifiy graph parameters to create SVG graphs. But theASCIIsvg
> > > home page suggests I might also be able to form my own drawings by
> > > embedding some material in web pages.
>
> > > By pasting examples similar those on theASCIIsvghome page into the
> > > raw html viewer of HTMLArea available via a toolbar button I've got
> > > my
> > > browser to recognise that an svg object is to be rendered (the right
> > > mouse menu is appropriate to SVG) but myASCIIsvgcode isn't
> > > generating a drawing.
>
> > > My latest simple example is the following which amounts to an entire
> > > Tiddlywiki tiddler:
>
> > > <p>Start text</p><embed src="HTMLArea\Plugins\AsciiSvg\d.svg"
> > > script="initPicture(-2,2,-2,2);axes();line([-2,-2],[2,2]);" /><p /
>
> > > ><p>End text</p>
>
> > > (The instructions on theASCIIsvghome page say that the script
> > > delimiters should be single quotes but the HTMLArea editor converts
> > > them to double quotes even when I manually change them back).
>
> > > When I display the resultant page I get an empty SVG area surrounded
> > > by my start and end text and sometimes get a dialog box saying only
> > > "undefined" though it doesn't make clear what is undefined.
>
> > > When I compare the html here with the html generated by the Equation
> > > Grapher Control Panel wiindow the latter uses an sscr attribute to
> > > specific the graph I think but I can't find out what the sscr element
> > > is. And in any case it doesn't seem to be part of theASCIIsvg
> > > vocabulary as far as I can tell.
>
> > > I tried the same material in an ASciencePad tiddler but had no
> > > further
> > > success there.
>
> > > So does anyone here know if I should be able to specify my own
> > > drawings in the TiddlyWiki/HTMLAea environment and if so how I'd
> > > speciify them so that they draw completely please?
>
> > > David:
> > > The sscr attribute is a "short script" that is the abbreviated format
> > > used by the Equation Grapher Control Panel.
>
> > > When I wrote theASCIIsvgplugin for HTMLArea, there were two files
> > > in
> > > addition toASCIIsvg.js:  AsvgHA.js (or ASCIIsvgHA.js) and
> > > ASCIIsvgAddon.js.  The former is used in the editor window itself;
> > > the
> > > latter is intended to be included in the output.
>
> > > Looking at it, it appears that I stripped the "script" attribute
> > > handling out of AsvgHA.js (in the drawPics function).  Not sure
> > > exactly why.  The handling is still in ASCIIsvgAddon.js, so it should
> > > be possible to add it in to AsvgHA.js.
>
> > > ----------------------------
>
> > > On 27 Oct, 18:17, kilucas <[EMAIL PROTECTED]> wrote:
>
> > > > I've made limited progress. My browser now recognmises that I'm trying
> > > > to display an SVG picture but doesn't actually draw the picture I
> > > > intend. Here's what I've done and what I'm thinking of trying next.
>
> > > > I've inserted the <embed statement while editing the html (an option
> > > > provided by the HTMLArea editor). This seems to recognise the "<" sign
> > > > much better than when I placed the <embed statement in the wysiwyg
> > > > editor itself. (A look at the genereated html for the whole TW when
> > > > the tiddler was on display showed "embed .. preceded by "lt" when I
> > > > pasted the <embed statement into the wysiwyg part of the editor rather
> > > > than "&lt" which was generated by theASCIISvggrapher.
>
> > > > Once I set HTMLArea to show me the html and pasted the <embed
> > > > statement there, I could no longer see that part of the statement when
> > > > viewing the tiddler instead of seeing all the code I'd pasted in.
> > > > Guessing this meant that the embed statement was being acted upon
> > > > instead of merely redisplayed as code, this seemed to be a little
> > > > progress.
>
> > > > I now also see an area in the displayed tiddler which my browser
> > > > clearly thinks is an SVG area because a right click in IE6 offers SVG
> > > > menu options.
>
> > > > The recomended code at theASCIISvgweb site includes a reference to a
> > > > file called "d.svg". In HTMLArea this is located at "HTMLArea\plugins
> > > > \AsciiSvg\d.svg" so I edited the HTML to reflect this longer relative
> > > > path. This made no practical difference that I can see so I'm simply
> > > > guessing it's- Hide quoted text -
>
> - Show quoted text -...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to