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>


-- 
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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Attachment: TiddlerSaveAs.tid
Description: Binary data

Reply via email to