TW5, download set of tiddlers.Some help needed

193 views
Skip to first unread message

Danielo Rodríguez

unread,
Oct 6, 2014, 6:06:28 AM10/6/14
to tiddl...@googlegroups.com
Hello everyone, from http://welford.github.io/ I got one of the easiest solutions to download sets of tiddlers. I don't think it is a better explanation, it just reached my mind at the precise moment.

Here is the tiddler used as template:

\define saveTiddlerFilter()
[[$:/core]] [[$:/isEncrypted]] [[$:/plugins/tiddlywiki/fullscreen]] [[$:/themes/tiddlywiki/vanilla]] [[$:/themes/welford/phasersonkill]] [[$:/themes/welford/readonly]] [[$:/theme]] [[$:/plugins/tiddlywiki/codemirror]] [[$:/plugins/tiddlywiki/highlight]] [[$:/plugins/welford/twexe]] [[$:/plugins/welford/htalink]] [tag[blog]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]
\end
\define savingEmpty()
yes
\end
{{$:/core/templates/tiddlywiki5.html}}

I understand how the filter works. It applies OR to all the titles and the tag filter. The question is that I don't know which tiddlers are mandatory to include. Of course at least one theme, but what about the rest? core,$:/theme,boot, and so on? Can I took that filter as a default and just  modify it?

Evolena

unread,
Oct 6, 2014, 8:19:57 AM10/6/14
to tiddl...@googlegroups.com
You can check the filter for the "download empty" button on tiddlywiki.com, it may be a minimal set for TW5 to work:  http://tiddlywiki.com/#%24%3A%2Feditions%2Ftw5.com%2Fdownload-empty

Here is the filter:
[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]]

Eucaly J

unread,
Oct 18, 2014, 3:05:28 AM10/18/14
to tiddl...@googlegroups.com
Hi all:

The below macro will help to import (save as) a subset of tiddlers by filtering
You may also drag-drop the attached file to install.
Checked on 5.1.0.

Please notice, some previous versions (<=5.0.15), need manual change to tw-download-file, and keep no space after \define someMacro()


\define download-param()
\define saveTiddlerFilter() $(var-core-filter)$ $(var-user-filter)$ +[sort[title]]

\define savingEmpty() yes

{{$:/core/templates/tiddlywiki5.html}}
\end

\define downloadMsg() tm-download-file

\define readyButton()
<$set name="var-user-filter" value={{!!f-filter}}>
<$reveal type="match" state="!!f-core-filter" text="yes">
   
<$set name="var-core-filter" value="[[$:/core]] [[$:/isEncrypted]] [[$:/themes/tiddlywiki/snowwhite]] [[$:/themes/tiddlywiki/vanilla]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]]">
   
<<readyButton_step2>>
   
</$set>
</
$reveal>
<$reveal type="nomatch" state="!!f-core-filter" text="yes">
   
<<readyButton_step2>>
</$reveal>
</
$set>
\end

\define readyButton_step2()
<$button set="$:/temp/saveas/template" setTo=<<download-param>> to={{!!title}} tooltip="I'm ready to go">[4] All settings are OK</$button>
\end

\define saveAsButton()
<$button message=<<downloadMsg>> tooltip=<<downloadMsg>> param="$:/
temp/saveas/template">[5] Save As {{$:/core/images/save-button}}</$button>
\end

\define checkVer()
<$list filter="
[<version>] [[5.0.16]] +[sort[]limit[1]prefix[5.0.16]] [[tm-download-file]] [[tw-download-file]] +[nth[2]]" variable="verMsg">
<$list filter="
[<verMsg>!prefix<downloadMsg>]">

* This ~TiddlyWiki is v<<version>>, please modify `\define downloadMsg()` to ''<<verMsg>>''
* For some versions before `5.0.14`, should keep ''no space'' like `\define downloadMsg()tw-download-file`

</$list></$list>
\end

Please follow below steps to export (save as another file) a subset of tiddlers by filtering.

