Comments (3)
Here is some more information about the issue:
- It occurs only when a header element is empty. Even a space between the tags "fixes" the issue.
- It occurs with every header element >=
h2
(i.e.h3
,h4
etc.). (I supposeh1
are interpreted by default in graby as containing the title of the article, thus are stripped.) - If the element has no class attribute, the following elements of same level (with or without class) are stripped from the code! (i.e. a
<h2></h2>
instruction will strip all following<h2>
markups, even not empty!)
<h2></h2>
<p>Lorem ipsum.</p>
<h2 class="truc">Truc</h2>
<p>Lorem ipsum 2.</p>
<!-- will give -->
<p>Lorem ipsum.</p>
<p>Lorem ipsum 2.</p>
- It is not "
class
" dependant (i.e.<h2 id="truc"></h2>
will give the same issue)
<h2 id="truc"></h2>
<p>Lorem ipsum.</p>
<h2 id="truc">Truc</h2>
<p>Lorem ipsum 2.</p>
<!-- will give -->
<h2>Lorem ipsum.
Truc</h2>
<p>Lorem ipsum 2.</p>
- The issue only appears up to the next occurrence of a header of same level:
<h2 class="truc"></h2>
<p>Lorem ipsum.</p>
<h2 class="truc">Truc</h2>
<h2 class="truc">Truc 2</h2>
<p>Lorem ipsum 3.</p>
<!-- will give -->
<h2>Lorem ipsum.
Truc</h2>
<h2 class="truc">Truc2</h2>
<p>Lorem ipsum 2.</p>
- Interestingly however, the problem disappears when the next header is not at the same level
<h2 class="truc"></h2>
<p>Lorem ipsum.</p>
<h3 class="truc">Truc</h3>
<p>Lorem ipsum 2.</p>
<!-- will give -->
<p>Lorem ipsum.</p>
<h3>Truc</h3>
<p>Lorem ipsum 2.</p>
It seems to be an issue finding the closing HTML markup when the markups are empty.
from php-readability.
New test: Using Tidy to clean the examples above with the options specified in php-readability doesn't fail.
from php-readability.
@j0k3r this issue can be closed as per j0k3r/graby#178
from php-readability.
Related Issues (20)
- PHP Notice: Trying to get property of non-object HOT 6
- Issue with pre and code tags HOT 2
- Missing namespace for HTML5_Parser HOT 4
- outlined words get censored on psychologytoday.com HOT 2
- Preserve newlines? HOT 2
- A lot of warnings (with russian language ?)
- More warnings HOT 4
- Keep URLS into documents HOT 9
- not working in cronjob HOT 8
- Error: A non well formed numeric value encountered HOT 11
- Consider ignoring empty node contents
- Composer printing warning with php-html5lib HOT 1
- Unable to attach logger for loadHTML HOT 2
- Unexpected title cleaning HOT 2
- Not able to get the full content HOT 3
- Can't install with Laravel 9 HOT 2
- Issue with one URL and his content HOT 2
- Readability 3.0 HOT 2
- Problem with article extraction HOT 4
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 php-readability.