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 = `

Copyright & Software License

Copyright Notice

@@ -323,11 +354,6 @@ module.exports = class Spec { ${softwareLicense} `; - if (last) { - last.parentNode.insertBefore(copyrightClause, last.previousSibling); - } else { - this.doc.body.appendChild(copyrightClause); - } } autolink() { diff --git a/package.json b/package.json index 58ab6162..77d60ae1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ecmarkup", - "version": "2.3.0", + "version": "2.4.0", "description": "Custom element definitions and core utilities for markup that specifies ECMAScript and related technologies.", "main": "lib/ecmarkup.js", "scripts": { diff --git a/spec/index.html b/spec/index.html index eb2a6f28..5f9397be 100644 --- a/spec/index.html +++ b/spec/index.html @@ -60,6 +60,7 @@

Useful Options

shortnameShortname of specification, for example `ECMA-262` or `ECMA-402`. locationURL of this specification. Use in conjunction with the biblio file to enable external specs to reference this one. copyrightEmit copyright and software license information. Boolean, default true. + contributorsContributors to this specification, ie. those who own the copyright. If your proposal includes text from any Ecma specification, you should include "Ecma International" in this list. tocEmit table of contents. Boolean, default true. old-tocEmit the old style of table of contents. Boolean, default false. diff --git a/test/algorithms.html b/test/algorithms.html index 5d5a825e..2d52895c 100644 --- a/test/algorithms.html +++ b/test/algorithms.html @@ -1,4 +1,7 @@ -
toc: false
+
+toc: false
+copyright: false
+
1. Can call abstract operations in this spec: Internal(); diff --git a/test/build.js b/test/build.js index de8e0ad6..f9c62b99 100644 --- a/test/build.js +++ b/test/build.js @@ -4,7 +4,7 @@ const Promise = require('bluebird'); const build = require('../lib/ecmarkup').build; -const doc = '
toc: false

hi

'; +const doc = '
toc: false\ncopyright: false

hi

'; const out = '\n

1hi#

'; function fetch(file) { if (file.match(/\.json$/)) { diff --git a/test/charset-absent.html b/test/charset-absent.html index 96e1b3b9..b5f960bb 100644 --- a/test/charset-absent.html +++ b/test/charset-absent.html @@ -1 +1,4 @@ -
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
+

Intro

diff --git a/test/dfn.html b/test/dfn.html index b961e842..317ed946 100644 --- a/test/dfn.html +++ b/test/dfn.html @@ -1,4 +1,7 @@ - +

Intro

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 @@ - +

Header

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 @@ - +

blah

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 @@ - +

Examples outside of clauses aren't processed specially.

This is an example. diff --git a/test/figure.html b/test/figure.html index 31b88c68..a580f666 100644 --- a/test/figure.html +++ b/test/figure.html @@ -1,4 +1,7 @@ - + this is a figure! diff --git a/test/imports.html b/test/imports.html index a7773981..06a0f6a1 100644 --- a/test/imports.html +++ b/test/imports.html @@ -1,4 +1,7 @@ - + diff --git a/test/notes.html b/test/notes.html index 94ed16de..747462ee 100644 --- a/test/notes.html +++ b/test/notes.html @@ -1,4 +1,7 @@ - + This is a note. Since it is outside a clause it is unstyled. diff --git a/test/proposal-copyright.html b/test/proposal-copyright.html new file mode 100644 index 00000000..bcb70ceb --- /dev/null +++ b/test/proposal-copyright.html @@ -0,0 +1,7 @@ + + 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 @@ + +test title!

Stage 0 Draft / September 26, 2014

test title!

+ + +

ACopyright & Software License#

+

Copyright Notice

+

© 2014 Brian Terlson, Ecma International

+ +

Software License

+

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:

+ +
    +
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. +
  3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  4. +
  5. Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.
  6. +
+ +

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.

+ +
\ No newline at end of file diff --git a/test/xref.html b/test/xref.html index 3914842f..087be88f 100644 --- a/test/xref.html +++ b/test/xref.html @@ -1,4 +1,7 @@ - +

Clause Title