[TW5] How to get numbers 1 2 3 ... in $list filter?

366 views
Skip to first unread message

sini-Kit

unread,
Jan 29, 2016, 11:50:06 AM1/29/16
to TiddlyWiki
Hi! I have a very simple list with several items.  I want to see them but with numbers/

<$list filter="[list[$:/StoryList!!list]]" >
<$view tiddler=<<currentTiddler>> field=title/> "№$myNumber$"
</$list>

I want to see

Anytitle "№1"
Besttitle "№2"
TitleAgain "№3"

is it possible?

Felix Küppers

unread,
Jan 29, 2016, 12:19:20 PM1/29/16
to tiddl...@googlegroups.com
Hi sini-Kit,

use Tobias' make plugin!
http://tobibeer.github.io/tw5-plugins/#make

-Felix
--
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/6fdca25b-0448-4ffc-8e21-1c64c7f2f557%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sini-Kit

unread,
Aug 21, 2016, 8:22:13 AM8/21/16
to TiddlyWiki
Thank you Felix! I hope it will be possible to make it without plugins in future.

пятница, 29 января 2016 г., 20:19:20 UTC+3 пользователь Felix Küppers написал:

Mat

unread,
Aug 21, 2016, 8:52:09 AM8/21/16
to TiddlyWiki
If you only want them displayed with characters+numbers, you can CSS style them for example using the :after pseudo element. I don't remember now exactly how to do it but I think it should be rather easy.

<:-)

Matabele

unread,
Aug 21, 2016, 11:11:00 PM8/21/16
to TiddlyWiki
Hi sini-Kit

You might try something along these lines (you will need to modify the filter to select your list of tiddlers):

<$list filter="1 2 3 4 5 6 7 8 9" variable="count">

No: <
<count>> <$list filter="[my[filter]nth<count>]"/>
</$list>

regards

Matabele

unread,
Aug 21, 2016, 11:43:22 PM8/21/16
to TiddlyWiki
P.S. 

Can't think of a way to auto-generate the integers, but a list of integers (stored elsewhere) could be truncated at the desired number by using the output of the $count widget as parameter to the first[] filter.

regards

Thomas Elmiger

unread,
Aug 22, 2016, 3:24:40 AM8/22/16
to TiddlyWiki
Hi all

How about

<ol>
<$list …
</ol>

and some CSS maybe?

Kind regards, Thomas

sini-Kit

unread,
Aug 22, 2016, 3:26:16 AM8/22/16
to TiddlyWiki
Thank you Matabele, but variant with $list filter="1 2 3 4 5 6 7 8 9" is not very good, because I don't know the number of items beforehand. And if I have only 6 items in my list I get

No: 1 img_59

No: 2 img_60

No: 3 img_61

No: 4 img_62

No: 5 img_63

No: 6 img_64

No: 7

No: 8

No: 9


may be it is possible to use <$count> with limit<$count>  in list with numbers?

понедельник, 22 августа 2016 г., 6:11:00 UTC+3 пользователь Matabele написал:

sini-Kit

unread,
Aug 22, 2016, 3:29:24 AM8/22/16
to TiddlyWiki
CSS is not very good. I want to get numbers 1 of 6, 2 of 6, 3 of 6 and so on

понедельник, 22 августа 2016 г., 10:24:40 UTC+3 пользователь Thomas Elmiger написал:

Jan

unread,
Aug 22, 2016, 6:09:28 AM8/22/16
to tiddl...@googlegroups.com
Hej Sini!
Try this

<$list filter="1 2 3 4 5 6 7 8 9" variable="count">
<$list filter="[list[$:/StoryList]nth<count>]"><<count>>{{!!title}}</$list>

I needed that as well, thanks a lot Matabele!
Jan

Jan

unread,
Aug 22, 2016, 6:25:07 AM8/22/16
to tiddl...@googlegroups.com
Hej Sini!
Try this

<$list filter="1 2 3 4 5 6 7 8 9" variable="count">
<$list filter="[list[$:/StoryList]nth<count>]"><<count>>{{!!title}}</$list>

I needed that as well, thanks a lot Matabele!
And now a new question: How do i get this working in a macro, so that it counts the instances <<ref "footnotetext">> of in a tiddler?

