question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

curly-injectors to target parent "page" element if no preceding sibling target

See original GitHub issue

If the {curly-injector} appears as the first chunk on a page (i.e. very beginning of brew, or following a \page) then have the values injected into the enclosing <div class="page V3"> element.

That is, instead of defaulting to treating the {curly-injector} as plain text.


Example: adding a class to a page:

\page
{songsheet}
Non, rien de rien
Non, je ne regrette rien
Ni le bien, qu'on m'a fait
Ni le mal, tout ça m'est bien égal

Note that the usual classes of “page” and “V3” should be retained, even in face of {class="overwrite"}.


Example: adding a lang attribute to a page:

\page
{lang=fr}
Non, rien de rien
Non, je ne regrette rien
Ni le bien, qu'on m'a fait
Ni le mal, tout ça m'est bien égal

(note that adding a lang attribute to the whole brew is a separate issue #1343, and separately needed.) (note 2: here we are injecting a html-attribute, not a style class or style rule. See #1489 for that.)

An attempt to override the id of a <div class="page" id="p123"> should be ignored.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
calculuschildcommented, Feb 18, 2022

Right after \page seems more logical syntax to me. Injector curlies already can be used to target the immediately-preceding element. This expands the syntax to apply to the immediate parent if there is nothing preceding. This could apply to other nesting structures, for instance table cells? Divs?

|  header |  header |
|:-------:|:-------:|
|{blue} hi| not blue|

{{A div
{blue}
content?
}}

Not that we want to implement any of those necessarily.

But my main concern is so far none of our other syntax uses “keywords” to trigger something except for \page and \column, and I’m hoping we can keep those special cases to a minimum. The pagenumber syntax uses pageNumber as a CSS class, but not a functional keyword, if that makes sense. It can be placed anywhere because it’s a standard DIV with an absolute position, so it doesn’t matter where in the markdown it goes.

That’s my 2 cents. I prefer expanding the syntax over adding keywords.

0reactions
Gazook89commented, Nov 20, 2022

Closing this per above. It can be re-opened if we really still need to be able to inject into parent elements directly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Target element only if it doesn't have any subsequent siblings
So basically it was selecting all of the children elements (based on tag names, not classes) and then matched them with a single...
Read more >
XPath Axes - ancestor, parent, following-sibling, preceding ...
In this video, I have explained XPath Axes - ancestor, parent, following - sibling, preceding - sibling, child, descendantXPath Axes methods are ...
Read more >
A Previous Sibling Selector - Jim Nielsen's Blog
And I know how to select any adjacent sibling of an element (which follows it) with div ~ p .
Read more >
Selecting the Previous Sibling of an Element - Responsive Style
Selecting the Previous Sibling of an Element. For the same reason CSS cannot reach the parent element if a given selector, you also...
Read more >
XPath Axes: Ancestor, Following Sibling, Preceding
The parent node may be either root node or element node. The root node has no parent. Therefore, when the current node is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found