Comparing version 1.4.0 to 1.5.0
{ | ||
"https://people.mozilla.org/~jorendorff/es6-draft.html": { | ||
"http://www.ecma-international.org/ecma-262/6.0/index.html": { | ||
"NormalCompletion":"#sec-normalcompletion", | ||
@@ -4,0 +4,0 @@ "Type":"#sec-ecmascript-data-types-and-values", |
@@ -45,2 +45,7 @@ module.exports = Clause; | ||
this.spec.biblio.clauses[this.id] = { | ||
title: this.title, | ||
number: this.number | ||
} | ||
this.notes = this.getNotes(); | ||
@@ -47,0 +52,0 @@ } |
@@ -22,3 +22,3 @@ module.exports = Spec; | ||
function writeFile(file, output) { out = output } | ||
var g = new Grammar(["file.grammar"], { format: EmitFormat.ecmarkup }, readFile); | ||
var g = new Grammar(['file.grammar'], { format: EmitFormat.ecmarkup }, readFile); | ||
g.emit(undefined, writeFile); | ||
@@ -40,2 +40,3 @@ | ||
this.biblio = { | ||
clauses: {}, | ||
ops: {} | ||
@@ -57,2 +58,3 @@ }; | ||
.then(this.highlightCode.bind(this)) | ||
.then(this.buildXrefs.bind(this)) | ||
.then(function() { | ||
@@ -102,3 +104,3 @@ return '<!doctype html>\n' + this.doc.documentElement.innerHTML; | ||
Object.keys(contents).forEach(function(site) { | ||
var ops = contents[site]["abstract operations"]; | ||
var ops = contents[site]['abstract operations']; | ||
Object.keys(ops).forEach(function(alg) { | ||
@@ -204,3 +206,3 @@ spec.externalBiblio.ops[alg] = site + ops[alg]; | ||
// copy attributes over (especially important for "class"). | ||
// copy attributes over (especially important for 'class'). | ||
for(var j = 0; j < ref.attributes.length; j++) { | ||
@@ -223,3 +225,37 @@ var attr = ref.attributes[j]; | ||
Spec.prototype.buildXrefs = function() { | ||
var xrefs = this.doc.querySelectorAll('emu-xref'); | ||
for(var i = 0; i < xrefs.length; i++) { | ||
var xref = xrefs[i]; | ||
var href = xref.getAttribute('href'); | ||
if(!href) { | ||
console.log('Warning: xref has no href.') | ||
continue; | ||
} | ||
if(href[0] !== '#') { | ||
console.log('Warning: xref to anything other than a fragment id is not supported (is ' + href + '). Try href="#sec-id" instead.'); | ||
continue; | ||
} | ||
var entry = this.biblio.clauses[href.slice(1)]; | ||
if(!entry) { | ||
console.log('Warning: can\'t find clause with id ' + href); | ||
} | ||
if(xref.textContent.trim() === '') { | ||
if(xref.hasAttribute('title')) { | ||
xref.innerHTML = '<a href="' + href + '">' + entry.title + '</a>'; | ||
} else { | ||
xref.innerHTML = '<a href="' + href + '">' + entry.number + '</a>'; | ||
} | ||
} else { | ||
xref.innerHTML = '<a href="' + href + '">' + xref.innerHTML + '</a>'; | ||
} | ||
} | ||
} | ||
function buildToc(spec, level) { | ||
@@ -226,0 +262,0 @@ level = level || spec; |
{ | ||
"name": "ecmarkup", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Custom element definitions and core utilities for markup that specifies ECMAScript and related technologies.", | ||
@@ -5,0 +5,0 @@ "main": "lib/ecmarkup.js", |
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
91925
37
1449