I'm trying to find a diazo rule to append a new element in a container before its closing tag. For example:
Case 1
<div class="some-A">
<div class="some-B">1</div>
<div class="some-B">2</div>
<div class="some-B">3</div>
</div>
Case 1 - after rule applied
<div class="some-A">
<div class="some-B">1</div>
<div class="some-B">2</div>
<div class="some-B">3</div>
<div class="some-B">NEW</div>
</div>
Case 2
<div class="some-A">
</div>
Case 2 - after rule applied
<div class="some-A">
<div class="some-B">NEW</div>
</div>
I need to have it working for each case - with and without content in container.
None of these are ok:
<replace css:theme=".some-A">
<div class="some-A">
<div class="some-B">NEW</div>
</div>
</replace>
because replaces all.
<before css:theme=".some-A">
<div class="some-B">NEW</div>
</before>
because appends before my container.
<after css:theme=".some-A">
<div class="some-B">NEW</div>
</after>
because appends after it.
<after css:theme-children=".some-A">
<div class="some-B">NEW</div>
</after>