Skip to content

Commit e2bec7a

Browse files
committed
move copyright/metadata
1 parent aaaee72 commit e2bec7a

File tree

3 files changed

+38
-48
lines changed

3 files changed

+38
-48
lines changed

css/print.css

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ emu-production,
245245
emu-figure:has(> figure > img) figure,
246246
#metadata-block {
247247
break-inside: avoid;
248+
border: unset;
248249
}
249250

250251
p:has(+ .math-display),

js/print.js

-31
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
const specContainer = document.getElementById('spec-container');
1414
const shortname = specContainer.querySelector('h1.shortname');
1515
const version = specContainer.querySelector('h1.version');
16-
const title = specContainer.querySelector('h1.title');
17-
const year = version.getAttribute('data-year');
1816

1917
rearrangeTables();
2018

@@ -25,22 +23,6 @@ PDF.title = document.title;
2523
PDF.author = 'Ecma International';
2624
PDF.subject = shortname.innerHTML + ', ' + version.innerHTML;
2725

28-
Prince.registerPostLayoutFunc(() => {
29-
/**
30-
* Specific modifications for Ecma standards that don't apply to other
31-
* usages of ecmarkup. In case idk a proposal has the need to publish a PDF.
32-
* */
33-
if (/ECMA-/.test(shortname.innerHTML)) {
34-
const metadataBlock = document.getElementById('metadata-block');
35-
const intro = document.getElementsByTagName('emu-intro')[0];
36-
const scope = document.getElementById('scope') || document.getElementById('sec-scope');
37-
38-
intro.parentNode.insertBefore(generateEcmaCopyrightPage(), scope);
39-
intro.appendChild(metadataBlock);
40-
specContainer.insertBefore(title.cloneNode(true), scope);
41-
}
42-
});
43-
4426
/**
4527
* Sets up table captions and figcaptions for tables, which provides for
4628
* continuation table captions.
@@ -61,19 +43,6 @@ function rearrangeTables() {
6143
});
6244
}
6345

64-
65-
function generateEcmaCopyrightPage() {
66-
const copyrightNotice = document.createElement('div');
67-
68-
copyrightNotice.classList.add('copyright-notice');
69-
copyrightNotice.innerHTML =
70-
'<p>COPYRIGHT NOTICE</p>\n\n<p>© ' +
71-
year +
72-
' Ecma International</p>\n\n<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>\n\n<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>\n\n<p>(ii) works which incorporate all or portion of this document for the purpose of incorporating features that provide accessibility,</p>\n\n<p>(iii) translations of this document into languages other than English and into different formats and</p>\n\n<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>\n\n<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>\n\n<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>\n\n<p>The limited permissions granted above are perpetual and will not be revoked by Ecma International or its successors or assigns.</p>\n\n<p>This document and the information contained herein is provided on an &ldquo;AS IS&rdquo; 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>';
73-
74-
return copyrightNotice;
75-
}
76-
7746
/**
7847
* @typedef {Object} PrinceBox
7948
* @property {string} type

src/Spec.ts

+37-17
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,16 @@ export default class Spec {
592592
const wrapper = this.buildSpecWrapper();
593593

594594
if (this.opts.printable) {
595-
this.log('Building covers...');
595+
this.log('Building covers and applying other print tweaks...');
596+
const metadataEle = this.doc.querySelector('#metadata-block');
597+
if (metadataEle) {
598+
this.doc.querySelector('emu-intro')!.appendChild(metadataEle);
599+
}
600+
const scopeEle = document.getElementById('scope') ?? document.getElementById('sec-scope');
601+
if (!scopeEle) {
602+
throw new Error('--printable requires a scope');
603+
}
604+
scopeEle.before(this.doc.querySelector('h1.title')!.cloneNode(true));
596605

597606
// front cover
598607
const frontCover = document.createElement('div');
@@ -620,6 +629,8 @@ export default class Spec {
620629
insideCover.innerHTML = '<p>Ecma International<br />Rue du Rhone 114 CH-1204 Geneva<br/>Tel: +41 22 849 6000<br/>Fax: +41 22 849 6001<br/>Web: https://www.ecma-international.org<br/>Ecma is the registered trademark of Ecma International.</p>';
621630

622631
frontCover.after(insideCover);
632+
633+
623634
}
624635

625636
let commonEles: HTMLElement[] = [];
@@ -1416,7 +1427,29 @@ ${this.opts.multipage ? `<li><span>Navigate to/from multipage</span><code>m</cod
14161427
'contributors not specified, skipping copyright boilerplate. specify contributors in your frontmatter metadata',
14171428
});
14181429
} else {
1419-
this.buildCopyrightBoilerplate();
1430+
const copyrightClause = this.buildCopyrightBoilerplate();
1431+
if (this.opts.printable) {
1432+
let intro = this.doc.querySelector('emu-intro');
1433+
if (!intro) {
1434+
throw new Error('--printable requires an emu-intro');
1435+
}
1436+
intro.after(copyrightClause);
1437+
} else {
1438+
let last: HTMLElement | undefined;
1439+
utils.domWalkBackward(this.doc.body, node => {
1440+
if (last) return false;
1441+
if (node.nodeName === 'EMU-CLAUSE' || node.nodeName === 'EMU-ANNEX') {
1442+
last = node as HTMLElement;
1443+
return false;
1444+
}
1445+
});
1446+
1447+
if (last && last.parentNode) {
1448+
last.parentNode.insertBefore(copyrightClause, last.nextSibling);
1449+
} else {
1450+
this.doc.body.appendChild(copyrightClause);
1451+
}
1452+
}
14201453
}
14211454
}
14221455

@@ -1561,23 +1594,8 @@ ${this.opts.multipage ? `<li><span>Navigate to/from multipage</span><code>m</cod
15611594

15621595
let copyrightClause = this.doc.querySelector('.copyright-and-software-license');
15631596
if (!copyrightClause) {
1564-
let last: HTMLElement | undefined;
1565-
utils.domWalkBackward(this.doc.body, node => {
1566-
if (last) return false;
1567-
if (node.nodeName === 'EMU-CLAUSE' || node.nodeName === 'EMU-ANNEX') {
1568-
last = node as HTMLElement;
1569-
return false;
1570-
}
1571-
});
1572-
15731597
copyrightClause = this.doc.createElement('emu-annex');
15741598
copyrightClause.setAttribute('id', 'sec-copyright-and-software-license');
1575-
1576-
if (last && last.parentNode) {
1577-
last.parentNode.insertBefore(copyrightClause, last.nextSibling);
1578-
} else {
1579-
this.doc.body.appendChild(copyrightClause);
1580-
}
15811599
}
15821600
copyrightClause.setAttribute('back-matter', '');
15831601

@@ -1589,6 +1607,8 @@ ${this.opts.multipage ? `<li><span>Navigate to/from multipage</span><code>m</cod
15891607
<h2>Software License</h2>
15901608
${license}
15911609
`;
1610+
1611+
return copyrightClause;
15921612
}
15931613

15941614
private generateSDOMap() {

0 commit comments

Comments
 (0)