Yakov,

Thanks for the reply that showed me different results from what I had and 
got me to look further into the details for a cause. Fortunately I found 
it. It was the ExternalTiddlerPlugin that kept me from getting the empty 
slices. In the handler function of ExternalTiddlerPlugin (that overrides 
that of the original config.macros.tiddler.handler), an empty content is 
considered non-existing and gets skipped, without even creating the SPAN 
element. That's why I couldn't find it with an empty slice value.

Removing the ExternalTiddlerPlugin I got the same results as you did: the 
original config.macros.tiddler.handler got executed and an empty SPAN got 
created. However, even though there is an empty SPAN created for an empty 
slice, the *twve* still cannot find it with the mouse pointer, *because the 
empty SPAN has zero width*. I'll need to think of some way particularly for 
that. Shall take a short while.

Have Fun!
Vincent

On Sunday, August 10, 2014 10:21:45 PM UTC+8, Yakov wrote:
>
> Hi Vincent,
>
> basically, when you work with the mode changing/refreshing of the story, 
> you shouldn't rely on displayMessage: in some cases, it fails to display 
> messages (or, probably, the message is shown and closed so quickly that 
> even the display doesn't actually show it). Instead, use console.log or 
> alert (don't use the last one if you expect many messages, though; on the 
> other hand, there are some cases when messages in the console are shown in 
> an unexpected order).
>
> On the other hand, when I tried this plugin:
> //{{{
> config.macros.tiddler.handler = 
> function(place,macroName,params,wikifier,paramString,tiddler)
> {
> console.log("msg");
> displayMessage("msg");
>
>     var allowEval = true;
>     var stack = config.macros.tiddler.tiddlerStack;
>     if(stack.length > 0 && config.evaluateMacroParameters == "system") {
>         // included tiddler and "system" evaluation required, so check 
> tiddler tagged appropriately
>         var title = stack[stack.length-1];
>         var pos = title.indexOf(config.textPrimitives.sectionSeparator);
>         if(pos != -1)
>             title = title.substr(0,pos); // get the base tiddler title
>
>         var t = store.getTiddler(title);
>         if(!t || t.tags.indexOf("systemAllowEval") == -1)
>             allowEval = false;
>     }
>     params = paramString.parseParams("name",null,allowEval,false,true);
>     var names = params[0]["name"];
>     var tiddlerName = names[0];
>     var className = names[1] || null;
>     var args = params[0]["with"];
>     var wrapper = createTiddlyElement(place,"span",null,className,null,{
>         refresh: "content", tiddler: tiddlerName
>     });
>     if(args!==undefined)
>         wrapper.setAttribute("args","[["+args.join("]] [[")+"]]");
>     this.transclude(wrapper,tiddlerName,args);
> };
> //}}}
>
> and these tiddlers:
> t1
> text
> |slice|slice value|
> |emptySlice||
> !section
> section text
> !empty section
> transcluding t1
> <<tiddler [[t1::slice]]>>
> <<tiddler [[t1::emtpySlice]]>>
> <<tiddler [[t1##section]]>>
> <<tiddler [[t1##empty section]]>>
>
> I've got this result: when I open "transcluding t1", no messages are shown 
> at top-right corner of the screen and 4 messages are shown in console; when 
> I open that tiddler in the edit mode and then press esc to return, I get 
> all 4 message in both top-right and console. Finally, if I open the text in 
> inline-edit mode, I get 4 messages and when I press esc, I have no 
> messages. But most interesting part is when I actually add changes: when I 
> enter the edit mode, change text and press "done", I get 2 messages at 
> top-right and 4 messages in console. Counting messages after inline-editing 
> is hindered by their amount..
>
> As for the DOM, I can see all 4 spans, but those that were created by 
> empty transclusion, are empty as well..
>
> Best regards,
> Yakov.
>
> суббота, 9 августа 2014 г., 6:10:53 UTC+4 пользователь Vincent Yeh написал:
>
> Yakov,
>
> I was wrong about the empty slice/section things. I am having a problem 
> beyond my knowledge and need help.
>
> After some tests I realized empty slices are not editable because (in the 
> childNodes property of the parent) the *twve* cannot find the SPAN 
> element created by <<tiddler>> macro to hold the empty slice.
>
> Then I looked into the *invokeMacro* and config.macros.*tiddler.handler* 
> functions of TW2.8.1 and realized that *with empty slice value the 
> handler function was called but seems not executed (see below)*. I do not 
> understand why such thing would happen. Do you have any idea?
>
> PS Because of the described things, I'm sure that the handler is called 
> each time actually.
>  
>
> -----------------------------------------------------------------
> First, In the invokeMacro function, I added two lines of displayMessage() 
> *before 
> and after calling the handler function*
>
> if(m==config.macros.tiddler)displayMessage(macro+' '+params);
> m.handler(....);
> if(m==config.macros.tiddler)displayMessage('done');
>
> Secondly, in the config.macros.*tiddler.handler* function I added *at the 
> very first line*
> displayMessage('...handler working...');
>
> With the following source and transcluded tiddlers
> Source
> version: 1.2.3.4.5.6
> ''Author:''            *<-------  This slice is empty*
> Transcluded
> |<<tiddler 'Source::version'>>|
> <<tiddler 'Source::Author'>>
> I see the following messages
> tiddler 'Source::version'
> ...handler working...    *<-------  The first line of the handler 
> function, as expected*
> done
> tiddler 'Source::Author'
> done                           
> *<-------  Seems the handler function returns without executing the codes!*
> -----------------------------------------------------------------
>
> On Friday, August 8, 2014 5:05:00 PM UTC+8, Vincent Yeh wrote:
>
> Hi Yakov,
>
> On Tuesday, August 5, 2014 12:34:54 AM UTC+8, Yakov wrote:
>
> Hi Vincent,
>
> the torrent of coolingness is increasing, as I can see :)
>
> Confirm fixi
>
> ...

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to