Tidy 导致不良间距问题 (JTidy)
我们正在使用 JTidy 来清理一些 html 以进行 sax 处理。 我们在间距问题上遇到了很多麻烦,如下例所示:
Html
<i>stack<span
class="bold">overflow</span></i>
输出“stackoverflow”的
但是...
Post JTidy
<i>stack
<span
class="bold">overflow</span></i>
输出“stackoverflow”的
(注意新的空格)任何人都可以提出修复/处理此问题的建议更好的。 我已经完成了所有 Tidy/JTidy 设置,但没有看到任何可以解释此问题的内容。
We are using JTidy to clean up some html for sax processing. We've had a lot of trouble around spacing issues as shown in this example:
Html
<i>stack<span
class="bold">overflow</span></i>
which outputs "stackoverflow"
But...
Post JTidy
<i>stack
<span
class="bold">overflow</span></i>
which outputs "stack overflow" (note the new space)
Anyone have any advice to fix/handle this better. I've been through all the Tidy/JTidy settings and don't see anything to account for this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明这个简单的例子并不能真正说明问题。 实际问题是 Tidy/JTidy 使用默认换行设置,当属性值很长时,该设置会导致上述问题(以及其他各种间距问题)。
一切都已修复:
Turns out this simple example doesn't really show the issue. The actual issue was that Tidy/JTidy was using a default wrapping setting which was causing the above issue (and other various spacing issues) when there were very long attribute values.
Everything was fixed with:
您使用什么设置? 使用您发布的代码片段上的默认设置从命令行执行 JTidy 会打印以下内容:
What settings are you using? Executing JTidy from the command line using its default settings on the snippet you posted prints this: