Export/Import all nested tags?

124 views
Skip to first unread message

Shay Shaked

unread,
May 17, 2018, 7:18:41 AM5/17/18
to TiddlyWiki
I want a section of my TW to be exported into another wiki. The section is defined by a tag, and then there are tags under that tag. Is there a way to export ALL of them to .tid format, and then import them as a bunch to the new wiki, or do I have to drag, one by one?

TonyM

unread,
May 17, 2018, 7:54:40 AM5/17/18
to TiddlyWiki
You can do this with the filter bundle using the bundler plugin.

Regards
Tony

@TiddlyTweeter

unread,
May 17, 2018, 8:04:55 AM5/17/18
to tiddl...@googlegroups.com
Export guidance here ... https://tiddlywiki.com/#How%20to%20export%20tiddlers . See the section on
"Exporting tiddlers matching a criteria (filter)". If all (and only) are covered by the tag then the needed filtered search will be easy. FWIW, JSON export format may be the most appropriate.

In addition there is a "Bundler" plugin by PMario at https://wikilabs.github.io/editions/bundler/#%24%3A%2Fplugins%2Fwikilabs%2Fbundler -- excellent if you want to do this kind of thing regularly and largely automate the process.

Matthew Lauber

unread,
May 17, 2018, 9:55:50 AM5/17/18
to TiddlyWiki
If you add Tobias' toc filter operator http://tobibeer.github.io/tb5/#filter%3A%20toc you should be able to use the advanced search to find all your tiddlers via `[toc[TopLevelTag]]` and then under the dropdown to the right, you should be able to export as json.  You should be able to import from the exported json file.  You can't export as tid, because a tid file can only contain one tiddler.

PMario

unread,
May 17, 2018, 10:11:21 AM5/17/18
to TiddlyWiki
Hi,

My bundler-plugin may be of interest.

have fun!
mario

Mark S.

unread,
May 17, 2018, 10:38:51 AM5/17/18
to TiddlyWiki
Does the bundler-plugin do nested tags (i.e. TOC-style cascading tags) ?

Thanks!
-- Mark

TonyM

unread,
May 17, 2018, 10:51:00 AM5/17/18
to TiddlyWiki
Sounds like matthew in this thred provided the final clue.

Tony

Mark S.

unread,
May 17, 2018, 1:12:44 PM5/17/18
to TiddlyWiki
Here's a solution that doesn't depend on 3rd party javascript. I munged the existing TOC code so it could export a list.

Put the following code in a tiddler:

\define exportlist(tag)
<$button>Create List for ''$tag$''
<$action-listops $tiddler="exports" $filter="[[]]"/>
<<toc2 "$tag$">>
</$button>
\end
\define toc-body2(tag,sort:"",itemClassFilter,exclude,path)
  <$list filter="""[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] -[[$tag$]] $exclude$""">
    <$vars item=<<currentTiddler>> path="""$path$/
$tag$""" excluded="""$exclude$ -[[$tag$]]""">
      <$set name="
toc-item-class" filter="""$itemClassFilter$""" emptyValue="toc-item" value="toc-item-selected">
          <$list filter="
[all[current]toc-link[no]]" emptyMessage="<$action-listops $tiddler='exports'  $subfilter='[{!!title}]'/>">
             <$view field="
title"/><br/>
          </$list>
          <$macrocall $name="
toc-body2" tag=<<item>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$""" exclude=<<excluded>> path=<<path>>/>
       
      </$set>
    </$vars>
  </$list>
\end

\define toc2(tag,sort:"",itemClassFilter:"
")
<<toc-body2 tag:"""
$tag$""" sort:"""$sort$""" itemClassFilter:"""$itemClassFilter$""">>
\end



Then, either make the tiddler a global macro, or inside the tiddler invoke:


<<exportlist "HelloThere">>

Where you replace "HelloThere" with your root tag. This will create a button. Click on the button and it will create your list in the list field of the "exports" tiddler.

Then, go to the filter tab of the advanced search dialog and enter:

[list[exports]]

This will list the items to be exported. Use the export button to export your tiddlers.

I haven't tested this with tags that have spaces, so that's still a question mark. Be sure to make backups!

-- Mark

Birthe C

unread,
May 17, 2018, 1:49:54 PM5/17/18
to TiddlyWiki
Thank you so much, Mark S,
You just saved me a lot of time.

Birthe
Reply all
Reply to author
Forward
0 new messages