Transclude tiddler title or text field as a "combination".

253 views
Skip to first unread message

vinvi...@gmail.com

unread,
Oct 13, 2020, 11:45:04 AM10/13/20
to TiddlyWiki
Hello,

Tiddlers a + b are tagged with tiddler 1.
Tiddlers a + c + d are tagged with tiddler 2.
Tiddlers a + b + c + d are tagged with (Ip).

In tiddler (Ip), I want to show ALL letter combinations: (transclude tiddler titles as a link)
POSSIBLE COMBINATIONS:
a + b → tiddler 1
a + c + d → tiddler 2

In tiddler a, I want to show all letter combinations with tiddler a: (transclude tiddler titles as a link)
POSSIBLE COMBINATIONS:
a + b → tiddler 1
a + c + d → tiddler 2

In tiddler b, I want to show all letter combinations with tiddler b: (transclude tiddler titles as a link)
POSSIBLE COMBINATIONS:
b + a → tiddler 2

In tiddler 1, I want to show the letter combination: (transclude textfield of tiddlers)
a + b

In tiddler 2, I want to show the letter combination: (transclude textfield of tiddlers)
a + c + d

Many thanks,

Thomas Stone

unread,
Oct 14, 2020, 5:38:20 AM10/14/20
to TiddlyWiki

You need to include some sample code for what you have tried. And you should limit your question to just one issue at first, and if you get that answer you can try to solve the rest on your own.

In Tiddler a, you can post the code you tried. Otherwise, there is no "code problem" to brainstorm around. You're just wanting others to do your work for you.

Felicia Crow

unread,
Oct 14, 2020, 4:38:41 PM10/14/20
to TiddlyWiki
Hi,

Sorry to not be able to answer with a concrete solution, but I am not sure I understand the problem correctly, which can totally be my fault for missing the obvious.

Would the output in tiddler 1 for instance be literally a + b or whatever is in the text fields of tiddlers a and b combined? So if say tiddler a had the text of 'lorem ipsum' and tiddler b contained 'dolor sit amet' would you expect to see 'lorem ipsum dolor sit amet' in tiddler 1?

Maybe you could also give some background on what you are trying to achieve with this since this could make your thinking easier to follow, maybe lead to other/easier solutions for the same problem.

Kind Regards,
Felicia

vinvi...@gmail.com

unread,
Oct 15, 2020, 5:39:31 AM10/15/20
to TiddlyWiki
Hi,

First of all, thank you,

You are both right. I don't mean to lean back and let you do all the work.
As for the code: I have no idea. I don't know code and I don"t know what is a convenient approach is here.
Maybe you guys know a better approach? Unfortunately, I can't change the order of the tags.

I will try to get my "problem" clear with colors: (Each color is a tiddler)

There are three basic colors: Red, yellow and blue.
And there are three mixing colors: Orange, green and violet.
So there are three combinations: Red + yellow = orange / yellow + blue = green / blue + red = violet.

* Orange (tags: COLOR + MIXED COLOR)
** Red (tags: COLOR + BASIC COLOR + ORANGE + VIOLET)
** Yellow (tags: COLOR + BASIC COLOR + ORANGE + GREEN)
* Green
** Yellow
** Blue
* Violet
** Blue (tags: COLOR + BASIC COLOR + GREEN + VIOLET)
** Red

PURPOSE: Show in the "Tiddler Red" all possible color combinations with the color red in the following way: (See image).

red.png
Thank you,

Op woensdag 14 oktober 2020 om 22:38:41 UTC+2 schreef Felicia Crow:

TW Tones

unread,
Oct 15, 2020, 6:07:52 PM10/15/20
to TiddlyWiki
Hi,

You have managed to give us what you see as the logic, now you have hinted at color recombination's which is an interesting idea.

Perhaps however there is another approach. If you could explain what you want without complicating it with a partial solution there may be other options.

I understand you want to provide a kind of primary color mixer. But since there is a limited number of possibilities a manual solution may be all you need.
Tag all the non-primary colors with their primary colors so a tiddler named orange would have the tags red and yellow

If however you want to get into much larger colour ranges and schemes there is a lot more you can do one example if using the R G B colour scheme .

See color action here https://tid.li/tw5/plugins.html

I also have a large collection of color names somewhere I cant presently find, but it includes the RGB values as well.

I will keep looking later

Tones 

Eric Shulman

unread,
Oct 15, 2020, 7:01:09 PM10/15/20
to TiddlyWiki
On Thursday, October 15, 2020 at 3:07:52 PM UTC-7, TW Tones wrote:
I also have a large collection of color names somewhere I cant presently find, but it includes the RGB values as well.

Charlie Veniot

unread,
Oct 16, 2020, 9:50:25 PM10/16/20
to TiddlyWiki
I couldn't stop thinking about how I'd go about that, so I decided to scratch the itch and treat this like a "Brain Age" game and happily played.

Well, minus fancy table.  I'm thinking markdown table is not a good idea for this, and (although easy) I wasn't in the mood to play with HTML tables.

For the $hit$ and the giggle$:  Colour Thing

