Hi IsoLin

> I am trying to integrate reveal.js [1] in a convenient way, such that I can 
> use TiddlyWiki to edit and store the presentation slides, but then simply 
> launch it straight from the wiki.

Terrific, that’s a great idea. I’m a huge fan of Reveal.js (and of Hakim’s 
other work; see http://hakim.se and things like 
http://lab.hakim.se/scroll-effects/).


> Aditionally I am considering an export mode as well, for creating standalone 
> versions.

Having the presentation dynamically update in a separate window is a very good 
approach.

> While I still have various challenges to solve, I am currently stumped trying 
> to open a new window with the reveal.js library loaded together with the 
> slides. My idea was to use the existing `tm-open-window` message and a custom 
> template. However I am having trouble finding out how I could take full 
> control of the document being displayed in the new window.

As you’ve found, the template expected by tm-open-window is inserted within the 
body element of the window, and so can’t be used to specify the full markup of 
the window.

> While reading through `$:/core/modules/startup/windows.js` I am getting the 
> impression there is no way to actually just dump a template similar to 
> `$:/core/save/all` (which allows manipulating the entire document including 
> headers etc) into a new window. Am I missing something here?

No, your conclusions are correct.

It would be well worth fixing this. I’m not sure if it can be done in a 
backwards compatible way, and I’d concur with your idea of introducing a new 
`tm-open-raw-window` message. The existing message handler could be refactored 
so that the guts are more easily reusable.

> Can anyone suggest a method I could use? I would like to use a template 
> tiddler which contains the entire document ( i.e. `<html><head>custom 
> headers...</head><body>slide tiddlers rendered through another 
> template...</body></html>`)
> 
> My current attempts have thus far only produced nested 
> `<html>...<body><html>..</html></body></html>` type documents which do not 
> display properly, for obvious reasons.

Part of the problem is this line that writes the skeleton HTML content for the 
window:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/startup/windows.js#L44

As I recall it, I had problems getting things to work with Firefox when I 
omitted the document.write, or wrote a blank string.

> Since I was stumped using the existing `tm-open-window` message, I tried 
> writing a new message `tm-open-raw-window` similar to the original, but 
> without the surrounding document. However I was not able to find out how to 
> parse a template-tiddler to html to dump it into the window. 
> `$tw.wiki.renderTiddler("text/html",'templatename')` looked rather promising, 
> but raised an exception for my template:

The existing rendering code should do what you want:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/startup/windows.js#L62-L72

This line needs changing to replace the entire document, not just insert the 
new element into the DOM:

widgetNode.render(srcDocument.body,srcDocument.body.firstChild)


> 
> ```
> $:/core/modules/utils/utils.js:548 Uncaught TypeError: Cannot read property 
> 'length' of undefined
>     at Object.exports.parseTextReference
> ($:/core/modules/utils/utils.js:548:45)
>     at exports.list ($:/core/modules/filters/list.js:21:18)
>     at eval ($:/core/modules/filters.js:207:15)
>     at Object.$tw.utils.each
> 
> ...
> ```
> 
> Making a wild guess here, judging by the call stack, it might have something 
> to do with the list widget in the template? Maybe missing the reference to 
> the `currentTiddler` containing the `list` field?

That could be the case. Perhaps pass “currentTiddler” as a parameter to the 
tm-open-window call.

One thing to note with TiddlyWiki templates is that the templates used to 
generate HTML output are used differently than usual: instead of treating the 
wikified output as HTML, we take the text content of the output, and then treat 
that as HTML. That’s why `$:/core/save/all` wraps the HTML elements in 
backticks, so that they are treated as plain text, and not parsed.

Best wishes

Jeremy



> 
> Part of the template:
> ```
> <$list filter="[list{!!title}]" emptyMessage="No slides added yet" 
> template="$:/core/ui/ListItemTemplate"/>
> ```
> 
> So if anyone can tell me how to do this, this might also solve my problem. :)
> 
> Cheers.
> 
> [1] https://github.com/hakimel/reveal.js
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/tiddlywikidev 
> <https://groups.google.com/group/tiddlywikidev>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/f085efaf-7beb-4960-bcc6-b147dfba8a16%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywikidev/f085efaf-7beb-4960-bcc6-b147dfba8a16%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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/513A60A3-9883-45BB-9DB2-CA4555FCC1B8%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to