Skip to content
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

Tolerate invalid RDF in script tag #32

Open
fbacall opened this issue Jul 3, 2023 · 1 comment
Open

Tolerate invalid RDF in script tag #32

fbacall opened this issue Jul 3, 2023 · 1 comment

Comments

@fbacall
Copy link

fbacall commented Jul 3, 2023

I'm trying to parse an HTML document as RDFa that contains the following script tag (as well as some valid JSON-LD):

<script type="text/plain" cookie-consent="tracking">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
...
</script>

the text/plain content type causes ruby-rdf to load the NTriples reader, which fails with the exception:
RDF::ReaderError: Expected subject (found: "window.dataLayer = window.dataLayer || [];")

Is there a way that the RDFa reader could tolerate (and log) bad RDF in a script tag and continue reading the rest of the document?

Or, is there a good way to not load the NTriples reader for text/plain content?

Thanks!

@gkellogg
Copy link
Member

gkellogg commented Jul 3, 2023

Loading N-Triples when seeing text/plain is historic, and obsolete. Best to remove support for this directly in the RDF gem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants