Comparing version 2.1.0 to 2.2.0
@@ -73,3 +73,2 @@ 'use strict'; | ||
processEmd(this); | ||
this.buildNotes(); | ||
@@ -76,0 +75,0 @@ this.buildExamples(); |
@@ -19,6 +19,15 @@ 'use strict'; | ||
this.isInformative = node.hasAttribute('informative'); | ||
this.caption = node.getAttribute('caption'); | ||
this.captionElem = node.querySelector('emu-caption'); | ||
if (this.captionElem) { | ||
this.caption = this.captionElem.innerHTML; | ||
} else { | ||
this.caption = node.getAttribute('caption'); | ||
} | ||
} | ||
build() { | ||
if (this.captionElem) { | ||
this.captionElem.parentNode.removeChild(this.captionElem); | ||
} | ||
this.node.innerHTML = '<figure>' + this.node.innerHTML + '</figure>'; | ||
@@ -38,5 +47,5 @@ | ||
const captionElem = this.spec.doc.createElement('figcaption'); | ||
captionElem.textContent = caption; | ||
captionElem.innerHTML = caption; | ||
this.node.childNodes[0].insertBefore(captionElem, this.node.childNodes[0].firstChild); | ||
} | ||
}; |
@@ -125,3 +125,4 @@ 'use strict'; | ||
.then(this.autolink.bind(this)) | ||
.then(this.buildAll.bind(this, 'emu-xref', Xref)); | ||
.then(this.buildAll.bind(this, 'emu-xref', Xref)) | ||
.then(this.setCharset.bind(this)); | ||
@@ -233,17 +234,17 @@ if (this.opts.toc) { | ||
Object.keys(this.externalBiblio.terms).forEach(function (term) { | ||
autolinkmap[term] = this.externalBiblio.terms[term].id; | ||
termlinkmap[term] = this.externalBiblio.terms[term].id; | ||
autolinkmap[term] = this.externalBiblio.terms[term]; | ||
termlinkmap[term] = this.externalBiblio.terms[term]; | ||
}, this); | ||
Object.keys(this.externalBiblio.ops).filter(noCommonAbstractOps).forEach(function (op) { | ||
autolinkmap[op] = this.externalBiblio.ops[op].id; | ||
autolinkmap[op] = this.externalBiblio.ops[op]; | ||
}, this); | ||
Object.keys(this.biblio.terms).forEach(function (term) { | ||
autolinkmap[term] = this.biblio.terms[term].id; | ||
termlinkmap[term] = this.biblio.terms[term].id; | ||
autolinkmap[term] = this.biblio.terms[term]; | ||
termlinkmap[term] = this.biblio.terms[term]; | ||
}, this); | ||
Object.keys(this.biblio.ops).filter(noCommonAbstractOps).forEach(function (op) { | ||
autolinkmap[op] = this.biblio.ops[op].id; | ||
autolinkmap[op] = this.biblio.ops[op]; | ||
}, this); | ||
@@ -253,3 +254,3 @@ | ||
.sort(function (a, b) { return b.length - a.length; }) | ||
.map(function (k) { return '\\b' + k + '\\b'; }) | ||
.map(function (k) { return '\\b' + k + '\\b(?!\\.\\w|%%|\\]\\])'; }) | ||
.join('|'), 'g'); | ||
@@ -259,3 +260,3 @@ | ||
.sort(function (a, b) { return b.length - a.length; }) | ||
.map(function (k) { return '\\b' + k + '\\b'; }) | ||
.map(function (k) { return '\\b' + k + '\\b(?!\\.\\w|%%|\\]\\])'; }) | ||
.join('|'), 'g'); | ||
@@ -285,2 +286,13 @@ | ||
setCharset() { | ||
let current = this.spec.doc.querySelector('meta[charset]'); | ||
if (!current) { | ||
current = this.spec.doc.createElement('meta'); | ||
this.spec.doc.head.appendChild(current); | ||
} | ||
current.setAttribute('charset', 'utf-8'); | ||
} | ||
_log(str) { | ||
@@ -321,6 +333,11 @@ if (!this.opts.verbose) return; | ||
const entry = autolinkmap[match]; | ||
if (!entry || entry === parentId) { | ||
if (!entry || entry.id === parentId) { | ||
return match; | ||
} | ||
return '<emu-xref href="#' + entry + '">' + match + '</emu-xref>'; | ||
if (entry.aoid) { | ||
return '<emu-xref aoid="' + entry.aoid + '">' + match + '</emu-xref>'; | ||
} else { | ||
return '<emu-xref href="#' + entry.id + '">' + match + '</emu-xref>'; | ||
} | ||
}); | ||
@@ -327,0 +344,0 @@ |
{ | ||
"name": "ecmarkup", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Custom element definitions and core utilities for markup that specifies ECMAScript and related technologies.", | ||
@@ -9,3 +9,4 @@ "main": "lib/ecmarkup.js", | ||
"lint": "eslint bin && eslint lib && eslint test", | ||
"update-pages": "node bin/ecmarkup.js spec/index.html _index.html && git checkout gh-pages && rm index.html && mv _index.html index.html && git add index.html && git commit -m \"update pages\" && git checkout master" | ||
"update-pages": "node bin/ecmarkup.js spec/index.html _index.html && git checkout gh-pages && rm index.html && mv _index.html index.html && git add index.html && git commit -m \"update pages\" && git checkout master", | ||
"update-baselines": "echo for f in test/*.html; do node bin/ecmarkup.js $f $f.baseline; done | bash" | ||
}, | ||
@@ -12,0 +13,0 @@ "bin": { |
@@ -8,3 +8,3 @@ 'use strict'; | ||
const doc = '<!doctype html><pre class=metadata>toc: false</pre><emu-clause><h1>hi</h1></emu-clause>'; | ||
const out = '<!doctype html>\n<head></head><body><emu-clause><h1><span class="secnum">1</span>hi<span class="utils"><span class="anchor"><a href="#">#</a></span></span></h1></emu-clause></body>'; | ||
const out = '<!doctype html>\n<head><meta charset="utf-8"></head><body><emu-clause><h1><span class="secnum">1</span>hi<span class="utils"><span class="anchor"><a href="#">#</a></span></span></h1></emu-clause></body>'; | ||
function fetch(file) { | ||
@@ -11,0 +11,0 @@ if (file.match(/\.json$/)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
444700
71
1776