parse other JSON-LD elements if the first one is not of a recognized type #713
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One more proposed change regarding JSON-LD. I noticed that the "engadget" test case is not working optimally. The expected-metadata.json file expectes byline to be null. But the source.html actually contains byline information in a JSON-LD element: "Devindra Hardawar".
The problem is that there are two JSON-LD elements. The first one has type "Review" which Readability doesn't recognize. The second one is "Article", which it recognizes. However, Readability only checks the first JSON-LD element "Review" and when it sees unsupported type, it gives up.
My proposal is to keep going through the JSON-LD elements until we find one we support. I implemented it in this change request and I changed the byline in engadget/expected-metadata.json to contain the actual author's name. All unit tests are passing and lint doesn't complain, so I hope I did it correctly.