diff --git a/boilerplate/proposal-copyright.html b/boilerplate/proposal-copyright.html new file mode 100644 index 00000000..66ee3dbb --- /dev/null +++ b/boilerplate/proposal-copyright.html @@ -0,0 +1 @@ +
© !YEAR! !CONTRIBUTORS!
diff --git a/lib/Spec.js b/lib/Spec.js index 572239ab..251bc78e 100644 --- a/lib/Spec.js +++ b/lib/Spec.js @@ -89,6 +89,14 @@ module.exports = class Spec { if (!this.opts.date) { this.opts.date = new Date(); } + + if (this.opts.stage) { + this.opts.stage = String(this.opts.stage); + } else if (this.opts.status === 'proposal') { + this.opts.stage = '0'; + } else { + this.opts.stage = null; + } } buildAll(selector, Builder, opts) { @@ -246,11 +254,16 @@ module.exports = class Spec { const version = this.opts.version; const title = this.opts.title; const shortname = this.opts.shortname; - const stage = this.opts.stage === undefined ? null : String(this.opts.stage); + const stage = this.opts.stage; - if (this.opts.copyright && (status === 'draft' || status === 'standard')) { - this.buildCopyrightBoilerplate(); + if (this.opts.copyright) { + if (status !== 'draft' && status !== 'standard' && !this.opts.contributors) { + utils.logWarning('Contributors not specified, skipping copyright boilerplate. Specify contributors in your frontmatter metadata.'); + } else { + this.buildCopyrightBoilerplate(); + } } + // no title boilerplate generated if title not specified if (!title) return; @@ -305,16 +318,34 @@ module.exports = class Spec { copyright = fs.readFileSync('boilerplate/draft-copyright.html', 'utf8'); } else if (this.opts.status === 'standard') { copyright = fs.readFileSync('boilerplate/standard-copyright.html', 'utf8'); + } else { + copyright = fs.readFileSync('boilerplate/proposal-copyright.html', 'utf8'); + } + + copyright = copyright.replace(/!YEAR!/g, this.opts.date.getFullYear()); + + if (this.opts.contributors) { + copyright = copyright.replace(/!CONTRIBUTORS!/g, this.opts.contributors); } const softwareLicense = fs.readFileSync('boilerplate/software-license.html', 'utf8'); - let lastAnnex = this.doc.querySelector('body > emu-annex:last-child'); - let lastClause = this.doc.querySelector('body > emu-clause:last-child'); - const last = lastAnnex || lastClause; + let copyrightClause = this.doc.querySelector('.copyright-and-software-license'); + if (!copyrightClause) { + let lastAnnex = this.doc.querySelector('body > emu-annex:last-child'); + let lastClause = this.doc.querySelector('body > emu-clause:last-child'); + const last = lastAnnex || lastClause; + + copyrightClause = this.doc.createElement('emu-annex'); + copyrightClause.setAttribute('id', 'sec-copyright-and-software-license'); + + if (last) { + last.parentNode.insertBefore(copyrightClause, last.previousSibling); + } else { + this.doc.body.appendChild(copyrightClause); + } + } - const copyrightClause = this.doc.createElement('emu-annex'); - copyrightClause.setAttribute('id', 'sec-copyright-and-software-license'); copyrightClause.innerHTML = `toc: false+
+toc: false +copyright: false +
toc: false
toc: false\ncopyright: false
toc: false+
+toc: false +copyright: false +diff --git a/test/charset-present.html b/test/charset-present.html index a5e7884e..86bdbb12 100644 --- a/test/charset-present.html +++ b/test/charset-present.html @@ -1,3 +1,6 @@ -
toc: false+
+toc: false +copyright: false +diff --git a/test/clauses.html b/test/clauses.html index c0fa37c5..4a76b3cf 100644 --- a/test/clauses.html +++ b/test/clauses.html @@ -1,4 +1,7 @@ -
oldToc: true+
+oldToc: true +copyright: false +
toc: false+
+toc: false +copyright: false +
Forward references to dfn work.
diff --git a/test/eqn.html b/test/eqn.html index 021b0133..d0462245 100644 --- a/test/eqn.html +++ b/test/eqn.html @@ -1,5 +1,8 @@ -toc: false+
+toc: false +copyright: false +
Can refer to eqns inside paragraph text via autolinking: DateValue.
diff --git a/test/escaping.html b/test/escaping.html index 03eebe02..3149fdf5 100644 --- a/test/escaping.html +++ b/test/escaping.html @@ -1,4 +1,7 @@ -toc: false+
+toc: false +copyright: false +
U+200C (ZERO WIDTH NON-JOINER) is abbreviated "<ZWNJ>"
diff --git a/test/example.html b/test/example.html index 25c360bf..ffd2742c 100644 --- a/test/example.html +++ b/test/example.html @@ -1,4 +1,7 @@ -toc: false+
+toc: false +copyright: false +
Examples outside of clauses aren't processed specially.
toc: false+
+toc: false +copyright: false +
toc: false+
+toc: false +copyright: false +
toc: false+
+toc: false +copyright: false +
+title: test title! +toc: false +date: 2014-09-26 +contributors: Brian Terlson, Ecma International ++ diff --git a/test/proposal-copyright.html.baseline b/test/proposal-copyright.html.baseline new file mode 100644 index 00000000..f9d48df3 --- /dev/null +++ b/test/proposal-copyright.html.baseline @@ -0,0 +1,22 @@ + +
© 2014 Brian Terlson, Ecma International
+ +All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
+ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ +THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ +toc: false+
+toc: false +copyright: false +