\define ref(text,label:"<<count>>")
<$button popup="$:/state/$label$" class="btn-invisible" style="border-width:0px"><$reveal type="match" text="" default="" state="$:/state/$label$">{{$label$||unwikified}}</$reveal>
<$reveal type="nomatch" text="" default="" state="$:/state/$label$"><span class="footnote">($text$)</span></$reveal> </$button>
\end


Jan


Am 22.08.2016 um 09:26 schrieb sini-Kit:

sini-Kit

unread,
Aug 22, 2016, 1:00:59 PM8/22/16
to TiddlyWiki
Thank you, Jan! I didn't know that it is possible not to close <$list by </$list>

понедельник, 22 августа 2016 г., 13:25:07 UTC+3 пользователь Jan написал:

c pa

unread,
Aug 24, 2016, 2:33:57 PM8/24/16
to TiddlyWiki
I've seen this problem expressed in a number of posts. I solve this problem (How to access the place number of the current item from within a list) as follows

You'll have to do some parsing of the variables to understand how this works. I've had to rewrite this method in many different ways to fit the use-case so its more important to understand how to get a result. I've also written a filter that returns a number rather than a list that can be used in these cases and is sometimes better.
http://cpashow.tiddlyspot.com/#%24%3A%2F_cpa%2Fmacros%2FfilterCount.js

1. In the below, $filter expression$ can be any valid filter expression minus the leading and training brackets)
2. The allbefore operator returns the list of items that are before the item passed to the operator
3. The variable <<item_name>> is the current item being processed
4. Therefore <$count filter="[[$filter expression$]allbefore<item_name>]" /> returns the number of items before the current item (current item number - 1)
5. The append operator adds an item to the end of the list
6. grxnxtlg is the name of a tiddler that is most likely not in the list
7. Therefore <$count filter="[[$filter expression$]append[grxnxtlg]allbefore<item_name>]" /> returns the current item number
8. Therefore <$set variable="current_count" filter="[[$filter expression$]append[grxnxtlg]allbefore<item_name>filter_count[]]" > returns the current item number as a variable within the $set expression

Jan

unread,
Aug 24, 2016, 6:36:57 PM8/24/16
to tiddl...@googlegroups.com
Hi Mark,
Thanks a lot...
this sounds pretty complicated.
I tried the following for my footnotetemplate, alas without succes:

\def fnumber()
<$set variable="current_count" filter="[all[current]append[grxnxtlg]allbefore<item_name>filter_count[]]"><current count></$list>
\end

\define ref(text,label:<<fnumber>>)

<$button popup="$:/state/$label$" class="btn-invisible" style="border-width:0px"><$reveal type="match" text="" default="" state="$:/state/$label$">{{$label$||unwikified}}</$reveal>
<$reveal type="nomatch" text="" default="" state="$:/state/$label$"><span class="footnote">($text$)</span></$reveal> </$button>
\end

Can you tell where my bug is or am I totally wrong.
--
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.

c pa

unread,
Aug 25, 2016, 4:42:20 PM8/25/16
to TiddlyWiki
Ah hah. Got it

Use Case:
1. I want to create footnotes in my document in the form of <<footnote "This is some footnote text">>
    e.g.: This is some text <<ref "Text is a collection of letters, spaces and numbers">> And this is a formula: 2+3=5 <<ref "A formula is numbers plus operators">>
    should display as: This is some text 1 And this is a formula: 2+3=5 2
    with the footnote numbers popping up the text when clicked
2. I want the footnotes to be numbered sequentially when displayed without me having to manually enter the footnote number
3. I want the footnote text to display in a popup when the number is clicked

The problem is with #2, auto-generation of numbers within the text on a page. I don't know of any facility in TiddlyWiki that can do that without some trickiness.

Trickiness options
1. Store the footnote text as entries in a list with the list sorted in the order of their presentation on the page
2. Just manually enter the footnote number as a macro parameter and forget the "automatically" part of request #2

\define footnote(tiddler, text, number)
    <$set name="state" value="$:/state/$tiddler$/$number$">
         <$button popup=<<state>> class="btn-invisible" style="border-width:0px">
               <$reveal type="match" text="" default="" state=<<state>> >
                      $number$
              
