Hello TW Developers,

My first attempt to develop a widget led me to a problem I am not able to 
solve myself. The Details widget should produce a standard HTML5 disclosure 
element: 

    <details>
        <summary>This sums it up</summary> 
        All the details follow here.
    </details>

In TW the suggested syntax is

<$details summary="Open here!">

!! This is the revealed content
And this is some text

</$details>

So far this works great – but: The attribute summary is always rendered as 
text only, even if the input contains wikitext or tags like 
summary="<em>This</em> sums it up"

In the widget's JS code the summary is evaluated from different input 
possibilities and appended to the parent DOM node *detailsDomNode* like 
this:

    if(this.detailsSummary !== "") {
        this.summaryDomNode = this.document.createElement("summary");
        this.detailsDomNode.appendChild(this.summaryDomNode);
        this.summaryDomNode.appendChild(this.document.createTextNode(this.
detailsSummary));
    }

Finally everything should be rendered, I had hoped including the summary 
which is a child of details: 

    // Insert the details into the DOM and render any children
    this.parentDomNode.insertBefore(this.detailsDomNode,nextSibling);
    this.renderChildren(this.detailsDomNode,null);
    this.domNodes.push(this.detailsDomNode);

The only difference I can spot between *details* and *summary* is: details 
content can/must be surrounded by newlines to trigger wikitext rendering 
(wikification). 

Is there a trick I can use to force TW to render the summary attribute as 
wikitext (wikify*)?

The whole plugin is at https://tid.li/tw5/plugins.html#DetailsWidget a 
summary that should result in HTML tags is included in one of the last 
examples on fhttps://tid.li/tw5/plugins.html#Details%20Advanced%20Examples –
''Local'' summary <b>wins</b>

I would be greatful for any hints.

Cheers,
Thomas

* In macros I have successfully used my own wikify function to transform 
parameter input – but it seems not to work in the widget: 

/*
Wikify
*/
function wikifyText(t) {
    var Parser = $tw.wiki.parseText("text/vnd.tiddlywiki",t,{
            parseAsInline: true
        });
    var WidgetNode = $tw.wiki.makeWidget(Parser,{
            document: $tw.fakeDocument
        });
    var Container = $tw.fakeDocument.createElement("div");
    WidgetNode.render(Container,null);
    return Container.textContent;
}


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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 https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/6433e06b-5613-4f23-aa52-b8d175bc598d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to