Improve Typographer Edge Cases#280
Merged
Merged
Conversation
|
@natemoo-re Outstanding! Cc: @bep |
added 2 commits
February 17, 2022 10:13
natemoo-re
commented
Feb 17, 2022
Comment on lines
+234
to
+241
| // special cases: 'twas, 'em, 'net | ||
| if len(line) > 1 && (unicode.IsPunct(before) || unicode.IsSpace(before)) && (line[1] == 't' || line[1] == 'e' || line[1] == 'n' || line[1] == 'l') { | ||
| fmt.Println(string(line)) | ||
| node := gast.NewString(s.Substitutions[Apostrophe]) | ||
| node.SetCode(true) | ||
| block.Advance(1) | ||
| return node | ||
| } |
Contributor
Author
There was a problem hiding this comment.
This is the only change I'm concerned about. I settled with t | e | n | l covering most common abbreviations like 'twas, 'em, and 'net but this is extremely difficult to generalize out to other abbreviations I might not have thought of.
| <p>“Monitor 21"” and “Monitor”"</p> | ||
| //= = = = = = = = = = = = = = = = = = = = = = = =// | ||
|
|
||
| 9: Closing quotation marks within italics |
Contributor
Author
There was a problem hiding this comment.
These test cases are all borrowed from https://gm-typographer.vercel.app/!
Owner
|
@natemoo-re Thanks for your contribution. Open source project should be like this. |
jasikpark
reviewed
Feb 28, 2022
| <p><strong>“At first, things were not clear.”</strong></p> | ||
| //= = = = = = = = = = = = = = = = = = = = = = = =// | ||
|
|
||
| 11: Closing quotation marks within boldfacing and italics |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I mentioned I wanted to help with #180 quite a while ago. I finally found time to do it!
This PR fixes various edge cases with the Typographer extension, with test cases borrowed from @brycewray's https://gm-typographer.vercel.app/.
Closes #180, gohugoio/hugo#9397.
cc @brycewray @skyfaller