-
Notifications
You must be signed in to change notification settings - Fork 418
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
TITLE-Attribute should not wrap #28
Comments
Have you tested this and does it actually work? If so, can you please let me know exactly what config options you have set? Because even when I use "--wrap-attributes no", it still wraps all attributes. And even if I set "wrappable = no" in line 1163, it still wraps all attributes. And if I put an 'fprintf(stderr, "value: %s\n", attr->value);' at line 1128, I can see that the attribute value has already been wrapped before it was passed to the PPrintAttribute function. Anyway, I agree that tidy should not be wrapping title attributes. But as far as I can see, making this code change is not going to have any affect. There must be something I'm missing here. |
So after walking through the code, I find ParseValue in the lexer and see that is has munge=yes but that can be overridden y TidyLiteralAttribs, which is set by the --literal-attributes config option. So I guess you must have the option set too. Because if you don't have that set, the lexer code is always going to "munge" attribute values long before the pretty-printing code is executed, regardless of whatever options you have set. But now I find that if I do "tidy --literal-attributes yes --wrap-attributes yes", no attribute values get wrapped, ever. So it's still not clear to me what's going on here. So It would be really helpful to know exactly which options you have set. |
OK, looking at the docs finally I understand the logic and what --wrap-attributes does. It only wraps attribute values in cases where the value makes the line length longer than the value of the "wrap" option. So anyway, I agree it should not be doing that for the value of the title attribute, so I'll go ahead and make this change. |
Even with
--wrap-attributes yes
theTITLE
-attributes should (like theALT
-attribute right now) not be wrapped, because the browsers treat this like aPRE
formatted text in the tooltips.Proposed patch:
An unrelated minor optimization: putting the
wrapAttrs
first will allow faster evaluation of the if-statement, whenwrapAttrs == false
.The text was updated successfully, but these errors were encountered: