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




On Monday, March 5, 2018 at 5:46:20 PM UTC-5, Mark S. wrote:
>
> 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
>
>  
>
> On Monday, March 5, 2018 at 12:27:17 PM UTC-8, Steven Schneider wrote:
>>
>> In an old thread from last year on "Export each tiddler plugin", one of 
>> Eric's responses 
>> <https://groups.google.com/forum/#!searchin/tiddlywiki/sameday$20journal%7Csort:date/tiddlywiki/V33mvijcKQU/WvIdYPHXBAAJ>
>>  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 
>> <https://tiddlywiki.com/#%24%3A%2Fcore%2Fmacros%2Fexport> 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.
>>
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/66b8e87a-8ee0-4d4a-b265-29d16cfb7129%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: tiddlers (30).json
Description: application/json

Reply via email to