Skip to content

Commit

Permalink
Add process for generating the spec PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Sep 13, 2024
1 parent c3e8245 commit b6dd009
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 0 deletions.
Binary file added ecma-style/cover.odt
Binary file not shown.
54 changes: 54 additions & 0 deletions ecma-style/ecma.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
.head, .toc-nav, .self-link {
display: none;
}

#toc span {
margin-top: 0 !important;
}

#toc {
break-after: page;
}


#pdf-title,
#copyright,
/* #copyright-before, */
#copyright-after {
display: block !important;
}

#copyright {
border: 2px solid black;
padding: 10px;
break-before: page;
break-after: page;

* {
line-height: 1;
}
}

#copyright-before, #copyright-after {
break-before: page;
break-after: page;
}


#contents {
margin-top: 0;
}

dt, h1, h2, h3, h4, h5, h6 {
break-after: avoid;
}

#print-title, #license, #index {
break-before: page;
}

@page {
margin-top: 4cm;
margin-bottom: 2.5cm;
size: A4 portrait;
}
Binary file added ecma-style/headers-and-footers-numbers.pdf
Binary file not shown.
Binary file added ecma-style/headers-and-footers-roman.pdf
Binary file not shown.
28 changes: 28 additions & 0 deletions ecma-style/instructions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
This document explains how to generate a PDF version of the spec

1. Open ./cover.odt, adjust the year, and print it as PDF.
2. Add `<link rel="stylesheet" href="./ecma-style/ecma.css">` to the bikeshed
document.
3. View the print preview of the specification as PDF from a browser
- If needed, add `break-before`/`break-after`/`break-inside` CSS rules to
specific elements to ensure that page breaks are inserted in the right
places.
4. Print as PDF the pages containing the "Table of Contents", "Introduction",
and "copyright notice". Also include the empty page after the copyright.
- Make sure that the copyright notice is on an _odd_ page, by toggling
`display: none` on `#copyright-before`.
- Using https://tools.pdf24.org/en/overlay-pdf, overlay the
./headers-and-footers-roman.pdf on top of the generated PDF to add
headers and footers.
5. Print as PDF pages from the one containing the "Scope" section to the end
- Using https://tools.pdf24.org/en/overlay-pdf, overlay the
./headers-and-footers-numbers.pdf on top of the generated PDF to add
headers and footers.
6. Using https://pdfjoiner.com/, merge the 3 PDFs obtained at the previous
steps.

This has been verified using Firefox. Results with different browsers may vary.

The files ./headers-and-footers-numbers.pdf and ./headers-and-footers-roman.pdf
have been generated by adding a lot of empty pages in the template for
specifications from the Ecma drive.
47 changes: 47 additions & 0 deletions source-map.bs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Markup Shorthands: markdown yes
Group: tc39
</pre>

<!-- Uncomment the next line when generating the PDF version of the spec -->
<!-- <link rel="stylesheet" href="./ecma-style/ecma.css"> -->

<pre class=link-defaults>
spec:html; type:element;
text:a
Expand Down Expand Up @@ -133,6 +136,50 @@ Pavel Podivilov (Google).
The Source Map format does not have version numbers anymore, and it is instead
hard-coded to always be "3".

<div style="display: none" id="copyright-before"></div>
<div style="display: none" id="copyright">
<p>COPYRIGHT NOTICE</p>
<p>© 2024 Ecma International</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>
<ol>
<li>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),</li>
<li>works which incorporate all or portion of this document for the purpose of incorporating
features that provide accessibility,</li>
<li>translations of this document into languages other than English and into different formats
and</li>
<li>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.</li>
</ol>

<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>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 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>
</div>
<div style="display: none" id="copyright-after"></div>

<!-- Use a script tag because bikeshed doesn't like <h1> tags -->
<script>document.write(`
<h1 id="pdf-title" style="display: none" id="print-title">Source Map specification</h1>
`)</script>

Scope {#scope}
==============

Expand Down

0 comments on commit b6dd009

Please sign in to comment.