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

Superfluous insertion of whitespace in text #100

Closed
thchr opened this issue Feb 27, 2024 · 3 comments
Closed

Superfluous insertion of whitespace in text #100

thchr opened this issue Feb 27, 2024 · 3 comments

Comments

@thchr
Copy link
Contributor

thchr commented Feb 27, 2024

I expect the below to produce "foobarbaz" - but it produces "foo bar baz":

text(parsehtml("<em>foo</em>bar<em></em>baz").root)

The motivating case was:

text(parsehtml("<math><mrow><msub><mrow><mi>MoSe</mi></mrow><mrow><mn>2</mn></mrow></msub></mrow></math>").root)

which produces "MoSe 2" rather than "MoSe2".

The issue is with the apparently redundant ' ' in

print(io, c.text, ' ')

Would it be acceptable to change this? If so, I can make a PR.

@rapus95
Copy link

rapus95 commented Dec 21, 2024

I just ran into the exact same case where a code block (<code>...<\code>) I was parsing contained .<em>S<\em>. to emphasize the S while the extracted text suddenly contains spaces around the S... Would be nice if that could be fixed. In particular, for em blocks.

Edit: Was there any particular reason for this space in the first place?

@thchr
Copy link
Contributor Author

thchr commented Dec 21, 2024

I think it just needs a maintainer to look at #101. Not sure who that might be though.

@rapus95
Copy link

rapus95 commented Dec 21, 2024

@pfitzseb since you were the last one to work on that part of code, was there a certain reason for introducing that space unconditionally? And then, are you in the position to merge the linked PR (#101)?

Edit: Dang, ping in PR was faster, sorry for double ping!

JamesWrigley added a commit that referenced this issue Jan 2, 2025
Remove redundant space insertion in `text` (fix #100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants