Question about changing filename for static exports

80 views
Skip to first unread message

David Gifford

unread,
Jun 12, 2019, 10:06:52 AM6/12/19
to TiddlyWiki
Hi all

Is there a way to tweak TiddlyWiki so that when exporting a tiddler it grabs a different field, say, a 'filename' field, instead of the title field, for the name of the file that is created in the export process?

David Gifford

unread,
Jun 14, 2019, 8:09:46 AM6/14/19
to TiddlyWiki
Bump. Two days and not a peep.

TonyM

unread,
Jun 14, 2019, 7:02:11 PM6/14/19
to TiddlyWiki
Hi David,

I do not have time for a full answer, but so you can keep moving

  • The system tag $:/tags/Exporter marks the exporters so {{$:/tags/Exporter||$:/core/ui/TagTemplate}} is a tag pill which you can use to see them all
  • Then read these exporters, you will note each works differently but typically uses a macro or template to generate what is exported
  • Follow the path to see how each works, you may need to create a new template or macro
  • The json exporter refers to jsontiddlers macro but its not well documented but simply generates the json file.
  • The Export Button is 

    $:/core/ui/Buttons/export-tiddler which call's the macro "exportButton" and exportButtonFilename defined in $:/core/macros/export

  • Ultimately this macro is called with $param containing current tiddler and see "

    filename=" this is where you could modify it
<$action-sendmessage $message="tm-download-file" $param=<<currentTiddler>> exportFilter="""$exportFilter$""" filename=<<exportButtonFilename """$baseFilename$""">>/>

Perhaps you make your own version of the above inside a button that is tagged $:/tags/ViewToolbar

I am off to "the bush" have a nice weekend.

Regards
Tony

Mark S.

unread,
Jun 14, 2019, 7:34:46 PM6/14/19
to TiddlyWiki
Using Tony's helpful research, you can create a tiddler with the following contents:

<$edit-text tiddler="baseFilename" tag="input" size="20"/>
<$macrocall $name="exportButton" exportFilter={{$:/temp/advancedsearch}} lingoBase="$:/language/Buttons/ExportTiddlers/" baseFilename={{baseFilename}}/>

This gives you an input where you can specify the name of your export file.

Whatever filter you have in the advanced search will be used for the download/export.

David Gifford

unread,
Jun 15, 2019, 8:40:33 AM6/15/19
to TiddlyWiki
This is all helpful, thank you Tony and Mark.

Mark's snippet means changing the file name every time. What I am looking for is a way to set the filenames of each tiddler by entering it into its caption field upon creation of the tiddler. That way every time I update and export the tiddler I don't have to remember what filename I gave it. It just exports to that filename automatically. So I am looking at tweaking $:/core/ui/Buttons/export-tiddler from

baseFilename=<<currentTiddler>>

to something like

baseFilename=<<currentTiddler field="caption">>

but I don't know how to write it.

Dave


Mark S.

unread,
Jun 15, 2019, 9:08:01 AM6/15/19
to TiddlyWiki
Maybe baseFilename={{!!caption}}  ??

David Gifford

unread,
Jun 16, 2019, 7:50:39 AM6/16/19
to TiddlyWiki
YES!!!! Thanks Mark!
Reply all
Reply to author
Forward
0 new messages