Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass text styles downward (from parent to child) #1219

Closed
mojavelinux opened this issue Aug 17, 2019 · 2 comments
Closed

Pass text styles downward (from parent to child) #1219

mojavelinux opened this issue Aug 17, 2019 · 2 comments

Comments

@mojavelinux
Copy link
Member

Currently, text styles (i.e., formatting) are applied on the traversal out of the hierarchy (in Asciidoctor::PDF::FormattedText::Transform). This means that styles are not properly inherited, and sometimes the decision about which style to apply is ambiguous. Instead, the styles should be passed downward through the hierarchy (from parent to child) so that the style on the inner-most element always wins out.

@mojavelinux
Copy link
Member Author

mojavelinux commented Aug 17, 2019

The main issue is this line:

fragments << apply(pcdata).map {|fragment| build_fragment(fragment, tag_name, attributes) }

The inherited settings from the parent fragment need to be passed to apply so that they can be used when building the child fragments.

@mojavelinux
Copy link
Member Author

The way it currently works is that the inner styles are preserved on the way out of the hierarchy, but this is not always reliable.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 12, 2019
…hen parsing, allowing role to override default styles for element
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 12, 2019
…hen parsing, allowing role to override default styles for element
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 12, 2019
…hen parsing, allowing role to override default styles for element
@mojavelinux mojavelinux modified the milestones: v1.5.0, v1.5.0.beta.5 Sep 18, 2019
@mojavelinux mojavelinux self-assigned this Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant