@lblod/graph-rdfa-processor 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/bug5.html +952 -0
- package/dist/rdfa-processor.js +4 -0
- package/package.json +1 -1
- package/src/rdfa-processor.js +25 -22
package/dist/rdfa-processor.js
CHANGED
package/package.json
CHANGED
package/src/rdfa-processor.js
CHANGED
@@ -208,9 +208,9 @@ export default class RDFaProcessor extends URIResolver {
|
|
208
208
|
if (node.ownerDocument.doctype) {
|
209
209
|
if (
|
210
210
|
node.ownerDocument.doctype.publicId ==
|
211
|
-
|
211
|
+
"-//W3C//DTD XHTML+RDFa 1.0//EN" &&
|
212
212
|
node.ownerDocument.doctype.systemId ==
|
213
|
-
|
213
|
+
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"
|
214
214
|
) {
|
215
215
|
console.log(
|
216
216
|
"WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode.",
|
@@ -218,9 +218,9 @@ export default class RDFaProcessor extends URIResolver {
|
|
218
218
|
this.setHTMLContext();
|
219
219
|
} else if (
|
220
220
|
node.ownerDocument.doctype.publicId ==
|
221
|
-
|
221
|
+
"-//W3C//DTD XHTML+RDFa 1.1//EN" &&
|
222
222
|
node.ownerDocument.doctype.systemId ==
|
223
|
-
|
223
|
+
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"
|
224
224
|
) {
|
225
225
|
this.setXHTMLContext();
|
226
226
|
} else {
|
@@ -329,11 +329,11 @@ export default class RDFaProcessor extends URIResolver {
|
|
329
329
|
"http://www.w3.org/1999/xhtml/vocab#transformation";
|
330
330
|
}
|
331
331
|
|
332
|
-
init() {}
|
332
|
+
init() { }
|
333
333
|
|
334
|
-
newSubjectOrigin(origin, subject) {}
|
334
|
+
newSubjectOrigin(origin, subject) { }
|
335
335
|
|
336
|
-
addTriple(origin, subject, predicate, object) {}
|
336
|
+
addTriple(origin, subject, predicate, object) { }
|
337
337
|
|
338
338
|
process(node, options) {
|
339
339
|
if (node.nodeType == Node.DOCUMENT_NODE) {
|
@@ -344,7 +344,7 @@ export default class RDFaProcessor extends URIResolver {
|
|
344
344
|
}
|
345
345
|
var queue = [];
|
346
346
|
// Fix for Firefox that includes the hash in the base URI
|
347
|
-
var removeHash = function
|
347
|
+
var removeHash = function(baseURI) {
|
348
348
|
var hash = baseURI.indexOf("#");
|
349
349
|
if (hash >= 0) {
|
350
350
|
baseURI = baseURI.substring(0, hash);
|
@@ -352,6 +352,9 @@ export default class RDFaProcessor extends URIResolver {
|
|
352
352
|
if (options && options.baseURIMap) {
|
353
353
|
baseURI = options.baseURIMap(baseURI);
|
354
354
|
}
|
355
|
+
if (baseURI == "about:blank") {
|
356
|
+
baseURI = options.baseURI;
|
357
|
+
}
|
355
358
|
return baseURI;
|
356
359
|
};
|
357
360
|
queue.push({
|
@@ -864,18 +867,18 @@ export default class RDFaProcessor extends URIResolver {
|
|
864
867
|
datatypeAtt.value == ""
|
865
868
|
? RDFaProcessor.PlainLiteralURI
|
866
869
|
: this.parseTermOrCURIEOrAbsURI(
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
870
|
+
datatypeAtt.value,
|
871
|
+
vocabulary,
|
872
|
+
context.terms,
|
873
|
+
prefixes,
|
874
|
+
base,
|
875
|
+
);
|
873
876
|
if (datetimeAtt && !contentAtt) {
|
874
877
|
content = datetimeAtt.value;
|
875
878
|
} else {
|
876
879
|
content =
|
877
880
|
datatype == RDFaProcessor.XMLLiteralURI ||
|
878
|
-
|
881
|
+
datatype == RDFaProcessor.HTMLLiteralURI
|
879
882
|
? null
|
880
883
|
: contentAtt
|
881
884
|
? contentAtt.value
|
@@ -943,10 +946,10 @@ export default class RDFaProcessor extends URIResolver {
|
|
943
946
|
datatype == RDFaProcessor.HTMLLiteralURI
|
944
947
|
? { type: datatype, value: current.childNodes }
|
945
948
|
: {
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
949
|
+
type: datatype ? datatype : RDFaProcessor.PlainLiteralURI,
|
950
|
+
value: content,
|
951
|
+
language: language,
|
952
|
+
},
|
950
953
|
);
|
951
954
|
} else {
|
952
955
|
if (
|
@@ -1073,7 +1076,7 @@ export default class RDFaProcessor extends URIResolver {
|
|
1073
1076
|
}
|
1074
1077
|
}
|
1075
1078
|
|
1076
|
-
copyProperties() {}
|
1079
|
+
copyProperties() { }
|
1077
1080
|
|
1078
1081
|
push(parent, subject) {
|
1079
1082
|
return {
|
@@ -1108,7 +1111,7 @@ RDFaProcessor.NCNAME = new RegExp(
|
|
1108
1111
|
"^" + RDFaProcessor.nameStartChar + RDFaProcessor.nameChar + "*$",
|
1109
1112
|
);
|
1110
1113
|
|
1111
|
-
RDFaProcessor.trim = function
|
1114
|
+
RDFaProcessor.trim = function(str) {
|
1112
1115
|
return str.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
|
1113
1116
|
};
|
1114
1117
|
|
@@ -1144,7 +1147,7 @@ RDFaProcessor.dateTimeTypes = [
|
|
1144
1147
|
},
|
1145
1148
|
];
|
1146
1149
|
|
1147
|
-
RDFaProcessor.deriveDateTimeType = function
|
1150
|
+
RDFaProcessor.deriveDateTimeType = function(value) {
|
1148
1151
|
for (var i = 0; i < RDFaProcessor.dateTimeTypes.length; i++) {
|
1149
1152
|
//console.log("Checking "+value+" against "+RDFaProcessor.dateTimeTypes[i].type);
|
1150
1153
|
var matched = RDFaProcessor.dateTimeTypes[i].pattern.exec(value);
|