Re: [twdev] [TW5] How to get a tiddler text as if it were a .tid file

171 views
Skip to first unread message

Jeremy Ruston

unread,
Sep 27, 2015, 10:15:11 AM9/27/15
to TiddlyWikiDev
Hi Danielo

On Sun, Sep 27, 2015 at 12:29 PM, Danielo Rodríguez <rdan...@gmail.com> wrote:
I want to know how can I get a tiddler text formatted as a .tid file. I'm trying to follow the logic behind the Export tiddler, but I'm getting lost.

TiddlyWiki generates .tid files using this template:

$:/core/templates/tid-tiddler

There's an example of programmatically generating a tiddler file here:


The code is made more complicated by the need to switch to the correct template; you'll be able to simplify it if you're always using the .tid template.

Best wishes

Jeremy.

 

Many thanks

--
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 tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/b7b2b31e-0837-4ced-9916-4afd16cbb082%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Danielo Rodríguez

unread,
Sep 29, 2015, 11:18:21 AM9/29/15
to TiddlyWikiDev, jeremy...@gmail.com
Dam! I think I have tried that already!

This is working more or less fine:

content = $tw.wiki.renderTiddler("text/plain",'$:/core/templates/tid-tiddler',{variables: {currentTiddler: 'HelloThere'}});

Seems that $tw.config.typeTemplates is not available in the browser. In any case, it only contains one template, correct? 

Thank you very much! you made my day

Danielo Rodríguez

unread,
Sep 29, 2015, 3:37:40 PM9/29/15
to TiddlyWikiDev, jeremy...@gmail.com
Another question:

Is it possible to override certain field passing the new field value as an option? For example, if I want to override the tags when rendering, but I don't want to change the tiddler on the store.

Regards

Tobias Beer

unread,
Sep 30, 2015, 4:38:10 AM9/30/15
to TiddlyWikiDev, jeremy...@gmail.com
Hi Danielo,
 
Is it possible to override certain field passing the new field value as an option? 
For example, if I want to override the tags when rendering, but I don't want to change the tiddler on the store.

That's a neat idea for ui-automation,
perhaps even via introspection.

Best wishes,

— tb

Jeremy Ruston

unread,
Oct 5, 2015, 11:44:55 AM10/5/15
to tiddly...@googlegroups.com
Hi Danielo

On 29 Sep 2015, at 20:37, Danielo Rodríguez <rdan...@gmail.com> wrote:

Is it possible to override certain field passing the new field value as an option? For example, if I want to override the tags when rendering, but I don't want to change the tiddler on the store.

You’d need to duplicate the template "$:/core/templates/tid-tiddler” and change it to exclude the fields you want. Here’s what it looks like at the moment:

<!--

This template is used for saving tiddlers in TiddlyWeb *.tid format

--><$fields exclude='text bag' template='$name$: $value$
'></$fields>`
`<$view field="text" format="text" />

You can extend the “exclude” attribute of the <$fields> widget with as many fields as you need.

Best wishes

Jeremy.

Danielo Rodríguez

unread,
Oct 5, 2015, 1:29:27 PM10/5/15
to TiddlyWikiDev

You’d need to duplicate the template "$:/core/templates/tid-tiddler” and change it to exclude the fields you want. Here’s what it looks like at the moment:

<!--

This template is used for saving tiddlers in TiddlyWeb *.tid format

--><$fields exclude='text bag' template='$name$: $value$
'></$fields>`
`<$view field="text" format="text" />

You can extend the “exclude” attribute of the <$fields> widget with as many fields as you need.

That is a very nice tip!! I think I looked at that template, but it is obvious that I did not. Thank you very much Jeremy

Tobias Beer

unread,
Oct 6, 2015, 7:52:12 AM10/6/15
to TiddlyWikiDev
Hi Jeremy,
 
exclude='text bag'

Might I ask why any bag field would currently be excluded?

The commit message says:

"They're just an artefact of syncing"

Don't quite understand what that means.
Does any existing TW5 <> TiddlyWeb integration not need / save them?

Or is it that they would be problematic later
when imported into TiddlyWeb without that bag existing?

Best wishes, 

— tb

Jeremy Ruston

unread,
Oct 6, 2015, 8:39:48 AM10/6/15
to tiddly...@googlegroups.com
Hi Danielo


exclude='text bag'

Might I ask why any bag field would currently be excluded?

The commit message says:

"They're just an artefact of syncing”

As I remember it, there were circumstances when we get a “bag” field from TiddlyWeb that we don’t need to retain. It dates from some of the very early work on TW5 which was around building TW2 with the TW5 code, including pulling content down from TiddlySpace.

Best wishes

Jeremy


Don't quite understand what that means.
Does any existing TW5 <> TiddlyWeb integration not need / save them?

Or is it that they would be problematic later
when imported into TiddlyWeb without that bag existing?

Best wishes, 

— tb

--
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 tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
Reply all
Reply to author
Forward
0 new messages