Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions boilerplate/draft-copyright.html

This file was deleted.

2 changes: 2 additions & 0 deletions css/elements.css
Original file line number Diff line number Diff line change
Expand Up @@ -1635,3 +1635,5 @@ li.menu-search-result-term::before {
background: var(--figure-background);
width: 500px;
}

.adoption-info { display: none; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who is using this and what's it for? I don't see it in ECMA-262.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the paragraph that says "This Ecma Standard was developed by Technical Committee NN and was adopted by the General Assembly of Month Year."

24 changes: 23 additions & 1 deletion css/print.css
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ emu-table th {

caption, table > figcaption {
caption-side: top;
color: #555555;
color: #000;
font-weight: bold;
margin-bottom: 1rem;
text-align: center;
Expand All @@ -442,6 +442,7 @@ table:not(:has(tr:nth-of-type(5))) {
break-inside: avoid-page;
}

/* This inheritance looks weird—it's due to how Prince manages continuity in tables across pages */
table > figcaption {
display: table-caption;
-prince-caption-page: following;
Expand Down Expand Up @@ -658,3 +659,24 @@ h1.version {
p.ECMAaddress {
margin: 0;
}

#sec-terms-and-definitions dfn {
font-style: normal;
}

#sec-terms-and-definitions h1 .secnum {
display: block;
}

#sec-terms-and-definitions > h1 > .secnum {
display: inline;
}

#sec-terms-and-definitions h1 + p {
margin-top: 0;
}

p.adoption-info {
display: block;
float: bottom;
}
31 changes: 11 additions & 20 deletions img/print-inside-cover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion js/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ version.innerHTML = restoreSuperScripts(version.innerHTML);
title.innerHTML = restoreSuperScripts(title.innerHTML);

rearrangeTables();
formatCaptions();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the captions only for print? If Ecma guidelines have us using - instead of :, shouldn't that also apply to the web version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you brought it up 😁 I actually have a change in the actual figures in a follow-up PR. wanted this merged before I opened it.


PDF.pageLayout = 'two-column-right';
PDF.pageMode = 'show-bookmarks';
Expand All @@ -27,6 +28,15 @@ PDF.title = document.title;
PDF.author = 'Ecma International';
PDF.subject = shortname.innerHTML + (version ? ', ' + version.innerHTML : '');

/**
* Terms and definitions section should not have every term listed in the table of contents.
* */
const terms = document.querySelector('#toc a[href="#sec-terms-and-definitions"]');

if (terms) {
(terms.parentElement.querySelector('ol.toc') || document.createElement('i')).remove();
}

function restoreSuperScripts(string) {
if (!string) return false;

Expand All @@ -50,7 +60,7 @@ function rearrangeTables() {

tables.forEach(emuTable => {
const figcaption = emuTable.getElementsByTagName('figcaption')[0];
const tableCaptionText = figcaption.innerHTML;
const tableCaptionText = figcaption.innerHTML.replace(': ', ' — ');
const table = emuTable.getElementsByTagName('table')[0];
const captionElement = document.createElement('caption');

Expand All @@ -61,6 +71,12 @@ function rearrangeTables() {
});
}

function formatCaptions() {
const captions = Array.from(document.getElementsByTagName('figcaption'));

captions.forEach(caption => (caption.innerHTML = caption.innerHTML.replace(': ', ' — ')));
}

/**
* @typedef {Object} PrinceBox
* @property {string} type
Expand Down
20 changes: 10 additions & 10 deletions src/Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@ export default class Spec {
this.log('Building table of contents...');

if (this.opts.printable) {
new Toc(this).build(2);
// Ecma guidance directs three levels of clause in ToC
new Toc(this).build(3);
} else {
({ js: tocJs, eles: commonEles } = makeMenu(this));
}
Expand Down Expand Up @@ -1194,11 +1195,7 @@ ${await utils.readFile(path.join(__dirname, '../js/multipage.js'))}
script.setAttribute('defer', '');
this.doc.head.appendChild(script);

this.addStyle(
this.doc.head,
path.relative(outDir, printStyleLocationOnDisk),
this.opts.printable ? undefined : 'print',
);
this.addStyle(this.doc.head, path.relative(outDir, printStyleLocationOnDisk), 'print');
this.addStyle(this.doc.head, path.relative(outDir, styleLocationOnDisk));
} else {
// i.e. assets.type === 'inline'
Expand Down Expand Up @@ -1494,15 +1491,14 @@ ${this.opts.multipage ? `<li><span>Navigate to/from multipage</span><code>m</cod
}
}

// no title boilerplate generated if title not specified
if (!title) return;

// title
if (title && !this._updateBySelector('title', title)) {
const titleElem = this.doc.createElement('title');
titleElem.innerHTML = utils.textContentFromHTML(this.doc, title);
this.doc.head.appendChild(titleElem);
}

if (title && !this._updateBySelector('h1.title', title)) {
const h1 = this.doc.createElement('h1');
h1.setAttribute('class', 'title');
h1.innerHTML = title;
Expand Down Expand Up @@ -1615,7 +1611,11 @@ ${this.opts.multipage ? `<li><span>Navigate to/from multipage</span><code>m</cod
}
}

let copyright = getBoilerplate(copyrightFile || `${this.opts.status}-copyright`);
// Ecma documents should exclusively have either the standard copyright or the alternative copyright.
// Proposals are not Ecma documents.
let copyright = getBoilerplate(
copyrightFile || `${this.opts.status !== 'proposal' ? 'standard' : 'proposal'}-copyright`,
);
const copyrightElement = this.doc.createElement('div');

copyrightElement.classList.add('copyright-notice');
Expand Down
2 changes: 1 addition & 1 deletion src/lint/collect-spelling-diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const matchers = [
// https://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-our%2C_-or
pattern:
/\b(?:[Bb]ehaviors?|[Ff]lavors?|[Hh]arbors?|[Hh]onors?|[Hh]umors?|[Ll]abors?|[Nn]eighbors?|[Rr]umors?|[Ss]plendors?)\b/gu,
message: 'ECMA-262 uses Oxford spelling ("behaviour", etc.)',
message: 'Ecma uses Oxford spelling ("behaviour", etc.)',
},
{
pattern: /\b[Ii]ndexes\b/gu,
Expand Down
26 changes: 25 additions & 1 deletion test/baselines/generated-reference/assets-inline.html
Original file line number Diff line number Diff line change
Expand Up @@ -3249,6 +3249,8 @@
background: var(--figure-background);
width: 500px;
}

.adoption-info { display: none; }
</style><style>@media print {
@font-face {
font-family: "Arial Plus";
Expand Down Expand Up @@ -3679,7 +3681,7 @@

caption, table > figcaption {
caption-side: top;
color: #555555;
color: #000;
font-weight: bold;
margin-bottom: 1rem;
text-align: center;
Expand All @@ -3694,6 +3696,7 @@
break-inside: avoid-page;
}

/* This inheritance looks weird—it's due to how Prince manages continuity in tables across pages */
table > figcaption {
display: table-caption;
-prince-caption-page: following;
Expand Down Expand Up @@ -3911,6 +3914,27 @@
margin: 0;
}

#sec-terms-and-definitions dfn {
font-style: normal;
}

#sec-terms-and-definitions h1 .secnum {
display: block;
}

#sec-terms-and-definitions > h1 > .secnum {
display: inline;
}