</$reveal>
               <$reveal type="nomatch" text="" default="" state=<<state>> >
                      <span class="footnote">
                            $text$
                      </
span>
               </$reveal>
           </$button>
    </$set>
\end
\define ref(text, number)
    <$macrocall $name="footnote" tiddler=<<currentTiddler>> text="$text$" number="$number$" />
\end

This is some text <<ref "Text is a collection of letters, spaces and numbers" "1">> And this is a formula: 2+3=5 <<ref "A formula is numbers plus operators" "2">>

Thomas Elmiger

unread,
Aug 26, 2016, 4:29:02 AM8/26/16
to TiddlyWiki
Hi folks!

I think it is possible, but don’t have the time to explain or publish my test at the moment. Will be back tomorrow …

In the meantime you can have a look at: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Lists_and_Counters/Using_CSS_counters

Kind regards, Thomas (in a hurry)

Jan

unread,
Aug 26, 2016, 9:26:11 AM8/26/16
to tiddl...@googlegroups.com
Hi Mark, Hi Thomas,
Great Idea using this css-feature, I hope this will work.
This is a missing part in turning TW into a tool for scientific research.

Mark, Do you think your "trickness option 1." could be done with a List that will be automatically generated?
It would be great if we were able to display this as endnotes/footnotes.

Jan
--
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.

Thomas Elmiger

unread,
Aug 26, 2016, 8:12:19 PM8/26/16
to TiddlyWiki
Hi again :–)

c pa’s use case is solved using a CSS counter and my little tool TextStretch: http://tid.li/tw5/hacks.html#TextStretch%20Variant%20Footnote
It might need some styling and tuning and is just tested in Firefox on my Mac. But I think it is a valid proof of concept.

Let me know if this works for you.

Have a nice weekend
Thomas

(And before you ask: I do not think it would be possible to generate a list with all references at the end of the article.)

Jan

unread,
Aug 27, 2016, 8:54:13 PM8/27/16
to tiddl...@googlegroups.com
Thanks a lot Thomas for coding the Numbers into your [[TextStretchMacro| http://tid.li/tw5/hacks.html#TextStretch%20Variant%20Footnote]]

I installed  a fork of it on http://slidesnstories.tiddlyspot.com/#TextStretch%20by%20Thomas%20Elminger

It works great. I made small modifications for my needs:
- I changed the [[$:/_telmiger/strex]] to display the content not as a popup but in (brackets), because this is easier for printing.
- And I changed the $:/_telmiger/strex.css to get the numbers superscript and to make the buttons less visible.

The macro can simply be called
```<<ref "like this">> ```
Which renders <<ref "like this">>

For scientific publishing it is vitally necessary to be able to collect print the references at the bootom of the page or as Endnotes.
I made some [[attempts|The Footnoteproblem]] to write a filter
and tried modifying Mat's [[cherrypicker|CherryPickerMod]]<<ref "cherrypicker.tiddlyspot.com">>, but so far I failed.

Another wish: It would be nice for footnotes to keep internal and external Links clickable!

So thanks again for this great enhancement,
Jan
--
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.

Jan

unread,
Aug 27, 2016, 9:06:28 PM8/27/16
to TiddlyWiki
Hi Thomas,
I did't see your postscriptum... sorry.

>>And before you ask: I do not think it would be possible to generate a list with all references at the end of the article.<<

Something close to it is working here: http://tiddlystuff.tiddlyspot.com/#Idea%20for%20a%20footnote%20filter.
Pigs can fly...seemingly

cheers Jan

Thomas Elmiger

unread,
Aug 28, 2016, 6:02:01 AM8/28/16
to TiddlyWiki
Hi Jan

Thanks for trying my stuff! I will have a closer look at your improvements later. Your link to <<ref "[[cherrypicker.tiddlyspot.com]]">> should work if you put http:// in front of it.

And don’t let you stop by my postscriptum … I meant: It seems not possible for ME (at the moment). But go ahead!

Have a nice Sunday!
Thomas
Reply all
Reply to author
Forward
0 new messages