Have fun and tear it to pieces.  Keep in mind: I'm not yet quite a TiddlyWiki yellow belt, and I also tend to see things in pretty funky ways, so take it all in with a healthy dose of salt !

Cheers !

vinvi...@gmail.com

unread,
Oct 18, 2020, 4:37:49 AM10/18/20
to TiddlyWiki
Thanks everyone.

Charlie Veniot, you hit the nail on the head. Thank you!
It still needs some tweaking, but this is exactly what I mean. (I don't mind the table.) 
Thanks again.

Op zaterdag 17 oktober 2020 om 03:50:25 UTC+2 schreef Charlie Veniot:

Charlie Veniot

unread,
Oct 18, 2020, 10:43:29 AM10/18/20
to tiddl...@googlegroups.com
Well, a few thumbs tend to get whacked along the way when one tends to be all thumbs.

And the head o' the nail may get smacked a few more times than warranted ...

When you get to your destination and if possible, please share your creation !

Felicia Crow

unread,
Oct 19, 2020, 7:19:14 AM10/19/20
to TiddlyWiki
Sorry a little late, but my brain was out of commission for the weekend so I only finished my solution now, but good to see that Charlie could help you already.

Still if you are interested: I used two macros working with the given titles/tags to make it more modular so it can be extended in the future. The only thing I have yet to work out is different combinations for the same colour.

The first and simpler macro is used to get the colours needed to mix the colour:

\define get-combination()
<$list filter="[!has[draft.of]tag<currentTiddler>sort[title]first[]]">
<$link to=<<currentTiddler>> />
</
$list>
<$list filter="[!has[draft.of]tag<currentTiddler>sort[title]butfirst[]]">
+ <$link to=<<currentTiddler>> />
</
$list>
\end

The only difference between the filters is that the first only uses the first result and the second uses the rest to get the formatting of 'colour + colour' with as many '+ colour' as needed for the current combination.
So the filter in  detail:
  1. !has[draft.of] just makes sure that only tiddlers not currently edited are used.
  2. tag<currentTiddler> looks for tiddlers that are tagged with the title of the tiddler the macro is called in. For instance if you call the macro in a tiddler called 'Orange' it will look if there are tiddlers tagged 'Orange'.
  3. sort[title] sorts the resulting list by the tiddlers titles.
  4. first[] then discards everything except for the first title in the list and butfirst[] does the opposite and takes the rest.
The second macro that is used to get all combinations with a specific colour:

\define get-color-combinations()
<$list filter="[<currentTiddler>tags[]]" variable="tag">
<$list filter="[<tag>tag[Mixed Color]]" variable="mixed-color">
<<currentTiddler>>
<$list filter="[!has[draft.of]tag<mixed-color>!<currentTiddler>]" variable="other-color">
 
+ <$link to=<<other-color>> />
</
$list>
= <$link to=<<mixed-color>> />
<br /
>
</$list>
</
$list>
\end

And the details:
  1. The first list just gets all the tiddlers of the currentTiddler and puts it in a variable called tag as to not overwrite currentTiddler.
  2. The second list filters for mixed colors related to the currentTiddler.
    1. <tag> is just a shortform of title<tag> and looks for a tiddler that is named the same as the value of the tag variable.
    2. tag[Mixed Color] then looks if the tiddler it found has the tag 'Mixed Color'.
    3. the result gets put into a variable called mixed-color once again so currentTiddler isn't overwritten.
  3. Then the title of the current tiddler is 'printed' as the first part of the final text. This is not a link as this is the currently used tiddler.
  4. The third list then looks for the other colour/colours that are tagged with the current mixed-color.
    1. !has[draft.of] once again making sure only tiddlers not being edited get used.
    2. tag<mixed-color> looks for tiddlers tagged with the value of mixed-color.
    3. !<currentTiddler> but only take those that aren't the current-tiddler.
    4. and another variable this time called other-color.
  5. Now print each found colour with '+ other-color' to create the second part of the result. These are all links to their respective tiddlers.
  6. And finally when the previous list is finished with adding colours add '= mixed-color' plus a line-break as the third and last part of the result. Once again this is a link to the tiddler.
The first macro can be used both in tiddler with a mixed colour and in a general combination overview like so:
<$list filter="[!has[draft.of]tag[Mixed Color]sort[title]]" >
<$link to=<
<currentTiddler>> />:
<
<get-combination>>
<br />
</$list>

The second macro can be used in any colour tiddler that is part of a mixed colour both basic colour and mixed colour.

And because this reply is not long enough already here a few screenshots:

Tiddler 'Red' with <<get-color-combinations>> in use also showing a combination from three colours:


Tiddler 'Green' showing the colours needed to mix it via <<get-combination>>:

The overview tiddler of possible combinations:

And a version of the Violet Tiddler that uses both macors:

I attached a json file for easy import should you want to use it/play around with it.
Also I second Charlie in that I would love to see whatever the end result might be.

Kind Regards,
Felicia


On Tuesday, 13 October 2020 17:45:04 UTC+2, vinvi...@gmail.com wrote:
color-macros.json
Reply all
Reply to author
Forward
0 new messages