Ноw to convert <safe-script... to <script... while --rendertiddlers to static html file?

41 views
Skip to first unread message

Siniy-Kit

unread,
Feb 5, 2020, 11:25:07 AM2/5/20
to TiddlyWiki
Hi, I want my external .js file work only in one tiddler in it's  "static" variant, and not work in tiddliwiki variant. 

I make new tiddler with title "search" and put text to it  
<script src="search_base.js"  type="text/javascript"></script>

this script don't work in tiddlywiki, because tiddlywiki converts it to 
<safe-script src="search_base.js" type="text/javascript"></safe-script>
 it is good and I like it.

But  I want ( when I render this tiddler to static  "search.html"  by --rendertiddlers ....)  to covert <safe-script  back to <script  to make my script work in static variant. Is it possible, or I have to make special template $:/core/templates/MYstatic.tiddler.html with
`<script src="search_base.js"  type="text/javascript"></script>`
only for this tiddler?

Jeremy Ruston

unread,
Feb 5, 2020, 5:33:35 PM2/5/20
to tiddl...@googlegroups.com
Hi Siny-Kit

The element widget (which is responsible for rendering plain HTML elements) does indeed neuter script elements. The usual workaround is to arrange your templates so you can generate your script tag as plain text. For example, $:/core/templates/javascript-tiddler uses this technique.

Best wishes

Jeremy

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/573cde84-a502-4214-996c-ade5d6e0a790%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages