-
Notifications
You must be signed in to change notification settings - Fork 15
remove newlines prior to spans in inline_quoted templates #127
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
Conversation
Thanks Nick! In case some background helps, my intention with the adjustment is to prevent newlines from being prepended to classed spans if/when spans are added to source blocks via inline passthrough (useful for controlling where syntax highlighting is applied within a code block). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a while since I've looked at erb
, but I think this looks right. I would, however request two things:
- I'm not sure I understand the case causing this change; @ghyman-oreilly can you please add a test? I can help with that next week if you need it.
- There is a
space-trimming
feature of many templating languages, includingerb
(according to this I found quickly via google). I think that may be a more idiomatic solution. But I'd write the test first, and then see if that vs. this change gets you what you need.
Hi Danny, thanks for the feedback! I've add a test: let me know if that makes the envisioned use case a little clearer, and if you see any glaring opportunities to improve the test. Regarding item 2, from what I can tell from doing a little research online, it looks like trim mode may need to be enabled for the hyphen convention to be recognized in ERB. I haven't been able to find a way to enable the mode when using ERB with the Asciidoctor API, and simply adding the hyphens to the templates hasn't worked for me. Any thoughts? Worst case, the recommended changes seem to do the trick, even if the template is a little ugly. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I left one suggestion to avoid a double assignment. I'm assuming that this test fails, as well, when run without the change? I don't see anything in the test itself ensuring that there is no newline in there, but based on what I understand the test to be testing, looks good 👍
Fix copy/paste error Co-authored-by: Danny Elfanbaum <[email protected]>
Good catch, thank you Danny! Yes, that double assignment was my copy/paste error. :) The test does fail without the template change implemented. There's no explicit check for newlines, but the newline character shows up in the text output and causes the first assertion to fail. Thanks again for all your help with this, much appreciated! |
This is @ghyman-oreilly 's PR