Hey everyone,
I'm using SugarCube 2.x with Twine 2.
I've been very happy about finding out that passages could be tagged to easily apply CSS attributes to them; however, it seems they are trampled by using the <<display>> macro.
That is, if I have a passage that has a specific CSS tag, and inside a <<display "another passage">>, the system formats "another passage" like the one it is nested in, despite "another passage" being tagged to use a different CSS style.
Is there a way to "reverse" this? (i.e. giving precedence to CSS tags of displayed passage on the CSS tags of the passage it's nested in)
Comments
This is not done for tagged passage shown using the <<display>> macro, which is why the CSS associated with the displayed passage's tag is not taking effect.
I suggest wrapping the contents of the passage being displayed in an element with a class and using that class instead the passage's tag.
greyelf suggested work-around isn't a bad one, though it could stand to be automated a bit. Try the following widget macro: (goes in a widget tagged passage) Usage: (use this instead of <<display>> wherever you want this behavior)
That will do what greyelf suggested, but automatically.
You may need to alter the selector sets of your style rules slightly to accommodate the double usage (i.e. to work with normally displayed passages and passages included via <<render>>). For example, if you had passages tagged with forest, which was supposed to make the text green, then the following would work for both: