TiddlyDesktop method for exporting individual tiddlers (90% there)

111 views
Skip to first unread message

Jared Lettau

unread,
May 19, 2020, 6:14:38 PM5/19/20
to TiddlyWiki
Goal: To export individual tiddlers in a format where they can be imported.

The code below works well, EXCEPT:
  • It exports as HTML, which when imported doesn't get parsed the way importing json or .tid files do. If there's a workaround for importing HTML that would solve.
  • I don't see a way to alter the code to export .tid files.
One idea would be to mashup functionality from $:/core/macros/export, however I have been usuccessful in doing so...

Any help is appreciated.


\define quotedCurrent() $(currentTiddler)$
\define filename() $(currentTiddler)$.html

List
 tiddlers to
export with this tag: <$edit-text tag="input" width="50"
 placeholder
="Tag name" tiddler="$:/temp/myfavtag"/><br/>

---

<$button>Save the following tiddlers
<$list filter="[tag{$:/temp/myfavtag}]">
<$action-sendmessage
 $message
="tm-download-file"
$param
="$:/core/templates/exporters/StaticRiver"
exportFilter
=<<quotedCurrent>>

filename
=<<filename>>/>
</
$list>
</$button>


<$list filter="[tag{$:/temp/myfavtag}
]">
<<currentTiddler>><br/
>
</$list>


Eric Shulman

unread,
May 19, 2020, 8:33:46 PM5/19/20
to TiddlyWiki
On Tuesday, May 19, 2020 at 3:14:38 PM UTC-7, Jared Lettau wrote:
Goal: To export individual tiddlers in a format where they can be imported.

Give this a try:
Export tiddlers with this tag:

<$edit-text tag="input" width="50" placeholder="Tag name" tiddler="$:/temp/myfavtag"/>

Found <$count filter="[tag{$:/temp/myfavtag}]"/> matching tiddlers:
<blockquote><$list filter="[tag{$:/temp/myfavtag}]"><<currentTiddler>><br></$list></blockquote>

<$button> Save to one JSON file
   
<$action-sendmessage
          $message
="tm-download-file"
            $param
="$:/core/templates/exporters/JsonFile"
      exportFilter
="[tag{$:/temp/myfavtag}]"
          filename
="tiddlers.json" />
</$button>
<$button> Save to separate JSON files

   <$list filter="[tag{$:/temp/myfavtag}]">
      <$action-sendmessage
          $message="tm-download-file"
            $param="$:/core/templates/exporters/JsonFile"
      exportFilter=<<currentTiddler>>
          filename={{{ [<currentTiddler>addsuffix[.json]] }}} />
   </$list>
</$button>

That should do it, or at least get you close to what you want.

Let me know how it goes.

enjoy,
-e

TonyM

unread,
May 19, 2020, 9:12:15 PM5/19/20
to TiddlyWiki
Eric,

A Version of this that saves selected or filtered tiddlers to a jason tiddler, would be another option and helpful, because it can use the default export mechanism but also be a way to package tiddler that can be dragged and dropped, from the current wiki. Once packed there is not need to maintain a tag on each of the tiddlers.

Regards
Tony

Mark S.

unread,
May 19, 2020, 10:18:34 PM5/19/20
to TiddlyWiki
The original post asks about multiple tid files. When I try to adapt your code like this:

   <$list filter="[tag[HelloThere]]">
      <$action-sendmessage
          $message="tm-download-file"
            $param="$:/core/templates/exporters/TidFile"
      exportFilter=<
<currentTiddler>>
          filename={{{ [
<currentTiddler>addsuffix[.tid]] }}} />
   </$list>
</$button>

all of the generated files are empty. Is that a bug, or is there some reason it's not possible to do multiple tid files?

Thanks!

FrD

unread,
May 20, 2020, 11:48:45 AM5/20/20
to TiddlyWiki
Hi Mark,

It sems to work if you use a cloned version of $:/core/templates/exporters/TidFile
where you remove the +[limit[1]] in the filter.

Regards

FrD

Mark S.

unread,
May 20, 2020, 1:47:45 PM5/20/20
to TiddlyWiki
That works better, but still imperfectly. The "What happened to the original tiddlywiki?" tiddler comes out consistently with 6 blank lines.

The question is, why should it make a difference at all? Each tiddler is passed one by one, so the exporter should treat each tiddler on it's own. And it must do this partially, since files are created for all the tiddlers -- but the files are empty. I'm guessing that it has something to do with timing -- that the individual files don't completely process before the next file is queued up.

Thanks!

Jared Lettau

unread,
May 28, 2020, 2:29:20 PM5/28/20
to TiddlyWiki
There does seem to be a bug here. Tried multiple other options using both json and .tid core exporters and all of them are null when imported. Not sure why the core exporters are not passing the content to the exported files...

As a work around, perhaps there there a more explicit "for each" style loop option that will force individual tiddler save before progressing to the next tiddler? Other ideas?

</jared>


On Tuesday, May 19, 2020 at 3:14:38 PM UTC-7, Jared Lettau wrote:
Reply all
Reply to author
Forward
0 new messages