');
+ this.node.innerHTML = this.autolinkOps(contents);
+ }
+};
diff --git a/lib/Production.js b/lib/Production.js
index d06164a7..91e0f302 100644
--- a/lib/Production.js
+++ b/lib/Production.js
@@ -18,7 +18,7 @@ module.exports = class Production extends Builder {
this.rhsesById = {};
const rhses = this.node.querySelectorAll('emu-rhs');
- for (const i = 0; i < rhses.length; i++) {
+ for (let i = 0; i < rhses.length; i++) {
const rhs = new RHS(this.spec, this, rhses[i]);
this.rhses.push(rhs);
diff --git a/lib/Spec.js b/lib/Spec.js
index abc1e7e2..25a6543b 100644
--- a/lib/Spec.js
+++ b/lib/Spec.js
@@ -17,6 +17,7 @@ const Production = require('./Production');
const ProdRef = require('./ProdRef');
const Grammar = require('./Grammar');
const Xref = require('./Xref');
+const Eqn = require('./Eqn');
const NO_CLAUSE_AUTOLINK = ['PRE', 'CODE', 'EMU-CLAUSE', 'EMU-ALG', 'EMU-PRODUCTION', 'EMU-GRAMMAR', 'EMU-XREF', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
const clauseTextNodesUnder = utils.textNodesUnder(NO_CLAUSE_AUTOLINK);
@@ -67,16 +68,21 @@ module.exports = class Spec {
elems = selector;
}
+ const builders = [];
const ps = [];
+ for (let i = 0; i < elems.length; i++) {
+ const b = new Builder(this, elems[i]);
+ builders.push(b);
+ }
+
if (opts.buildArgs) {
- for (const i = 0; i < elems.length; i++) {
- const b = new Builder(this, elems[i]);
- ps.push(b.build.apply(b, opts.buildArgs));
+ for (let i = 0; i < elems.length; i++) {
+ ps.push(builders[i].build.apply(builders[i], opts.buildArgs));
}
} else {
- for (const i = 0; i < elems.length; i++) {
- ps.push(new Builder(this, elems[i]).build());
+ for (let i = 0; i < elems.length; i++) {
+ ps.push(builders[i].build());
}
}
@@ -89,6 +95,7 @@ module.exports = class Spec {
.then(this.loadBiblios.bind(this))
.then(this.buildAll.bind(this, 'emu-clause, emu-intro, emu-annex', Clause))
.then(this.buildAll.bind(this, 'emu-grammar', Grammar))
+ .then(this.buildAll.bind(this, 'emu-eqn', Eqn))
.then(this.buildAll.bind(this, 'emu-alg', Algorithm))
.then(this.buildAll.bind(this, 'emu-production', Production))
.then(this.buildAll.bind(this, 'emu-prodref', ProdRef))
@@ -177,7 +184,7 @@ module.exports = class Spec {
highlightCode() {
this._log('Highlighting syntax...');
const codes = this.doc.querySelectorAll('pre code');
- for (const i = 0; i < codes.length; i++) {
+ for (let i = 0; i < codes.length; i++) {
hljs.highlightBlock(codes[i]);
}
}
@@ -214,7 +221,7 @@ module.exports = class Spec {
autolinkWalk(clauseReplacer, autolinkmap, this, this);
const algs = this.doc.getElementsByTagName('emu-alg');
- for (const i = 0; i < algs.length; i++) {
+ for (let i = 0; i < algs.length; i++) {
const alg = algs[i];
autolink(algReplacer, termlinkmap, this, alg);
}
@@ -248,7 +255,7 @@ function autolinkWalk(replacer, autolinkmap, spec, rootClause) {
function autolink(replacer, autolinkmap, spec, node, parentId) {
const textNodes = clauseTextNodesUnder(node);
- for (const i = 0; i < textNodes.length; i++) {
+ for (let i = 0; i < textNodes.length; i++) {
const node = textNodes[i];
const template = spec.doc.createElement('template');
diff --git a/lib/utils.js b/lib/utils.js
index 867712e2..76b4ad78 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -16,7 +16,7 @@ exports.domWalk = function (root, cb) {
const childNodes = root.childNodes;
const childLen = childNodes.length;
- for (const i = 0; i < childLen; i++) {
+ for (let i = 0; i < childLen; i++) {
const node = childNodes[i];
if (node.nodeType !== 1) continue;
diff --git a/package.json b/package.json
index e95460b9..f7c91fcd 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ecmarkup",
- "version": "2.0.0-beta1",
+ "version": "2.0.0-beta2",
"description": "Custom element definitions and core utilities for markup that specifies ECMAScript and related technologies.",
"main": "lib/ecmarkup.js",
"scripts": {
diff --git a/spec/biblio.json b/spec/biblio.json
index 5579632a..409f7129 100644
--- a/spec/biblio.json
+++ b/spec/biblio.json
@@ -1,8 +1,14 @@
{
"http://people.mozilla.org/~jorendorff/es6-draft.html": {
- "abstract operations": {
- "ReturnIfAbrupt": "#sec-returnifabrupt",
- "Get": "#sec-get-o-p"
+ "ops": {
+ "ReturnIfAbrupt": {
+ "id": "sec-returnifabrupt",
+ "aoid": "ReturnIfAbrupt"
+ },
+ "Get": {
+ "id": "sec-get-o-p",
+ "aoid": "Get"
+ }
}
}
}
diff --git a/spec/index.html b/spec/index.html
index 65aebbea..d79b4e2b 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -38,7 +38,7 @@
Stylesheet
Metadata
There are a number of settings that allow customizations or enable generation of boilerplate. Metadata can be included in the document and passed on the command line, for example `--no-toc --title "Document 1"`. Metadata given on the command line takes precedence.
-
To add metadata to your document, use yaml syntax inside a `
` element somewhere in the root of your document.
+
To add metadata to your document, use yaml syntax inside a `<pre class=metadata>` element somewhere in the root of your document.
The following table lists the currently supported metadata:
toc
Emit table of contents. Boolean, default true.
@@ -108,6 +108,13 @@
Result
+
+
emu-eqn
+
An equation, similar to those found in ES6 .
+
+
Attributes
+
aoid: Required: the abstract operation id that this equation defines.
+
emu-note
Non-normative explanatory text.
diff --git a/test/eqn.html b/test/eqn.html
new file mode 100644
index 00000000..e6c12eb7
--- /dev/null
+++ b/test/eqn.html
@@ -0,0 +1,28 @@
+
+
toc: false
+
+ 1. Return Value(_val_);
+
+
+
+ Value2(t)
+ = DateValue(t) if Type(t) is string
+ = t
+
+
+
+ DateValue(t)
+ = 0 if t = 0
+ = 1 if t = 1
+ = 2
+
+
+
+ Value(t)
+ = DateValue(t) if Type(t) is string
+ = t
+
+
+
+ 1. Return Value(_val_);
+
diff --git a/test/eqn.html.baseline b/test/eqn.html.baseline
new file mode 100644
index 00000000..84bc68f9
--- /dev/null
+++ b/test/eqn.html.baseline
@@ -0,0 +1,13 @@
+
+
+
+