export tiddlers modified or created today

158 views
Skip to first unread message

Steven Schneider

unread,
Mar 5, 2018, 3:27:17 PM3/5/18
to TiddlyWiki
In an old thread from last year on "Export each tiddler plugin", one of Eric's responses contained this filter listing all tiddlers created or modifed on the date of the current tiddler:

<$list filter="[sameday:created{!!created}] [sameday:modified{!!created}]">
<li><$link><$text text=<<currentTiddler>>/></$link></li>
</$list>

I'd like to be able to export these tiddlers as a json file for further processing.

I'm working on modifying the $:/core/macros/export by using Eric's filter in the macro, and expecting to put <<export-these-tiddlers>> into a new tiddler to generate the export file.

But I'm ending up with a blank json file.

Any thoughts?  (I've highlighted the line of the macro that I modified).

Thanks,

//steve.

---------------------



\define exportButtonFilename(baseFilename)
$baseFilename$$(extension)$
\end

\define export-these-tiddlers(exportFilter:"[sameday:created{!!created}] [sameday:modified{!!created}]",lingoBase,baseFilename:"tiddlers")
<span class="tc-popup-keep"><$button popup=<<qualify "$:/state/popup/export">> tooltip={{$lingoBase$Hint}} aria-label={{$lingoBase$Caption}} class=<<tv-config-toolbar-class>> selectedClass="tc-selected">
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/export-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$lingoBase$Caption}}/></span>
</$list>
</$button></span><$reveal state=<<qualify "$:/state/popup/export">> type="popup" position="below" animate="yes">
<div class="tc-drop-down">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Exporter]]">
<$set name="extension" value={{!!extension}}>
<$button class="tc-btn-invisible">
<$action-sendmessage $message="tm-download-file" $param=<<currentTiddler>> exportFilter="""$exportFilter$""" filename=<<exportButtonFilename """$baseFilename$""">>/>
<$action-deletetiddler $tiddler=<<qualify "$:/state/popup/export">>/>
<$transclude field="description"/>
</$button>
</$set>
</$list>
</div>
</$reveal>
\end 

but I end up with an empty file.


Mark S.

unread,
Mar 5, 2018, 5:46:20 PM3/5/18
to TiddlyWiki
It looks like that action sendmessage evaluates the {{!!created}} somewhere other than at the outer macro.

Using this variation:

\define exportButtonFilename(baseFilename)
$baseFilename$$
(extension)$
\end

\define export-these-tiddlers(xportFilter:"replaceme",lingoBase,baseFilename:"tiddlers")
<$vars exportFilter="""[sameday:created[$(mycreated)$]] [sameday:modified[$(mycreated)$]]""" >

<span class="tc-popup-keep"><$button popup=<<qualify "$:/state/popup/export">> tooltip={{$lingoBase$Hint}} aria-label={{$lingoBase$Caption}} class=<<tv-config-toolbar-class>> selectedClass="tc-selected">
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/export-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$lingoBase$Caption}}/
></span>
</$list>
</
$button></span><$reveal state=<<qualify "$:/state/popup/export">> type="popup" position="below" animate="yes">
<div class="tc-drop-down">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Exporter]]">
<$set name="extension" value={{!!extension}}>
<$button class="tc-btn-invisible">
<$action-sendmessage $message="tm-download-file" $param=<<currentTiddler>> exportFilter=<<exportFilter>> filename=<<exportButtonFilename """$baseFilename$""">>/>

<$action-deletetiddler $tiddler=<<qualify "$:/
state/popup/export">>/>
<$transclude field="
description"/>

</$button>
</$set>
</$list>
</div>
</$reveal>


I then invoked the macro like this:

<$vars mycreated={{!!created}} mymodified={{!!modified}}>
<
<export-these-tiddlers>>
</$vars>

And that seemed to work. Notice that you can no longer actually pass a filter. I suspect that it's possible to incorporate those outer vars back into your macro. As they say, the rest is left as an exercise ...

Good luck,
Mark

Steven Schneider

