Comments (3)
The docs say:
Calling the $p->eof method outside a handler callback will flush any remaining buffered text (which triggers the text event if there is any remaining text).
I think that seems reasonable in your case, where the fragment is not wholly enclosed by tags. I had to go back and check one of my projects and I see that I'm calling eof
here: https://metacpan.org/release/OALDERS/HTML-Restrict-v3.0.0/source/lib/HTML/Restrict.pm#L317 (likely for similar reasons).
eof
is in the SYNOPSIS as well, having said that, if you'd like to suggest an improvement to the documentation, that would be welcome. I think it could be clearer.
from html-parser.
The docs say:
Calling the $p->eof method outside a handler callback will flush any remaining buffered text (which triggers the text event if there is any remaining text).
I think that seems reasonable in your case, where the fragment is not wholly enclosed by tags. I had to go back and check one of my projects and I see that I'm calling
eof
here: https://metacpan.org/release/OALDERS/HTML-Restrict-v3.0.0/source/lib/HTML/Restrict.pm#L317 (likely for similar reasons).
eof
is in the SYNOPSIS as well, having said that, if you'd like to suggest an improvement to the documentation, that would be welcome. I think it could be clearer.
I think the doc makes it clear for sure, but expectations might be different. If one calls parse
on a string, and the parser reaches the end of that string, just like if it reaches the end of a file, wouldn't it be reasonable to assume the buffer would need to be flushed? Maybe there are good reason not to do so?
from html-parser.
Maybe there are good reason not to do so?
Maybe some digging through the original commits would make this clear? I wrote none of this code, so I actually just don't know.
from html-parser.
Related Issues (20)
- HTML::TreeBuilder generates text nodes in a strange encoding [rt.cpan.org #14212]
- Make iframe parsing configurable [rt.cpan.org #46099]
- Wrong parse [rt.cpan.org #55629]
- examples lack explanation [rt.cpan.org #58016] HOT 1
- Incorrect tokenization in HTML::Parser [rt.cpan.org #83570]
- [PATCH] Protect active parser from being freed. [rt.cpan.org #115034] HOT 1
- Attributes that have no value get their name as their value HOT 6
- Should META.json be in source control? HOT 4
- <title> tag triggers end event
- comparing entities with space padding HOT 3
- Tokenizing bug. Some tokens are split into 2 HOT 11
- HTML::HeadParser t/threads.t fails on perl 5.10.0 HOT 6
- Installing Alpine 3.16.1 and Perl 5.34.1 fails on EXTERN.h HOT 1
- Potential speedups for HTML::Entities::encode_entities HOT 2
- Feature request: Strict mode for decode_entities() HOT 1
- HTML::Entities can't handle decode_entities("ē") [rt.cpan.org #130763]
- Lifeboat Foundation HTML::Entities Bug [rt.cpan.org #130765]
- <meta name="twitter:card"...> (and similar) entities trip up the parser [rt.cpan.org #132922] HOT 4
- inject method - API extension request [rt.cpan.org #5941]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-parser.