Best Practice: Tiddlywiki and Structure of Long Note

Yes, a little bit. I actually use YOUR css framework from http://w3css.tiddlyspot.com/ (which is awesome, thanks!).

In my wiki, I have the tiddler called NotePrinter which takes my inputs (Title, list of tiddlers, etc). Then when I click “Show Notes” I have a new window with contents from the parameters I set, transcluded via a template (NotePrinterTemplate in this case). Then on this new window, I can right click and print to pdf if I want).

Here’s the code for the Show Notes button

<$button>
<$action-sendmessage $message="tm-open-window" $param="NotePrinterTemplate" 
shownote="true"
windowTitle={{$:/temp/noteprinter##windowtitle}}
noteTitle={{$:/temp/noteprinter##notetitle}}
noteSubTitle={{$:/temp/noteprinter##notesubtitle}}
noteFilter={{$:/temp/noteprinter##filter}}
width="900"
height="900"
/>
Show Notes
</$button>

And here are the contents from NotePrinterTemplate. It’s quite basic and I’m no css expert!

<$list filter="[<shownote>!match[true]]">
No notes
</$list>
<$list filter="[<shownote>match[true]]">
<div class="w3-center">

! <<noteTitle>>
<<noteSubTitle>>
</div>

<$list filter=<<noteFilter>>>
<div class="py-2 w3-container">
<h2 class="note-title-line"><$view field="caption">{{!!title}}</$view></h2>

<$transclude field="text" mode="block"/>

</div>

</$list>
</$list>

<style>
.note-title-line {
margin-top: 0.4in;
padding-bottom: 5px;
border-bottom: 0.05px solid <<color foreground>>;
}
</style>
2 Likes

Many thanks Pak! Very interesting and useful!
Thank you for sharing the code! It worth to be published! :wink:

Side note: I see you use TW for academic texts (full of math, diagrams, …)

1 Like

Thanks! Yep, I use TW for my math class and I use KaTeX extensively :slight_smile:

@Pak I like the idea that you kind of have a print preparation step. I imagine its best for an occasional print more than if you had to do a lot.

  • I suppose you could pull that information from each note tiddlers fields as well.
  • Do you make any attempt to handle page breaks?
  • Is it even possible to print PDF’s without page breaks?
  • Do you make any attempt to handle page breaks?

No. The new window is simply one webpage with long text. I let the pdf printer handle the page breaks itself (which depend on the paper size setting). This is the same as when you compile a LaTeX document.

But if I want to force a page break after every transcluded tiddler I can define a css class

.section-page-break {
page-break-after: always;
}

and transclude every tiddler (or even selectively) with this class.

Here I exported my two tiddlers so you can try in on https://tiddlywiki.com/

noteprinter.json (2.5 KB)

Anyway, I guess my method didn’t quite answer @Mohammad 's original question of how to handle long note Tiddlywiki-way, sorry.

Thank you! We learn from different approaches, your method shows how build a pdf from long tiddlers or a compound tiddler built from many tiddlers at print time!
Thank you!

1 Like

I do this ALL the time, though I call them author-elements and I don’t use the technique at the chapter level. In my world, a chapter is a grouping of tiddlers.

A chapter-section (chapsec) is a tiddler. Chapsecs belonging to the same chapter have the same number/name in their chapter field.

A chapsec might contain zero or more author-elements:

<about-fission>
Stuff about nuclear fission
</about-fission>

<about-bilbo-baggins>
Stuff about Bilbo Baggins
</about-bilbo-baggins>

Another tiddler might be used to pull together (transclude) all the about-bilbo-baggins blocks to present them as one tiddler. Same with about-fission.

To answer @Mohammad’s question:

I favor both patterns and techniques.

Some chapter section tiddlers are small, 100 words or even less. Some contain thousands of words. Basically, however many words (and images) it contains, a chapsec covers a topic, beginning to end.

If a given block of text is likely to be reused in another context, it becomes either:

  1. its own tiddler which I can transclude in its entirety
  2. an <author-element> which I can transclude using a regex macro that splits on the author-element

For #2, I try to conjure text that is self supporting, aiding its use in different contexts. Without doing that, you can end up with “patchwork text” that doesn’t read so well.

1 Like

Thanks @CodaCoder! I like your terminology a chapsec.

Yes, it is a section sometimes is a compound/composite tiddler!

If I understand correctly, you do not use tag to show chpater-tiddler relation! instead you use field chapter.
Do you freely name such sub tiddlers or have some naming rules?

That is correct. I might use tagging for other reasons, but the chapter<>section relationship is as you said, purely a manual process. (The add new chapsec button defaults to adding 10 to the last known chapsec - see below.)

Chapsecs have a title which includes the chapter. So,

  • 1-010 is chapter 1, section 10.
  • REF-125 is chapter “reference”, section 125.

A screenshot might help:

1 Like

There are times when I miss the edit section feature of mediawiki and docuwiki.

Described here: section_editing [DokuWiki]

@CodaCoder - many thanks for detailed explanation!
While there are some manual parts, but the procedure powerful to create real e-books with many chapter!

I don’t understand how this works. I feel like I must be missing something important.

What is the mechanism you’re using to pull these in? Regexp ? If you’re gathering blocks into tiddlers, how do you know in which order?

And does this solve the problem of creating a long document? Are you doing step-wise excision as you work ?

Thanks!

You wrote (most of) the regex :confused:

:flushed:
You have no idea how many times I’ve looked at my code and said, “Who wrote this?”

So do you use CSS to hide away your own tagged areas as you work?

1 Like

With help from Eric and Saq, and the kin plugin, I did get branch level search working. The main advantage is that it uses the toc-expandable macro without modifications. It does require a button, and I know the very thought of all this manual labor strikes fear in the hearts of many TW users. But there you go …

3 Likes

Write more briefly? :innocent:

That is neat and I can see it being very useful in some situations. I imagine you could add keyboard shortcuts as alternatives to the buttons, Enter and Escape perhaps?

Very nice Mark! I assume you find the location of tiddler in tree and then you open the branches up to first level! Very interesting!

This can have many use cases! Maybe its time to publish a plugin :wink:

Well, I have now :grin:

2 Likes

plugins_MAS_TOC-Search.json (5.9 KB)

1 Like