<<checkVer>>

<ul><li>[1]
<$reveal type="
nomatch" state=<<qualify $:/temp/saveas>> text="ready" default=""> <$checkbox field="f-core-filter" checked="yes" unchecked="no" default="no"/></$reveal> <$list filter="[field:f-core-filter[yes]]" emptyMessage="`Not including`">''Including''</$list> ~TiddlyWiki5 Core
</li>
<ul><li><$list filter="
[field:f-core-filter[yes]]" emptyMessage="Output file is much smaller, you can import them to other ~TiddlyWiki.">
Output file would be functional in a browser.</$list></li></ul>
<li> Filter : ''<$text text={{!!f-filter}}/>''
<$linkcatcher message="
tm-navigate" set=<<qualify $:/temp/saveas>> setTo="filter">
    <$button set="
$:/temp/advancedsearch" setTo={{!!f-filter}} to={{!!title}}>[2] Verify / Config</$button>
</$linkcatcher>
</li>
</ul>

<$reveal type="
nomatch" state=<<qualify $:/temp/saveas>> text="ready" default="">
<$linkcatcher message="
tm-navigate" set=<<qualify $:/temp/saveas>> setTo="ready">
<<readyButton>>
</$linkcatcher>
</$reveal>
<$reveal type="
match" state=<<qualify $:/temp/saveas>> text="filter" default="">
<hr/>
<ul><li> new filter value -- @@color:blue;<$text text={{$:/temp/advancedsearch}}/>@@
    <$button set="
!!f-filter" setTo={{$:/temp/advancedsearch}}>[3] Proceed</$button>
</li></ul>
{{$:/core/ui/AdvancedSearch/Filter}}
</$reveal>

<$reveal type="
match" state=<<qualify $:/temp/saveas>> text="ready" default="">

<$button set=<<qualify $:/temp/saveas>> setTo="">Back</$button>
<hr/>

* [4.1] Now you can double check the template as below,
* And press `Save As`

<<checkVer>>

<<saveAsButton>>

* Below template is generated programmatically  
<pre><$view tiddler="
$:/temp/saveas/template" field="text"/>
</pre>

</$reveal>


TiddlerSaveAs.tid

Danielo Rodríguez

unread,
Oct 18, 2014, 9:55:12 AM10/18/14
to tiddl...@googlegroups.com
Looks very promising!!! 
I will check it out.

Danielo Rodríguez

unread,
Oct 20, 2014, 4:23:13 AM10/20/14
to tiddl...@googlegroups.com
Dear Eucaly,

I have to say that your tiddler is awesome. I like how you have take care of every detail, like detecting the TW version.

I made the necessary adjustments but the download button still not working. Do you know why? I'm using it in 5.0.15. With the necesary adjustments I just mean replace all tm- by tw-
Thank you!

Danielo Rodríguez

unread,
Oct 20, 2014, 4:28:37 AM10/20/14
to tiddl...@googlegroups.com
OK, fixed.

As your tiddler help said, you have to remove the space in the macro definition.

Really, this is an awesome piece of tw softwate. I though about something like this several times, but I never had time to do it. Please, do a separate topic to make easier to find this. Many,many people will find it very useful. Really.

Eucaly J

unread,
Oct 20, 2014, 6:11:29 AM10/20/14
to tiddl...@googlegroups.com
Hi Danielo:

Thanks for your positive feedback.

To consider beta versions is because some people ask in this forum for migrating from early beta like 5.0.7 or so.

The target spec is the warning message will show only when tw- ... or tm- ... not correctly set.
But in some earlier version, the warning message will always show.
This is because the below filter has some bug in version around 5.0.13 or earlier,
If cannot figure out the root cause, I will simply make a different macro for such beta versions.

[<version>] [[5.0.16]] +[sort[]limit[1]prefix[5.0.16]] ...



Danielo Rodríguez於 2014年10月20日星期一UTC+8下午4時28分37秒寫道:
Reply all
Reply to author
Forward
0 new messages