TW for writers: How to concatenate the contents of different tiddlers in one tiddler?

524 views
Skip to first unread message

Stefan Pfister

unread,
Jan 10, 2019, 9:34:08 AM1/10/19
to TiddlyWiki
Hi there,


just a noob's question. I'm writing a story. There are different tiddlers with parts of the story. I transcluded them in order to read in one tiddler. I can print it, I know. But is there a way to concatenate the content of the different tiddlers in only one tiddler to create the final and fixed version of my narration? 

In short: I want to copy and paste the content of some tiddlers with one special tag to only one tiddler with a press of a button. That would be great. Another solution could be to export many tiddlers to only one long textfile. I would prefer the first way, if it's possible.

Are there any solutions around? Or maybe a tip for the right coding?


Regards,
Stefan


Dave Gifford - http://www.giffmex.org/

unread,
Jan 10, 2019, 9:42:42 AM1/10/19
to TiddlyWiki
Hi Stefan

Sorry, I am not following you exactly. What is the actual problem you are running up against? If with transclusion you can read, print or export the content in one tiddler, what do you gain by copying and pasting into one tiddler?

Dave

Stefan Pfister

unread,
Jan 10, 2019, 10:01:01 AM1/10/19
to tiddl...@googlegroups.com
Hi Dave,

assuming I have tiddler1 with the content "This is tiddler1" and tiddler2 with the content "This is tiddler2".


If I export a sample-tiddler (let it name sample-tiddler) which is transcluding these two tiddlers with this code:

{{tiddler1}}


{{tiddler2}}



I will have just the same in the exported tiddler. What I want is the content of tiddler1 and tiddler2 concatenated in one tiddler or in one textfile simply as the normal text:

This is tiddler1.


This is tiddler2.


How can this be achieved? I need the text not the coding of the transclusion. I want to generate a big textfile of different textsnippets as one real text without any wikitext or coding. I'm a writer of fiction. This is the end of the creative writing workflow. Just a static text. Ready for publishing. Sometimes it needs to be converted to other formats too. At the end of the game it has to be a real static text.

Stefan

Willy Tanner

unread,
Jan 10, 2019, 11:16:12 AM1/10/19
to TiddlyWiki
It is totally possible that I am getting you wrong but what I think you describe sounds wrong. The expected behaviour of transclusion is what you describe as your desired result, whilst what you describe as the outcome you are seeing is the edit mode of the tiddler.

You should definitely see the text body of the transcluded tiddlers neatly combined in a single tiddler (in its display mode!)

Hope this helps (ignore me if I misunderstood your problem)

Stefan Pfister

unread,
Jan 10, 2019, 11:41:14 AM1/10/19
to tiddl...@googlegroups.com
Yes Willy, 

you misunderstood my problem. To make a long story short: For instance - I have three tiddlers with text in it. Name it tiddler1, tiddler2, tiddler3. I want to concatenate the text in these three tiddlers. I want to merge the content, which is splitt into three tiddlers. I don't want to transclude. I want copy and paste. I want to have one sample-tiddler, in which is the whole text of tiddler1, tiddler2, tiddler3. The real plain text. I don't even want to keep the original three tiddlers (tiddler1, tiddler2, tiddler3). They should be deleted at the end. Sorry for my english. I'm not a native speaker.

To avoid further misunderstandings: Static html is not what I need. I need a file with good old plain text in the end.

Thomas Elmiger

unread,
Jan 10, 2019, 12:05:40 PM1/10/19
to TiddlyWiki
Hi Stefan

I might have the perfect tool for you. But still in the making. Not documented well, features might be missing. And it works the other way round.

The general idea is: you collect all your tiddlers in the story river (like when you were writing I suppose). Then we remove all unwanted elements from the story river... And you can copy the whole text from the story river and paste it in any other program you wish. Maybe a simple text editor or a layout software.

No need to concatenate and you can use formatted text too. How does that sound?

A demo should be ready soon.

---

Support in Deutsch ist auch möglich.

Beste Grüsse
Thomas

Scott Kingery

unread,
Jan 10, 2019, 12:15:26 PM1/10/19
to TiddlyWiki
Sounds like you want to gather up all the text from several different tiddlers, copy it into a new tiddler and then delete the original tiddlers. Does that sound right?

There might be an automatic way to do it but I'd do it by hand just so I didn't lose any of my writing.

Putting this in a tiddler would give me everything that I had tagged MyStory sorted by the title of the tiddler
<$list filter="[tag[MyStory]sort[title]]">
<$transclude mode="block"/>
</$list>


Then I'd copy all that and put it in a new tiddler and delete all the tiddlers (tiddler1, tiddler2, tiddler3)

I could build another tiddler that would give me a button to delete everything tagged MyStory

\define MyFilter()
[tag[$(MyTag)$]sort[title]]
\end
\define delbytag()
   
<$button>Delete Tagged
   
<$action-deletetiddler $filter=<<MyFilter>>/>
   </
$button>
\end

<$set name="MyTag" value=MyStory>

<$macrocall $name="delbytag"></$macrocall>

Joe Armstrong

unread,
Jan 10, 2019, 12:49:13 PM1/10/19
to TiddlyWiki
I don't know how to create a single text file - but you can make a single PDF as follows

I did export-tiddler in the drop down menu of the master
tiddler - then exported this as static HTML.

Then I read the HTML into firefox and exported it as PDF. 


The result was OK but I don't have fine control over the formatting

The same operation with chrome didn't work correctly.

Cheers

/Joe

Eric Shulman

unread,
Jan 10, 2019, 12:54:19 PM1/10/19
to TiddlyWiki
On Thursday, January 10, 2019 at 6:34:08 AM UTC-8, Stefan Pfister wrote:
In short: I want to copy and paste the content of some tiddlers with one special tag to only one tiddler with a press of a button.

1) First, we need some wiki syntax for generating the desired output.  Something like this:
<$list filter="[tag[About]]"><$text text={{!!text}}/></$list>

2) Next, we can 'capture' that output to a variable, using the <$wikify> widget:
<$wikify name="out" text="""<$list filter="[tag[About]]"><$text text={{!!text}}/></$list>""">
   <
<out>>
</$wikify>

3) Then, wrap that in a button so we can trigger an action to save the output to a tiddler instead of directly rendering the output:
<$button> CLICK ME
   <$wikify name="out" text="""<$list filter="[tag[About]]"><$text text={{!!text}}/></$list>""">
      <$action-setfield $tiddler="JoinedOutput" text=<
<out>> />
   </$wikify>
</$button>

4) Finally, for convenient re-use, wrap the entire button in a macro definition, and replace the literal values with macro parameter references
\define join(label,tag,target)
<$button> $label$
   
<$wikify name="out" text="""<$list filter="[tag[$tag$]]"><$text text={{!!text}}/></$list>""">
     
<$action-setfield $tiddler="$target$" text=<<out>> />
   </
$wikify>
</$button>
\end

<<join "CLICK ME" "About" "JoinedOutput">>

That should do it... let me know how it goes.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals

Stefan Pfister

unread,
Jan 10, 2019, 2:14:49 PM1/10/19
to TiddlyWiki
Wow, thank you very much Eric. This is really impressive and the solution for my problem. It works really good. If you change the contents of the source-tiddlers, then the repeated call of the macro even updates the changes in the output-tiddler.

Really cool. You made my day. This macro should be an official built in core feature as a button in the tool section.


Regards,
Stefan

Stefan Pfister

unread,
Jan 10, 2019, 2:16:23 PM1/10/19
to TiddlyWiki


Am Donnerstag, 10. Januar 2019 18:05:40 UTC+1 schrieb Thomas Elmiger:
Hi Stefan

I might have the perfect tool for you. But still in the making. Not documented well, features might be missing. And it works the other way round. 

Sounds interesting. ;)


TonyM

unread,
Jan 10, 2019, 4:53:34 PM1/10/19
to TiddlyWiki
Stefan,

Eric has given you a great solution. I think others where confused as to why you wanted to do this. When your text is broken into separate tiddlers you can reorder them, tag them separately and more. In fact a lot of people take large tiddlers and use excise to break them up into separate tiddlers. Even with separate tiddlers we can make them look like one tiddler.

Of course we all have our own reasons to do what we want but I just wanted to share this community knowledge with you. This process of yours is in fact loosing information in the process, the information in the separation of content across tiddlers.

Regards
Tony

TonyM

unread,
Jan 10, 2019, 4:56:18 PM1/10/19
to TiddlyWiki
Joe,

You can open a tiddler in a new window, and print from there to a PDF printer (Eg Foxit) to do this more directly.

You can also set up a plain text printer - send to file and print to that printer (in Windows) to generate text files with any extension.
 
Regards
Tony

Stefan Pfister

unread,
Jan 11, 2019, 3:08:09 AM1/11/19
to tiddl...@googlegroups.com
Hi Tony,

Am Donnerstag, 10. Januar 2019 22:53:34 UTC+1 schrieb TonyM:
Stefan,

Eric has given you a great solution. I think others where confused as to why you wanted to do this. When your text is broken into separate tiddlers you can reorder them, tag them separately and more. In fact a lot of people take large tiddlers and use excise to break them up into separate tiddlers. Even with separate tiddlers we can make them look like one tiddler.


I understand what you mean. I had the problem to explain the issue clear. Therefore I made a simplification. The solution of Eric is great. Thanks again @Eric.

Nevertheless as a creative writer I have different needs. Really the opposite of the granular tiddler philosophy. I have to form a long text of small chunks - a real text, not a dynamic view of text snippets. "look like one tiddler" is not enough. I need exactly one tiddler with the real thing. I have to process the long text with other software in his final state.

Now I can really do creative work: 

1.) Create different Tiddlers with the same tag for instance "story1". => different pieces of text in different tiddlers

2.) list all snippets (different tiddlers) in a tiddler with the line

<<list-tagged-draggable tag:"story1">>

3.) In the same tiddler I inserted the solution of eric (the definition of the macro is in another tiddler):

<<join "CLICK ME" "story1" "JoinedOutput">>

The workflow is grateful. I write different pieces of a story, a novel, a long text. I can show the titles as a list in a tiddler. I create a long text with the push of a button. And - really good stuff - I can reorder the pieces, the chapter, the different tiddlers with the tag "story1" with drag'n drop. And again push the button: A new long text with different order is created. With the push of a button. Every time I want.

Now I can go further. If I had to change the format of the whole text in order to prepare it for print or publish. I can easy export the tiddler as tid-format as real plain text.

I don't understand why this is not requested by other people?

Regards,
Stefan

Mark S.

unread,
Jan 11, 2019, 10:35:30 AM1/11/19
to TiddlyWiki
How is creating the single tiddler better than just copying the text of your output tiddler and pasting it into a word processor?

The temptation, once you put everything into one tiddler, is to start making changes to that output tiddler. But then your changes will be lost to your workflow. If your publisher asks you to rearrange chapters, you won't be able to do it without back-porting the changes made in your final output tiddler.

-- Mark

@TiddlyTweeter

unread,
Jan 11, 2019, 11:08:23 AM1/11/19
to TiddlyWiki
Thomas Elmiger wrote:

I might have the perfect tool ...

The general idea is: you collect all your tiddlers in the story river .... Then we [you] remove all unwanted elements from the story river... And you can copy the whole text from the story river and paste it in any other program you wish.

Sounds good.
Josiah 

Jed Carty

unread,
Jan 11, 2019, 11:50:37 AM1/11/19
to TiddlyWiki
I think that a custom exporter would be much more useful than collecting a bunch of tiddlers into one tiddler and then exporting that. You could leave your tiddlers split up and then export them in order into a .txt file so you don't have to do the copy and paste things.

That is probably why this hasn't been done before.

Stefan Pfister

unread,
Jan 12, 2019, 10:19:24 AM1/12/19
to TiddlyWiki
A custom exporter for the result "in order into a .txt file" would be awful.

Dave

