-
Notifications
You must be signed in to change notification settings - Fork 429
Tidy emits warnings that aren't in order #696
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
Comments
@petdance thank you for the issue... Yes, warnings and errors are emitted, by default to I think the first 3 are during the document There are many other warnings that can be issued during this clean and repair phase, so they too would appear Not that it is important, It may have been brought up previously in these issues, like #561, but maybe others... As indicated there, if we wanted the messages in strict document order, the initial parsing phase messages would need to be buffered, and the later items added and then sorted before any output... could be done, not so difficult... And since apps using Is this worth the effort? Maybe... as indicated it would mean delaying all message output until the library is finished with all phases of the document... Look forward to further feedback to determine is this a |
If you want to call it a feature request, go ahead. It's not that big a deal to me, other than I was surprised. I'd push harder for it if it were trivial, but clearly it is not. |
Maybe this is another old issue that could be resolved by adding an
|
@petdance, it should be fairly trivial, but memory consumption could skyrocket. Not sure that that's important in this day and age, but libtidy can run currently on some pretty minimal systems. Right now each message is dealloc'd after emission, but keeping them around until tidyFree() is doable, and a simple structure to hold references could be added to tidyDocImpl. Then the existing message API can fetch the messages. A quick sort on the line and column numbers, output the messages, and it's done. @geoffmcl is on record elsewhere that this doesn't belong in Tidy, although it seems maybe he's coming around. |
There are really two questions here:
|
I don't have any strong feelings about whether the message stuff should be in libtidy. I just need a yes/no on whether it will, so I can act accordingly on HTML::Tidy5 in Perl. |
@petdance, are you using LibTidy, or the CLI for HTML::Tidy5? Using the library directly is the way to go, so that you can use the For your two questions in particular, though:
|
I think you may be confused by what I meant by HTML::Tidy5. HTML::Tidy5 is the Perl module that I created that wraps libtidy. https://search.cpan.org/dist/HTML-Tidy5 |
@petdance, I know about the module, I was simply wondering if you wrapped the console application, or the library directly. There are a lot of tools out there that wrap the console application and try to scrape STDOUT and STDERR instead of using the library. Actually, some of the library users may be using the output sinks directly and scaping them for information, too. If you're doing this, or using one of the older message/filter callbacks, take a look at the newer API in It was inspired by @gagern if I recall correctly, and really is the future-proof way to collect all message output that LibTidy will ever create. And if we ever add an extract, it's a simple, new accessor that we add to the API that you can pick up, too. |
|
Yeah, I got that. My previous message wasn't asking for clarification from you; I was clarifying why I had asked! And because you're using the library, I went on to explain why you should be using the message API. |
Then I'm not understanding what you're talking about. Please say more. |
I'm not knowledgeable about Perl modules, but in your XS file, I see that you're using output buffers to capture Tidy's standard and error output. If you can configure a callback of type This decouples you completely from any dependency on how and what stderr and stdout have in their buffers, because you now have access to all of the data that were used to generate the messages. A quick Google check seems to indicate that XS supports callbacks, so this may be an extensible avenue for you, especially if you want to be able to sort output rather than waiting for the Tidy CLI to offer that as a feature. If you look at |
Thanks. I'll try to make some time to look into this. |
I will close this as there has been no additional conversation, and the message API can solve the issue for library clients. Please feel free to re-open if necessary. |
I would expect that the warning for line 7 would come before the warnings for line 8.
The text was updated successfully, but these errors were encountered: