[tw5] Re: Method of using "nth-child(even)" with ""?
If you know the line-height in pre element you can use it to create your custom background with repeating-linear-gradient. In the vanilla theme the (inherit) line-height is 20px, then you can use something like this ``` pre { background: repeating-linear-gradient(#f5f5f5, #f5f5f5 20px, #e0e0e0 20px, #e0e0e0 40px); } ``` El lunes, 21 de febrero de 2022 a las 6:27:09 UTC+1, Eric Shulman escribió: > 1. `<__txt__>` is a *parameter reference* syntax that can only be used > within macro definitions. It is similar to `$txt$`, which is a reference > to the value of the `txt` macro parameter passed into the macro. However, > while occurances of `$txt$` are automatically replaced by the value passed > into the macro when the macro's content is returned, `<__txt__>` is handled > *as > if it was a variable*, and is only evaluated when the macro content is > subsequently parsed by within the calling syntax. It is a shorthand > equivalent to: > > ``` > \define macroname(param) > <$vars param="$param$"> >... references to <> (or if used within a filter) ... >etc. > > \end > ``` > > 2. `splitregexp[...]` is a *filter operator* and is similar to the > `split[...]` filter operator. Note that both `split[..]` and > `splitregexp[...]` find and remove instances of the filter operand value, > producing multiple filter items as a result, which are then available for > further processing by the filter syntax. The difference is that > `splitregexp[...]` accepts *regular expressions* as the value of the > filter operand, while `split[...]` only accepts *literal text*. In this > instance, `splitregexp[\n]` is being used to "split the input (the value of > `<__txt__>`) into separate values by matching (and removing) any `newline` > characters. Each resulting line of text is then assigned to the `line` > variable so it can be referenced in the body of the `<$list>...` > widget, where it is then output, enclosed within `...`, in order > to produce the final result of having separate child elements for each > line, so that the `nth-child(...)` CSS rule can be applied. > > -e > > On Sunday, February 20, 2022 at 5:44:29 PM UTC-8 justin.hu...@gmail.com > wrote: > >> That works! >> >> I can generally grasp how this works, though I'm not familiar with >> <__txt__>splitregexp[\n]] >> >> the only time I've seen \n is to create a new line in python, is it doing >> the same here? >> >> >> >> On Sunday, February 20, 2022 at 8:15:49 PM UTC-5 Eric Shulman wrote: >> >>> If the content of your `` is stored in a separate tiddler or field, >>> you can force the creation of child `` elements, so that >>> `nth-child(even)` can be applied successfully. >>> >>> Give this a try: >>> ``` >>> \define nthchild(txt,bg:"lightgray") >>> \whitespace trim >>> .myClass div:nth-child(even) { background:$bg$; } >>> >>><$list filter="[<__txt__>splitregexp[\n]]" variable="line"> >>><$text text=<>/> >>> >>> >>> \end >>> >>> <$macrocall $name="nthchild" txt={{test}} bg="powderblue"/> >>> ``` >>> >>> where the text content is stored in a tiddler named "test". >>> >>> -e >>> On Sunday, February 20, 2022 at 4:46:32 PM UTC-8 justin.hu...@gmail.com >>> wrote: >>> Ah, well- that's a bummer haha Thank you! On Sunday, February 20, 2022 at 7:30:21 PM UTC-5 Eric Shulman wrote: > Although HTML `` elements can display multiple lines of text, > each line is not a separate child element. > Thus, a CSS rule such as `nth-child(even)` doesn't have any effect > within the `` element. > > -e > On Sunday, February 20, 2022 at 4:13:04 PM UTC-8 > justin.hu...@gmail.com wrote: > >> Hello all, title says it all. >> >> When trying to apply nth-child(even) to use a background color for >> each line when using in my tiddlers, it doesn't seem to work, and >> I'm >> not entirely sure whats causing this. >> >> Any suggestions? >> > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/16414c40-ae45-4165-94b2-5bd8ae1eaf76n%40googlegroups.com.
[tw5] Re: Method of using "nth-child(even)" with ""?
1. `<__txt__>` is a *parameter reference* syntax that can only be used within macro definitions. It is similar to `$txt$`, which is a reference to the value of the `txt` macro parameter passed into the macro. However, while occurances of `$txt$` are automatically replaced by the value passed into the macro when the macro's content is returned, `<__txt__>` is handled *as if it was a variable*, and is only evaluated when the macro content is subsequently parsed by within the calling syntax. It is a shorthand equivalent to: ``` \define macroname(param) <$vars param="$param$"> ... references to <> (or if used within a filter) ... etc. \end ``` 2. `splitregexp[...]` is a *filter operator* and is similar to the `split[...]` filter operator. Note that both `split[..]` and `splitregexp[...]` find and remove instances of the filter operand value, producing multiple filter items as a result, which are then available for further processing by the filter syntax. The difference is that `splitregexp[...]` accepts *regular expressions* as the value of the filter operand, while `split[...]` only accepts *literal text*. In this instance, `splitregexp[\n]` is being used to "split the input (the value of `<__txt__>`) into separate values by matching (and removing) any `newline` characters. Each resulting line of text is then assigned to the `line` variable so it can be referenced in the body of the `<$list>...` widget, where it is then output, enclosed within `...`, in order to produce the final result of having separate child elements for each line, so that the `nth-child(...)` CSS rule can be applied. -e On Sunday, February 20, 2022 at 5:44:29 PM UTC-8 justin.hu...@gmail.com wrote: > That works! > > I can generally grasp how this works, though I'm not familiar with > <__txt__>splitregexp[\n]] > > the only time I've seen \n is to create a new line in python, is it doing > the same here? > > > > On Sunday, February 20, 2022 at 8:15:49 PM UTC-5 Eric Shulman wrote: > >> If the content of your `` is stored in a separate tiddler or field, >> you can force the creation of child `` elements, so that >> `nth-child(even)` can be applied successfully. >> >> Give this a try: >> ``` >> \define nthchild(txt,bg:"lightgray") >> \whitespace trim >> .myClass div:nth-child(even) { background:$bg$; } >> >><$list filter="[<__txt__>splitregexp[\n]]" variable="line"> >><$text text=<>/> >> >> >> \end >> >> <$macrocall $name="nthchild" txt={{test}} bg="powderblue"/> >> ``` >> >> where the text content is stored in a tiddler named "test". >> >> -e >> On Sunday, February 20, 2022 at 4:46:32 PM UTC-8 justin.hu...@gmail.com >> wrote: >> >>> Ah, well- that's a bummer haha >>> >>> Thank you! >>> On Sunday, February 20, 2022 at 7:30:21 PM UTC-5 Eric Shulman wrote: >>> Although HTML `` elements can display multiple lines of text, each line is not a separate child element. Thus, a CSS rule such as `nth-child(even)` doesn't have any effect within the `` element. -e On Sunday, February 20, 2022 at 4:13:04 PM UTC-8 justin.hu...@gmail.com wrote: > Hello all, title says it all. > > When trying to apply nth-child(even) to use a background color for > each line when using in my tiddlers, it doesn't seem to work, and > I'm > not entirely sure whats causing this. > > Any suggestions? > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/998c0f3d-feb2-4210-a29f-eec8a96c27c4n%40googlegroups.com.
[tw5] Re: Method of using "nth-child(even)" with ""?
That works! I can generally grasp how this works, though I'm not familiar with <__txt__>splitregexp[\n]] the only time I've seen \n is to create a new line in python, is it doing the same here? On Sunday, February 20, 2022 at 8:15:49 PM UTC-5 Eric Shulman wrote: > If the content of your `` is stored in a separate tiddler or field, > you can force the creation of child `` elements, so that > `nth-child(even)` can be applied successfully. > > Give this a try: > ``` > \define nthchild(txt,bg:"lightgray") > \whitespace trim > .myClass div:nth-child(even) { background:$bg$; } > ><$list filter="[<__txt__>splitregexp[\n]]" variable="line"> ><$text text=<>/> > > > \end > > <$macrocall $name="nthchild" txt={{test}} bg="powderblue"/> > ``` > > where the text content is stored in a tiddler named "test". > > -e > On Sunday, February 20, 2022 at 4:46:32 PM UTC-8 justin.hu...@gmail.com > wrote: > >> Ah, well- that's a bummer haha >> >> Thank you! >> On Sunday, February 20, 2022 at 7:30:21 PM UTC-5 Eric Shulman wrote: >> >>> Although HTML `` elements can display multiple lines of text, each >>> line is not a separate child element. >>> Thus, a CSS rule such as `nth-child(even)` doesn't have any effect >>> within the `` element. >>> >>> -e >>> On Sunday, February 20, 2022 at 4:13:04 PM UTC-8 justin.hu...@gmail.com >>> wrote: >>> Hello all, title says it all. When trying to apply nth-child(even) to use a background color for each line when using in my tiddlers, it doesn't seem to work, and I'm not entirely sure whats causing this. Any suggestions? >>> -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/85cd7147-76e2-4e27-bab4-e91d443221f5n%40googlegroups.com.
[tw5] Re: Method of using "nth-child(even)" with ""?
If the content of your `` is stored in a separate tiddler or field, you can force the creation of child `` elements, so that `nth-child(even)` can be applied successfully. Give this a try: ``` \define nthchild(txt,bg:"lightgray") \whitespace trim .myClass div:nth-child(even) { background:$bg$; } <$list filter="[<__txt__>splitregexp[\n]]" variable="line"> <$text text=<>/> \end <$macrocall $name="nthchild" txt={{test}} bg="powderblue"/> ``` where the text content is stored in a tiddler named "test". -e On Sunday, February 20, 2022 at 4:46:32 PM UTC-8 justin.hu...@gmail.com wrote: > Ah, well- that's a bummer haha > > Thank you! > On Sunday, February 20, 2022 at 7:30:21 PM UTC-5 Eric Shulman wrote: > >> Although HTML `` elements can display multiple lines of text, each >> line is not a separate child element. >> Thus, a CSS rule such as `nth-child(even)` doesn't have any effect within >> the `` element. >> >> -e >> On Sunday, February 20, 2022 at 4:13:04 PM UTC-8 justin.hu...@gmail.com >> wrote: >> >>> Hello all, title says it all. >>> >>> When trying to apply nth-child(even) to use a background color for each >>> line when using in my tiddlers, it doesn't seem to work, and I'm not >>> entirely sure whats causing this. >>> >>> Any suggestions? >>> >> -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a6d7384e-bca3-4dae-be45-7f982d6b70b0n%40googlegroups.com.
[tw5] Re: Method of using "nth-child(even)" with ""?
Ah, well- that's a bummer haha Thank you! On Sunday, February 20, 2022 at 7:30:21 PM UTC-5 Eric Shulman wrote: > Although HTML `` elements can display multiple lines of text, each > line is not a separate child element. > Thus, a CSS rule such as `nth-child(even)` doesn't have any effect within > the `` element. > > -e > On Sunday, February 20, 2022 at 4:13:04 PM UTC-8 justin.hu...@gmail.com > wrote: > >> Hello all, title says it all. >> >> When trying to apply nth-child(even) to use a background color for each >> line when using in my tiddlers, it doesn't seem to work, and I'm not >> entirely sure whats causing this. >> >> Any suggestions? >> > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/3d884848-fa95-4d18-97b2-8d2b50f59fb1n%40googlegroups.com.
[tw5] Re: Method of using "nth-child(even)" with ""?
Although HTML `` elements can display multiple lines of text, each line is not a separate child element. Thus, a CSS rule such as `nth-child(even)` doesn't have any effect within the `` element. -e On Sunday, February 20, 2022 at 4:13:04 PM UTC-8 justin.hu...@gmail.com wrote: > Hello all, title says it all. > > When trying to apply nth-child(even) to use a background color for each > line when using in my tiddlers, it doesn't seem to work, and I'm not > entirely sure whats causing this. > > Any suggestions? > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/3552f609-86ba-4623-83bc-d8af5160aa58n%40googlegroups.com.