unread,
Mar 7, 2018, 1:57:21 PM3/7/18
to TiddlyWiki
Mark, thanks!


I corrected two typos, made a modest change, and now it works. You've got "xport" not "export" on the first line of your second \define; and (I think) you need an \end to close the second \define.


In the <$action-sendmessage $message="tm-download-file" call, I wasn't able to get it run with filename=<<exportButtonFilename """$baseFilename$""">> but replaced it with filename=<<exportButtonFilename tiddlers>> and it seemed to work.


Here is the full revised code for future copy/pasters. Dragging a tiddler with this macro into an existing tiddlywiki (say, one found on tiddlyspot, or tiddlywiki.com) one can make changes, and then export the changes to a json file, and circulate the json file for others to use.


For example: <1> download json file attached to this message <2> import it to tiddlywiki.com

//steve.


 

\define exportButtonFilename(baseFilename)
$baseFilename$$(extension)$
\end

\define export-these-tiddlers(exportFilter:"exportFilter",lingoBase,baseFilename:"tiddlers")
<$vars exportFilter="""[sameday:created[$(mycreated)$]] [sameday:modified[$(mycreated)$]]""" >

<span class="tc-popup-keep"><$button popup=<<qualify "$:/state/popup/export">> tooltip={{$lingoBase$Hint}} aria-label={{$lingoBase$Caption}} class=<<tv-config-toolbar-class>> selectedClass="tc-selected">
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/export-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$lingoBase$Caption}}/></span>
</$list>
</$button></span><$reveal state=<<qualify "$:/state/popup/export">> type="popup" position="below" animate="yes">
<div class="tc-drop-down">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Exporter]]">
<$set name="extension" value={{!!extension}}>
<$button class="tc-btn-invisible">
<$action-sendmessage $message="tm-download-file" $param=<<currentTiddler>> exportFilter=<<exportFilter>> filename=<<exportButtonFilename tiddlers>>/>

<$action-deletetiddler $tiddler=<<qualify "$:/
state/popup/export">>/>
<$transclude field="description"/>

</$button>
</$set>
</$list>
</div>
</$reveal>
\end
tiddlers (30).json

Mark S.

unread,
Mar 7, 2018, 3:14:52 PM3/7/18
to TiddlyWiki
The reason it said "xport" is that you don't really need to mod that macro -- it stays the same as in the original.

Good luck!
-- Mark

PMario

unread,
Mar 8, 2018, 3:37:41 AM3/8/18
to tiddl...@googlegroups.com
Hi,

IMO you should have a closer look a the bundler plugin. https://wikilabs.github.io/editions/bundler/

There is a new "Bundles" tab  in the right sidebar, that lets you create and export the bundles.

Clicking the "export icon" will export the bundle.
Clicking the "number" will preview the bundle in the advanced search.

Bundles can be title lists ... or
Filters ... Filter configurations are created in a way, that is compatible with the Advanced Search: Filters  dropdown.
 
If an exported bundle also contains its own configuration, it's easy to distribute, so others can use it too.

have fun!
mario

Mark S.

unread,
Mar 8, 2018, 11:33:02 AM3/8/18
to TiddlyWiki
For the bundler to work the filter would have to be changed to look at a specific tiddler. e.g.

[sameday:created{MyTiddler!!created}] [sameday:modified{MyTiddler!!created}] +[!prefix[$:/]]

This would work if there were only a handful of tiddlers that Steven wanted to use as "master" tiddlers. In which case, the whole macro exercise was kind of moot ;-)

-- Mark

@TiddlyTweeter

unread,
Mar 8, 2018, 1:12:02 PM3/8/18
to TiddlyWiki
"Moot" is a really lovely word with very rich meanings.

If folk mooted more the world would be a more informed place

J.

Mark S. wrote:
... In which case, the whole macro exercise was kind of moot ;-)

Mark S.

unread,
Mar 8, 2018, 1:29:42 PM3/8/18
to TiddlyWiki
Strangely, I have nothing to say about mute points.
Reply all
Reply to author
Forward
0 new messages