@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.
@@ -397,6 +397,10 @@ function (_URIResolver) {
397
397
  baseURI = options.baseURIMap(baseURI);
398
398
  }
399
399
 
400
+ if (baseURI == "about:blank") {
401
+ baseURI = options.baseURI;
402
+ }
403
+
400
404
  return baseURI;
401
405
  };
402
406
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/graph-rdfa-processor",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "Green turtle GraphRdfaProcessor extracted and available as a commonJS module",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
@@ -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
- "-//W3C//DTD XHTML+RDFa 1.0//EN" &&
211
+ "-//W3C//DTD XHTML+RDFa 1.0//EN" &&
212
212
  node.ownerDocument.doctype.systemId ==
213
- "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"
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
- "-//W3C//DTD XHTML+RDFa 1.1//EN" &&
221
+ "-//W3C//DTD XHTML+RDFa 1.1//EN" &&
222
222
  node.ownerDocument.doctype.systemId ==
223
- "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"
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 (baseURI) {
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
- datatypeAtt.value,
868
- vocabulary,
869
- context.terms,
870
- prefixes,
871
- base,
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
- datatype == RDFaProcessor.HTMLLiteralURI
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
- type: datatype ? datatype : RDFaProcessor.PlainLiteralURI,
947
- value: content,
948
- language: language,
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 (str) {
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 (value) {
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);