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 fixing/improving:
> - ctrl+left/right doesn't move list items anymore
> - new symbols (moving r) are displayed well
>
>
> Great! Thanks.
>  
>
> As for the partial transclusion, strange things began to happen.
> * try to transclude into a tiddler a section from another tiddler, but 
> make a mistake in the section name. For me,
> ** the first saving (opening the tiddler in the view mode) made FF hang 
> for some seconds and it suggested me twise to stop the scenario, and the 
> stuff after the transclusion wasn't displayed
> ** on the second opening (in view mode) the tiddler got displayed as empty 
> (although in the edit mode I can see the whole text)
> ** on the third one FF hanged hardly and I closed the tab after some 
> tweaking/waiting (in fact, this usually takes place on the first or the 
> second opening in the view mode
> ** this is especially important as in inline-edit mode cursor changes the 
> section name each time it gets inside the [[...##...]] expression, and 
> previewer makes FF hang
> ** you can try these tiddlers to get the picture:
> t1
> |s1||
> t2
> <<tiddler [[t1::s2]]>>
>
>
> Seems like either the *twve.core* or the *twve.extra* does not take care 
> of the "section not found" situation. That shall be fixed in the next 
> release.
>  
>
> * editing of a slice inserted in a table like this:
>   |...|<<tiddler [[someTiddler::someSlice]]>>|
>   is not possible (only macro code can be edited, but this syntax is 
> essential for usage with ForEachTiddlerPlugin)
>
>
> I did not think of such a case, thanks for mentioning it. That should be 
> quick and shall be done in the next release as well.
>  
>
> * editing of an empty transcluded slice is not possible (same thing: only 
> macro code can be edited; this is true for sections as well; this is also 
> important for FETP)
>
>
> Empty slices, that's interesting to me. In principle there should be no 
> difficulties doing that with the current codes. You'll have it.
>  
>
>
> * consider the following two tiddlers:
> t1
> |sl1|slice text|
> !sec1
> section text
> t2
> <<tiddler [[t1##sec1]]>>
> <<tiddler [[t1::sl1]]>>
> if I edit slice of t1 inside t2, on refreshing the <<tiddler 
> [[t1##sec1]]>> unexpectedly starts to show the whole tiddler instead of 
> just the section
>
>
> Hmm, I thought I had taken care of such cases already...
>  
>
> * simple editing of slices with works, for both latin and international 
> slice names (the latter is aplicable when ExtendedSlicesPlugin is installed)
>
> About text blocks: now a text like
> some words {{{some code}}} some words</sp
>
> ...

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to