curly-injectors to target parent "page" element if no preceding sibling target
See original GitHub issueIf 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:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?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 usespageNumber
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.
Closing this per above. It can be re-opened if we really still need to be able to inject into parent elements directly.