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

Adjacent text nodes with hanging punctuation #6

Closed
davidmerfield opened this issue Aug 17, 2015 · 2 comments
Closed

Adjacent text nodes with hanging punctuation #6

davidmerfield opened this issue Aug 17, 2015 · 2 comments
Labels

Comments

@davidmerfield
Copy link
Owner

<p>Hello, <em>"Mr"</em> Fox.</p>

I need to insert a spacer when the adjacent sibling is a text node.

@davidmerfield
Copy link
Owner Author

So my approach to solving this is as follows:

If a text node begins with punctuation that needs to be hung:

Then check if its parent node's previous sibling is also a text node, and if so add the appropriate spacer to the end.

Likewise, if a text node ends with punctuation that needs to be hung

Check if its parent node's next sibling is also a text node, and if so add the appropriate spacer to the start.

What if the text node is not the sole child of its parent? Should I not then apply this process to the siblings of the text node and not its parent?

@davidmerfield
Copy link
Owner Author

Fixed in 77df127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant