From 84ae0e219de13f8bde854f563782171aec3ef509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aki=20=F0=9F=8C=B9?= Date: Wed, 8 Oct 2025 09:23:45 +0200 Subject: [PATCH 1/5] Update ecmarkup output to align more closely with ecma guidelines I will forever continue to chip away at this until we can publish a standard without someone giving me a page of bullet points that need fixing --- boilerplate/draft-copyright.html | 9 ------ css/elements.css | 2 ++ css/print.css | 24 +++++++++++++- img/print-inside-cover.svg | 31 +++++++------------ js/print.js | 18 ++++++++++- src/Spec.ts | 20 ++++++------ src/lint/collect-spelling-diagnostics.ts | 2 +- .../generated-reference/assets-inline.html | 26 +++++++++++++++- .../boilerplate-address.html | 22 ++++++++++--- .../boilerplate-license.html | 22 ++++++++++--- .../generated-reference/clauses.html | 2 +- .../generated-reference/copyright.html | 22 ++++++++++--- test/lint-spelling.js | 2 +- 13 files changed, 145 insertions(+), 57 deletions(-) delete mode 100644 boilerplate/draft-copyright.html diff --git a/boilerplate/draft-copyright.html b/boilerplate/draft-copyright.html deleted file mode 100644 index a3bbf4a0..00000000 --- a/boilerplate/draft-copyright.html +++ /dev/null @@ -1,9 +0,0 @@ -

© !YEAR! Ecma International

- -

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.

- -

This disclaimer is valid only prior to final version of this document. After approval all rights on the standard are reserved by Ecma International.

- -

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.

- -

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.

diff --git a/css/elements.css b/css/elements.css index cc90cea2..73c0c3b2 100644 --- a/css/elements.css +++ b/css/elements.css @@ -1635,3 +1635,5 @@ li.menu-search-result-term::before { background: var(--figure-background); width: 500px; } + +.adoption-info { display: none; } diff --git a/css/print.css b/css/print.css index befc721a..5f37e7ec 100644 --- a/css/print.css +++ b/css/print.css @@ -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; @@ -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; @@ -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; +} diff --git a/img/print-inside-cover.svg b/img/print-inside-cover.svg index c0f6f02d..696ea1f2 100644 --- a/img/print-inside-cover.svg +++ b/img/print-inside-cover.svg @@ -2,32 +2,23 @@ - + + + C + + + OPYRIGHT PROTECTED DOCUMENT + - COPYRIGHT PROTECTED DOCUMENT - - Ecma International - Rue du Rhone 114 CH-1204 Geneva - Tel: +41 22 849 6000 - Fax: +41 22 849 6001 - Web: - - - https://www.ecma-international.org - - - - - © Ecma International + + © Ecma International - - - - is the registered trademark of Ecma International + + is the registered trademark of Ecma International diff --git a/js/print.js b/js/print.js index 3629a2f6..e1a0ed43 100644 --- a/js/print.js +++ b/js/print.js @@ -19,6 +19,7 @@ version.innerHTML = restoreSuperScripts(version.innerHTML); title.innerHTML = restoreSuperScripts(title.innerHTML); rearrangeTables(); +formatCaptions(); PDF.pageLayout = 'two-column-right'; PDF.pageMode = 'show-bookmarks'; @@ -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; @@ -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'); @@ -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 diff --git a/src/Spec.ts b/src/Spec.ts index 8009b105..59b8e851 100644 --- a/src/Spec.ts +++ b/src/Spec.ts @@ -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)); } @@ -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' @@ -1494,15 +1491,14 @@ ${this.opts.multipage ? `
  • Navigate to/from multipagemNavigate to/from multipagem