#sec-terms-and-definitions h1 + p {
margin-top: 0;
}

p.adoption-info {
display: block;
float: bottom;
}

}</style><style>
@media print {
@page :left {
Expand Down
22 changes: 18 additions & 4 deletions test/baselines/generated-reference/boilerplate-address.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,29 @@ <h1>Copyright &amp; Software License</h1>
<p class="ECMAaddress">Web: <a href="http://www.tet-corporation.com/">http://www.tet-corporation.com/</a></p>

<div class="copyright-notice" id="copyright-notice"><h2>Copyright Notice</h2>
<p>COPYRIGHT NOTICE</p>

<p>© 2018 Ecma International</p>

<p>This draft document may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published, and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this section are included on all such copies and derivative works. However, this document itself may not be modified in any way, including by removing the copyright notice or references to Ecma International, except as needed for the purpose of developing any document or deliverable produced by Ecma International.</p>
<p>By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.</p>

<p>This document may be copied, published and distributed to others, and certain derivative works of it may be prepared, copied, published, and distributed, in whole or in part, provided that the above copyright notice and this Copyright License and Disclaimer are included on all such copies and derivative works. The only derivative works that are permissible under this Copyright License and Disclaimer are:</p>

<p>(i) works which incorporate all or portion of this document for the purpose of providing commentary or explanation (such as an annotated version of the document),</p>

<p>(ii) works which incorporate all or portion of this document for the purpose of incorporating features that provide accessibility,</p>

<p>(iii) translations of this document into languages other than English and into different formats and</p>

<p>(iv) works by making use of this specification in standard conformant products by implementing (e.g. by copy and paste wholly or partly) the functionality therein.</p>

<p>However, the content of this document itself may not be modified in any way, including by removing the copyright notice or references to Ecma International, except as required to translate it into languages other than English or into a different format.</p>

<p>This disclaimer is valid only prior to final version of this document. After approval all rights on the standard are reserved by Ecma International.</p>
<p>The official version of an Ecma International document is the English language version on the Ecma International website. In the event of discrepancies between a translated version and the official version, the official version shall govern.</p>

<p>The limited permissions are granted through the standardization phase and will not be revoked by Ecma International or its successors or assigns during this time.</p>
<p>The limited permissions granted above are perpetual and will not be revoked by Ecma International or its successors or assigns.</p>

<p>This document and the information contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.</p>
<p>This document and the information contained herein is provided on an AS IS basis and ECMA INTERNATIONAL DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.</p>
</div>
<h2>Software License</h2>
<p>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 <a href="https://ecma-international.org/memento/codeofconduct.htm">https://ecma-international.org/memento/codeofconduct.htm</a> FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.</p>
Expand Down
Loading