unread,
Jan 12, 2019, 10:58:56 AM1/12/19
to TiddlyWiki
Autocorrect? "Awesome" maybe? :D

Stefan Pfister

unread,
Jan 12, 2019, 11:15:10 AM1/12/19
to tiddl...@googlegroups.com
Yes, awesome is better ;)

Am Sa., 12. Jan. 2019, 16:59 hat Dave <ceda...@telus.net> geschrieben:
Autocorrect? "Awesome" maybe?  :D

--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@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/6b8f8cc8-2c48-4d8c-a331-c0ff50adc233%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TonyM

unread,
Jan 12, 2019, 9:43:59 PM1/12/19
to TiddlyWiki
Stephan,

My above post to use the print is a working and possibly better alternate to exporting text.

Stefan Pfister

unread,
Jan 13, 2019, 4:29:55 AM1/13/19
to tiddl...@googlegroups.com
It is always good to have more than one option. All my needs are satisfied. My personal problem is yet solved. This makes TiddlyWiki really great. You can adjust it to your needs. 

Thank you all for your solutions and suggestions.

I don't know, how to mark this thread as solved. Maybe somebody can change this.

Regards,
Stefan

Am So., 13. Jan. 2019, 03:44 hat TonyM <anthony...@gmail.com> geschrieben:
--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Jed Carty

unread,
Jan 13, 2019, 7:08:16 AM1/13/19
to TiddlyWiki
I made a quick exporting tool. You can import it into your wiki (you will have to click a button to create a template tiddler, or you can import the template tiddler as well) then you can give a file name (complete with extension) and a filter and then click export as text and a text file with the contents of the tiddlers gets created and downloaded, or click export as rendered html to get the contents of the tiddler exported as rendered html. If you have a tiddler that already transcludes the tiddlers you want in the correct order you can just give that tiddler title as the filter.

You can get the tool here:

Mohammad

unread,
Jan 13, 2019, 7:22:23 AM1/13/19
to TiddlyWiki
Wonderful addition to TW.

Jed, does it use a template?
Is it possible like other media, use some CSS for exported content?

-Mohammad

Jed Carty

unread,
Jan 13, 2019, 8:28:36 AM1/13/19
to TiddlyWiki
Mohammad,

There are two templates that are made specifically for this. If you just import the tiddler I liked to than a button will appear to generate the templates. Neither one is going to be very useful outside of this tool but they may be useful as examples to build others in the future.

It looks like the exporter does not embed css. So while the class names are included in the correct places, the css definitions are not taken from the wiki. You may be able to embed css into the template and have that be part of the output html but I haven't tried it.

Mohammad

unread,
Jan 13, 2019, 9:10:34 AM1/13/19
to TiddlyWiki
Thanks Jed,
 This is really cool.


--Mohammad

Thomas Elmiger

unread,
Jan 13, 2019, 5:28:27 PM1/13/19
to TiddlyWiki
Inspired by many discussions like this one, I built my own vision of a reader–writer solution.

A demo is live now on my tid.li server: https://tid.li/tw5/test/concept.html

This project is not finished in any way, but some features/plugins are working and it contains a real book, divided in more than 150 tiddlers as demo content. On start up, the whole book should be loaded, so it might be somewhat slow ... but it’s worth it.

I do not have the time for further explanations, but the best thing will be if you play with it, read the story, maybe change the story and see how you get along as a reader or writer.

I hope you can grasp some ideas behind it.

The next week will be busy so answers (and even more: updates) will take some time. Please use my new thread for feedback, I don’t want to hijack this one.

All the best,
Thomas

TonyM

unread,
Jan 13, 2019, 7:04:48 PM1/13/19
to TiddlyWiki
Jed,

Thanks so much, It takes you skill to do this. I have being asking for this for years, people keep invoking mime types and other complications and you put this together which disproves most of the arguments against it.

It now enables building custom batch, command, script and program code export/saves. 

I will look closely at what you did because I would also like a Wikified text output so macros and transcludions are first evaluated before export so we can generate text for export using TiddlyWikis WikiText and widgets.

great work
Tony
Reply all
Reply to author
Forward
0 new messages