Skip to content

Commit

Permalink
feat: RDFa
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Jul 15, 2024
1 parent b297074 commit cb23cae
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-bats-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zazuko/rdf-converter": patch
---

Added RDFa parser
84 changes: 83 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
"@rdfjs-elements/rdf-snippet": "^0.4.3",
"@rdfjs/term-set": "^2.0.1",
"@vaadin/vaadin": "^22",
"@zazuko/formats-lazy": "^1.0.1",
"@zazuko/rdf-vocabularies": ">=2021",
"clipboard-copy": "^4.0.1",
"http-media-type": "^1.3.2",
"lit": "^2",
"lit-vaadin-helpers": "^0.3.1",
"rdfa-streaming-parser": "^2.0.1",
"tbbt-ld": "^1.1.0"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "./lib/parsers/rdfa.js";
import { RdfConverter } from "./lib/RdfConverter.js";

customElements.define("rdf-converter", RdfConverter);
12 changes: 6 additions & 6 deletions src/lib/RdfConverter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { css, html, LitElement, render } from "lit";
import TermSet from "@rdfjs/term-set";
import copy from "clipboard-copy";
import { InputController } from "./InputController.js";
import { OutputController } from "./OutputController.js";
import { extractPrefix } from "./prefixes.js";
import Package from "../../package.json";
import "@vaadin/vaadin-app-layout/vaadin-app-layout.js";
import "@vaadin/vaadin-split-layout/vaadin-split-layout.js";
import "@rdfjs-elements/rdf-editor/rdf-editor.js";
Expand All @@ -7,12 +13,6 @@ import "@vaadin/vaadin-app-layout/vaadin-drawer-toggle.js";
import "@vaadin/vaadin-form-layout/vaadin-form-layout.js";
import "@vaadin/vaadin-lumo-styles/typography";
import "@vaadin/vaadin-button/vaadin-button.js";
import TermSet from "@rdfjs/term-set";
import copy from "clipboard-copy";
import { InputController } from "./InputController.js";
import { OutputController } from "./OutputController.js";
import { extractPrefix } from "./prefixes.js";
import Package from "../../package.json";

export class RdfConverter extends LitElement {
static get styles() {
Expand Down
10 changes: 10 additions & 0 deletions src/lib/parsers/rdfa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { lazySink } from "@zazuko/formats-lazy/LazySink.js";
import formats from "@rdfjs-elements/formats-pretty";

formats.parsers.set(
"text/html",
new (lazySink(async () => {
const { RdfaParser } = await import("rdfa-streaming-parser");
return RdfaParser;
}))({ contentType: "text/html" })
);

0 comments on commit cb23cae

Please sign in to comment.