@lblod/graph-rdfa-processor 2.1.6 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bug7.html +1956 -0
- package/bug8.html +124 -0
- package/dist/rdfa-graph.js +4 -4
- package/dist/uri-resolver.js +1 -1
- package/package.json +1 -1
- package/src/rdfa-graph.js +11 -2
- package/src/uri-resolver.js +4 -4
- package/test/test.js +5 -5
package/bug8.html
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="nl">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Publicatie Gelinkt Notuleren</title>
|
6
|
+
<link
|
7
|
+
href="https://lblod.izegem.be/LBLODWeb/LBLODWeb/Configuratie/60b70f3b49cc098224ba560fa597f0c0e9efa4d0e5a32eacd8e81ee89cef173e/style.css"
|
8
|
+
rel="stylesheet"
|
9
|
+
/>
|
10
|
+
</head>
|
11
|
+
<body class="body agenda">
|
12
|
+
<div
|
13
|
+
class="body_content"
|
14
|
+
prefix="eli: http://data.europa.eu/eli/ontology# prov: http://www.w3.org/ns/prov# besluit: http://data.vlaanderen.be/ns/besluit# mandaat: http://data.vlaanderen.be/ns/mandaat# persoon: http://data.vlaanderen.be/ns/persoon# org: http://www.w3.org/ns/org#"
|
15
|
+
resource="https://lblod.izegem.be/LBLODWeb/Home/Overzicht/4daec95bfe0ad44a09ff60222ada11725d5145d3a5c76dc645feed7b26eee7ad/GetPublication/?filename=ToegevoegdeAgenda_Gemeenteraad_06-09-2021.html"
|
16
|
+
typeof="foaf:Document https://data.vlaanderen.be/id/concept/BesluitDocumentType/13fefad6-a9d6-4025-83b5-e4cbee3a8965"
|
17
|
+
>
|
18
|
+
<div
|
19
|
+
class="zitting"
|
20
|
+
typeof="besluit:Zitting"
|
21
|
+
resource="https://lblod.izegem.be/LBLODWeb/Home/Overzicht/4daec95bfe0ad44a09ff60222ada11725d5145d3a5c76dc645feed7b26eee7ad/GetPublication/?filename=ToegevoegdeAgenda_Gemeenteraad_06-09-2021.html#Zitting"
|
22
|
+
style="margin-bottom: 1em"
|
23
|
+
>
|
24
|
+
<h1>
|
25
|
+
<span
|
26
|
+
resource="https://lblod.izegem.be/LBLODWeb/Home/Overzicht/4daec95bfe0ad44a09ff60222ada11725d5145d3a5c76dc645feed7b26eee7ad/GetPublication/?filename=ToegevoegdeAgenda_Gemeenteraad_06-09-2021.html#Agenda4826"
|
27
|
+
typeof="foaf:Document"
|
28
|
+
property="besluit:heeftAgenda"
|
29
|
+
></span>
|
30
|
+
van
|
31
|
+
|
32
|
+
<span
|
33
|
+
resource="http://data.lblod.info/id/bestuursorganen/b784a500840af3b20d20131c73e4b9801040190e5a7bd1914314b67f4dd61696"
|
34
|
+
typeof="besluit:Bestuursorgaan"
|
35
|
+
property="besluit:isGehoudenDoor"
|
36
|
+
>
|
37
|
+
<span
|
38
|
+
resource="http://data.lblod.info/id/bestuursorganen/4daec95bfe0ad44a09ff60222ada11725d5145d3a5c76dc645feed7b26eee7ad"
|
39
|
+
typeof="besluit:Bestuursorgaan"
|
40
|
+
property="mandaat:isTijdspecialisatieVan"
|
41
|
+
>
|
42
|
+
<span class="header_titel" property="skos:prefLabel"
|
43
|
+
>Gemeenteraad Stad Izegem</span
|
44
|
+
>,
|
45
|
+
</span>
|
46
|
+
</span>
|
47
|
+
zitting van
|
48
|
+
<span
|
49
|
+
class="header_subtitel"
|
50
|
+
property="besluit:geplandeStart"
|
51
|
+
content="2021-09-06T17:30:00.0000000Z"
|
52
|
+
datatype="xsd:dateTime"
|
53
|
+
>
|
54
|
+
06 sep 2021, 19:30 uur</span
|
55
|
+
>
|
56
|
+
</h1>
|
57
|
+
<a
|
58
|
+
class="pdf_link"
|
59
|
+
href="https://lblod.izegem.be/LBLODWeb/Home/Overzicht/4daec95bfe0ad44a09ff60222ada11725d5145d3a5c76dc645feed7b26eee7ad/GetPublication/?filename=ToegevoegdeAgenda_Gemeenteraad_06-09-2021_Bijgevoegde%20dagorde.pdf"
|
60
|
+
>Pdf-versie</a
|
61
|
+
>
|
62
|
+
<div
|
63
|
+
class="agendapunten"
|
64
|
+
typeof="besluit:Agendapunt"
|
65
|
+
resource="https://lblod.izegem.be/LBLODWeb/Home/Overzicht/4daec95bfe0ad44a09ff60222ada11725d5145d3a5c76dc645feed7b26eee7ad/GetPublication/?filename=ToegevoegdeAgenda_Gemeenteraad_06-09-2021.html# Agendapunt28668"
|
66
|
+
>
|
67
|
+
<h2
|
68
|
+
class="agendapunten_titel"
|
69
|
+
property="dc:title"
|
70
|
+
datatype="xsd:string"
|
71
|
+
>
|
72
|
+
B1 Op vraag van raadslid Sybille Vandeputte d.d. 01.09.2021: In
|
73
|
+
kaart brengen en aanpakken van niet-conflictvrije kruispunten in
|
74
|
+
schoolzones en elders in de stad. Goedkeuring.
|
75
|
+
</h2>
|
76
|
+
<span
|
77
|
+
property="besluit:geplandOpenbaar"
|
78
|
+
datatype="xsd:boolean"
|
79
|
+
content="true"
|
80
|
+
></span>
|
81
|
+
</div>
|
82
|
+
<div
|
83
|
+
class="agendapunten"
|
84
|
+
typeof="besluit:Agendapunt"
|
85
|
+
resource="https://lblod.izegem.be/LBLODWeb/Home/Overzicht/4daec95bfe0ad44a09ff60222ada11725d5145d3a5c76dc645feed7b26eee7ad/GetPublication/?filename=ToegevoegdeAgenda_Gemeenteraad_06-09-2021.html# Agendapunt28677"
|
86
|
+
>
|
87
|
+
<h2
|
88
|
+
class="agendapunten_titel"
|
89
|
+
property="dc:title"
|
90
|
+
datatype="xsd:string"
|
91
|
+
>
|
92
|
+
B2 Op vraag van raadslid Hannes Vanderstraeten d.d. 02.09.2021:
|
93
|
+
Opstart van een Rollend Fonds voor verduurzamen van huishoudens met
|
94
|
+
beperkte financiële middelen. Goedkeuring.
|
95
|
+
</h2>
|
96
|
+
<span
|
97
|
+
property="besluit:geplandOpenbaar"
|
98
|
+
datatype="xsd:boolean"
|
99
|
+
content="true"
|
100
|
+
></span>
|
101
|
+
</div>
|
102
|
+
<div
|
103
|
+
class="agendapunten"
|
104
|
+
typeof="besluit:Agendapunt"
|
105
|
+
resource="https://lblod.izegem.be/LBLODWeb/Home/Overzicht/4daec95bfe0ad44a09ff60222ada11725d5145d3a5c76dc645feed7b26eee7ad/GetPublication/?filename=ToegevoegdeAgenda_Gemeenteraad_06-09-2021.html# Agendapunt28678"
|
106
|
+
>
|
107
|
+
<h2
|
108
|
+
class="agendapunten_titel"
|
109
|
+
property="dc:title"
|
110
|
+
datatype="xsd:string"
|
111
|
+
>
|
112
|
+
B3 Op vraag van raadslid Veerle Renier d.d. 02.09.2021:
|
113
|
+
Groepsaankoop CO2 meters voor Izegemse scholen. Goedkeuring.
|
114
|
+
</h2>
|
115
|
+
<span
|
116
|
+
property="besluit:geplandOpenbaar"
|
117
|
+
datatype="xsd:boolean"
|
118
|
+
content="true"
|
119
|
+
></span>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
</body>
|
124
|
+
</html>
|
package/dist/rdfa-graph.js
CHANGED
@@ -544,21 +544,21 @@ function () {
|
|
544
544
|
}
|
545
545
|
}
|
546
546
|
|
547
|
-
s += '"""' + value.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\").replace(/"""/g, '\\"\\"\\"') + '"""^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>';
|
547
|
+
s += '"""' + value.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\").replace(/\\\\\\/g, "\\\\\\\\\\\\").replace(/"""/g, '\\"\\"\\"') + '"""^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>';
|
548
548
|
} else if (this.objects[i].type == "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML") {
|
549
549
|
// We can use innerHTML as a shortcut from the parentNode if the list is not empty
|
550
550
|
if (this.objects[i].value.length == 0) {
|
551
551
|
s += '""""""^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML>';
|
552
552
|
} else {
|
553
|
-
s += '"""' + this.objects[i].value[0].parentNode.innerHTML.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\").replace(/"""/g, '\\"\\"\\"') + '"""^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML>';
|
553
|
+
s += '"""' + this.objects[i].value[0].parentNode.innerHTML.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\").replace(/\\\\\\/g, "\\\\\\\\\\\\").replace(/"""/g, '\\"\\"\\"') + '"""^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML>';
|
554
554
|
}
|
555
555
|
} else {
|
556
556
|
var l = this.objects[i].value.toString();
|
557
557
|
|
558
558
|
if (l.indexOf("\n") >= 0 || l.indexOf("\r") >= 0) {
|
559
|
-
s += '"""' + l.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\").replace(/"/g, '\\"') + '"""';
|
559
|
+
s += '"""' + l.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\").replace(/\\\\\\/g, "\\\\\\\\\\\\").replace(/"/g, '\\"') + '"""';
|
560
560
|
} else {
|
561
|
-
s += '"' + l.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\").replace(/"/g, '\\"') + '"';
|
561
|
+
s += '"' + l.replace(/\\\\\\/g, "\\\\\\\\\\\\").replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\").replace(/\\\\\\/g, "\\\\\\\\\\\\").replace(/"/g, '\\"') + '"';
|
562
562
|
}
|
563
563
|
|
564
564
|
if (this.objects[i].type != "http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral") {
|
package/dist/uri-resolver.js
CHANGED
@@ -21,7 +21,7 @@ function () {
|
|
21
21
|
_createClass(URIResolver, [{
|
22
22
|
key: "parseURI",
|
23
23
|
value: function parseURI(uri) {
|
24
|
-
uri = uri.replace("\n", ""); // bugfix: sometimes there is a \n in the uri...
|
24
|
+
uri = uri.replace("\n", "").replace(" ", "%20"); // bugfix: sometimes there is a \n in the uri...
|
25
25
|
|
26
26
|
var match = URIResolver.SCHEME.exec(uri);
|
27
27
|
|
package/package.json
CHANGED
package/src/rdfa-graph.js
CHANGED
@@ -461,6 +461,7 @@ export class RDFaPredicate {
|
|
461
461
|
'"""' +
|
462
462
|
value
|
463
463
|
.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\")
|
464
|
+
.replace(/\\\\\\/g, "\\\\\\\\\\\\")
|
464
465
|
.replace(/"""/g, '\\"\\"\\"') +
|
465
466
|
'"""^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral>';
|
466
467
|
} else if (
|
@@ -475,6 +476,7 @@ export class RDFaPredicate {
|
|
475
476
|
'"""' +
|
476
477
|
this.objects[i].value[0].parentNode.innerHTML
|
477
478
|
.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\")
|
479
|
+
.replace(/\\\\\\/g, "\\\\\\\\\\\\")
|
478
480
|
.replace(/"""/g, '\\"\\"\\"') +
|
479
481
|
'"""^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML>';
|
480
482
|
}
|
@@ -484,12 +486,19 @@ export class RDFaPredicate {
|
|
484
486
|
if (l.indexOf("\n") >= 0 || l.indexOf("\r") >= 0) {
|
485
487
|
s +=
|
486
488
|
'"""' +
|
487
|
-
l
|
489
|
+
l
|
490
|
+
.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\")
|
491
|
+
.replace(/\\\\\\/g, "\\\\\\\\\\\\")
|
492
|
+
.replace(/"/g, '\\"') +
|
488
493
|
'"""';
|
489
494
|
} else {
|
490
495
|
s +=
|
491
496
|
'"' +
|
492
|
-
l
|
497
|
+
l
|
498
|
+
.replace(/\\\\\\/g, "\\\\\\\\\\\\")
|
499
|
+
.replace(/([^\\]|^)(\\)(?!\\)/g, "$1\\\\")
|
500
|
+
.replace(/\\\\\\/g, "\\\\\\\\\\\\")
|
501
|
+
.replace(/"/g, '\\"') +
|
493
502
|
'"';
|
494
503
|
}
|
495
504
|
if (
|
package/src/uri-resolver.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export default class URIResolver {
|
2
2
|
parseURI(uri) {
|
3
|
-
uri = uri.replace("\n", ""); // bugfix: sometimes there is a \n in the uri...
|
3
|
+
uri = uri.replace("\n", "").replace(" ", "%20"); // bugfix: sometimes there is a \n in the uri...
|
4
4
|
var match = URIResolver.SCHEME.exec(uri);
|
5
5
|
if (!match) {
|
6
6
|
throw new Error("Bad URI value, no scheme: " + uri);
|
@@ -16,7 +16,7 @@ export default class URIResolver {
|
|
16
16
|
} else {
|
17
17
|
parsed.isGeneric = false;
|
18
18
|
}
|
19
|
-
parsed.normalize = function() {
|
19
|
+
parsed.normalize = function () {
|
20
20
|
if (!this.isGeneric) {
|
21
21
|
return;
|
22
22
|
}
|
@@ -66,7 +66,7 @@ export default class URIResolver {
|
|
66
66
|
this.spec = this.scheme + ":" + this.schemeSpecificPart;
|
67
67
|
};
|
68
68
|
|
69
|
-
parsed.resolve = function(href) {
|
69
|
+
parsed.resolve = function (href) {
|
70
70
|
if (!href) {
|
71
71
|
return this.spec;
|
72
72
|
}
|
@@ -119,7 +119,7 @@ export default class URIResolver {
|
|
119
119
|
}
|
120
120
|
};
|
121
121
|
|
122
|
-
parsed.relativeTo = function(otherURI) {
|
122
|
+
parsed.relativeTo = function (otherURI) {
|
123
123
|
if (otherURI.scheme != this.scheme) {
|
124
124
|
return this.spec;
|
125
125
|
}
|
package/test/test.js
CHANGED
@@ -2,7 +2,7 @@ import { jsdom } from "jsdom";
|
|
2
2
|
import assert from "assert";
|
3
3
|
import getRDFaGraph from "../src";
|
4
4
|
import { readFileSync, writeFileSync } from "fs";
|
5
|
-
describe("getRDFaGraph", function() {
|
5
|
+
describe("getRDFaGraph", function () {
|
6
6
|
let html = `<div typeof="rdfs:Class" resource="http://schema.org/CreativeWork">
|
7
7
|
<span class="h" property="rdfs:label">CreativeWork</span>
|
8
8
|
<span property="rdfs:comment">The most generic kind of creative work, including books, movies, photographs, software programs, etc.</span>
|
@@ -17,14 +17,14 @@ describe("getRDFaGraph", function() {
|
|
17
17
|
<http://purl.org/dc/terms/source> <http://www.w3.org/wiki/WebSchemas/SchemaDotOrgSources#source_rNews> .
|
18
18
|
`;
|
19
19
|
|
20
|
-
it("should getRDFaGraph from a document", function() {
|
20
|
+
it("should getRDFaGraph from a document", function () {
|
21
21
|
let { document } = jsdom(html).defaultView.window;
|
22
22
|
let graph = getRDFaGraph(document, { baseURI: "http://localhost" });
|
23
23
|
assert.equal(graph.toString(), expected);
|
24
24
|
});
|
25
25
|
|
26
|
-
it.only("
|
27
|
-
let ht = readFileSync("./
|
26
|
+
it.only("test bug", () => {
|
27
|
+
let ht = readFileSync("./bug8.html");
|
28
28
|
let { document } = jsdom(ht).defaultView.window;
|
29
29
|
|
30
30
|
let graph = getRDFaGraph(document, {
|
@@ -40,7 +40,7 @@ describe("getRDFaGraph", function() {
|
|
40
40
|
writeFileSync("/tmp/x.ttl", graph.toString(), "utf8");
|
41
41
|
});
|
42
42
|
|
43
|
-
it("should getRDFaGraph from a node", function() {
|
43
|
+
it("should getRDFaGraph from a node", function () {
|
44
44
|
let { document } = jsdom(html).defaultView.window;
|
45
45
|
let graph = getRDFaGraph(document.getElementsByTagName("div")[0], {
|
46
46
|
baseURI: "http://localhost",
|