Commit 4b5bb905 authored by Fred Chasen's avatar Fred Chasen

Fixes for footnote marker and call content and styles

parent 86442338
Pipeline #668 failed with stage
in 1 minute and 37 seconds
This diff is collapsed.
This diff is collapsed.
const TIMEOUT = 10000;
describe("footnotes", () => {
let page;
beforeAll(async () => {
page = await loadPage("notes/footnotes/footnotes.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should render 2 pages", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => {
return r.length;
});
expect(pages).toEqual(2);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
expect(pdf).toMatchPDFSnapshot(2);
});
}
}
);
<!DOCTYPE html PUBLIC>
<html lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>
Footnotes
</title>
<!-- Paged js-->
<script src="../../../dist/paged.polyfill.js"></script>
<style>
body {
widows: 1;
orphans: 1;
}
@media screen {
.pagedjs_page {
box-shadow: 0 0 0 1px rgba(0, 0,0,0.2);
}
}
.footnote {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 14px;
margin-top: 16px;
color: grey;
}
@page {
size: 160mm 210mm;
margin-top: 83px;
margin-bottom: 86px;
margin-left: 35mm;
margin-right: 35mm;
@bottom-left{
content: counter(page);
}
@footnote {
border-top: dashed red 1px;
margin-top: 12px;
float: bottom;
}
}
span.footnote {
float: footnote;
}
.footnote::footnote-call {
color: red;
}
.footnote::footnote-marker {
color: blue;
}
p{
font-family: Georgia, 'Times New Roman', Times, serif;
margin-top: 0;
margin-bottom: 0;
text-align: justify;
font-size: 14px;
line-height: 16px;
}
.afnanch{ display: none; }
hr{
border: none;
}
.pfirst{
padding-top: 50mm;
}
</style>
</head>
<body>
<p>new theory confronts
us, which at first blush seems to supply, if not a more probable, certainly a more
possible, stepping-stone between Xylography and Typography. We refer to
what Meerman, the great champion of this theory,
calls the “sculpto-fusi” characters: types, that is, the shanks of which have been cast in a quadrilateral
mould, and the “faces” engraved by hand afterwards.</p>
<p>Meerman and those who agree with him engage a large array of testimony
on their side. In the reference of Celtis, in 1502, to Mentz as the city “quæ
prima sculpsit solidos ære characteres,” they see a clear confirmation of their
theory; as also in the frequent recurrence of the same word “sculptus” in the
colophons of the early printers. Meerman, indeed, goes so far as to ingeniously
explain the famous account of the invention given by Trithemius in 1514,<span class="footnote" data-note="14" id="note-14"><em>Annales Hirsaugienses</em>, ii,
p. 421: “Post hæc inventis
successerunt subtiliora, inveneruntque modum fundendi formas omnium
Latini Alphabeti literarum quas ipsi matrices nominabant; ex quibus
rursum æneos sive stanneos characteres fundebant, ad omnem pressuram
sufficientes, quos prius manibus sculpebant.” Trithemius’ statement, as
every student of typographical history is aware, has been made to fit
every theory that has been propounded, but it is doubtful whether any
other writer has stretched it quite as severely as Meerman in the above
rendering of these few Latin lines.</span>
in the light of his theory, to mean that, after the rejection of the first wooden types, “the
inventors found out a method of casting the bodies only (fundendi formas) of all
the letters of the Latin alphabet from what they called matrices, on which they
cut the face of each letter; and from the same kind of matrices a method was in
time discovered of casting the complete letters (æneos sive stanneos characteres)
of sufficient hardness for the pressure they had to bear, which letters before—that
is, when the bodies only were cast—they were obliged to cut.”<span class="footnote" data-note="15" id="note-15"><em>Origines Typographicæ</em>,
Gerardo Meerman auctore. Hagæ
Com., 1765. Append., p. 47.</span></p>
<p>After this bold flight of translation, it is not surprising to find that Meerman
claims that the <em>Speculum</em> was printed in “sculpto-fusi” types, although in the
one page of which he gives a facsimile there are nearly 1,700 separate types, of
which 250 alone are <em>e</em>’s.</p>
<p>Schoepflin, claiming the same invention for the Strasburg printers, believes
that all the earliest books printed there were produced by this means; and both
Meer­man and Schoep­flin agree that engraved metal types were in use for many
years after the invention of the punch and matrix, mentioning, among others so
printed, the Mentz <em>Psalter</em>, the <em>Catholicon</em> of 1460, the Eggestein <em>Bible</em> of 1468,
and even the <em>Nideri Præ­cep­tor­ium</em>, printed at Stras­burg as late as 1476, as “literis
in ære sculptis.”</p>
<p>Almost the whole historical claim of the engraved metal types, indeed, turns
on the recurrence of the term “sculptus” in the colophons of the early printers.
Jenson, in 1471, calls himself a “cutter of books” (librorum exsculptor).
Sen­sen­schmid,
in 1475, says that the <em>Codex Jus­tin­ianus</em> is “cut” (insculptus), and that
he has “cut” (sculpsit) the work of <em>Lombardus in Psalterium</em>. Husner of Strasburg,
in 1472, applies the term “printed with letters
cut of metal” (exsculptis ære litteris) to the <em>Speculum Durandi</em>; and of the <em>Præceptorium
Nideri</em>, printed in
1476, he says it is “printed in letters cut of metal by a very ingenious effort”
(litteris exsculptis artificiali certe conatu ex ære). As Dr. Van der Linde points
out, the use of the term in reference to all these books can mean nothing else
than a figurative allusion to the first process towards producing the types, namely,
the cutting of the punch<span class="footnote" data-note="16"
id="note-16">The constant recurrence in more modern typographical
history of the expression “to cut matrices,” meaning of course to
cut the punches necessary to form the matrices, bears out the same
conclusion.</span>; just as when Schoeffer, in 1466, makes his <em>Grammatica
Vetus Rhythmica</em> say, “I am cast at Mentz” (At Moguntia sum fusus in urbe
libellus), he means nothing more than a figurative allusion to the casting of the
types.</p>
<p>The theory of the sculpto-fusi types appears to have sprung up on no firmer
foundation than the difficulty of accounting for the marked irregularities in the
</p>
</body>
</html>
\ No newline at end of file
const TIMEOUT = 10000;
describe("footnotes", () => {
let page;
beforeAll(async () => {
page = await loadPage("notes/footnotes/footnotes.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should render 14 pages", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => {
return r.length;
});
expect(pages).toEqual(14);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(2);
expect(pdf).toMatchPDFSnapshot(3);
expect(pdf).toMatchPDFSnapshot(4);
});
}
}
);
<!DOCTYPE html PUBLIC>
<html lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>
Footnotes
</title>
<!-- Paged js-->
<script src="../../../dist/paged.polyfill.js"></script>
<style>
body {
widows: 1;
orphans: 1;
}
@media screen {
.pagedjs_page {
box-shadow: 0 0 0 1px rgba(0, 0,0,0.2);
}
}
.footnote {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 14px;
margin-top: 16px;
color: grey;
}
@page {
size: 160mm 210mm;
margin-top: 83px;
margin-bottom: 86px;
margin-left: 35mm;
margin-right: 35mm;
@bottom-left{
content: counter(page);
}
@footnote {
border-top: dashed red 1px;
margin-top: 12px;
float: bottom;
}
}
span.footnote {
float: footnote;
footnote-policy: auto;
footnote-display: compact;
}
.footnote::footnote-call {
color: red;
}
.footnote::footnote-marker {
color: blue;
}
p{
font-family: Georgia, 'Times New Roman', Times, serif;
margin-top: 0;
margin-bottom: 0;
text-align: justify;
font-size: 14px;
line-height: 16px;
}
.afnanch{ display: none; }
hr{
border: none;
}
.pfirst{
padding-top: 50mm;
}
</style>
</head>
<body>
<p>the passage from Xylography to Typography. Those who write on the
affirmative side of the question profess to see in the earlier typographical works,
as well as in the historical statements handed down by the
old authorities, the clearest evidence that wooden types were used, and that several of the most
famous works of the first printers were executed by their means.</p>
<p>As regards the latter source of their confidence, it is at least remarkable
that no single writer of the fifteenth century makes the slightest allusion to the
use of wooden types. Indeed, it was not till Bibliander, in 1548,<span class="footnote" data-note="04" id="note-04"><em>In Commentatione de ratione
communi omnium linguarum et
literarum.</em> Tiguri, 1548, p. 80.</span>
first mentioned
and described them, that anything professing to be a record on the subject
existed. “First they cut their letters,” he says, “on wood blocks the size of an
entire page, but because the labour and cost of that way was so great, they devised
movable wooden types, perforated and joined one to the other by a thread.”</p>
<p>The legend, once started, found no lack of sponsors, and the typographical
histories of the sixteenth century and onward abound with testimonies confirmatory
more or less of Bibliander’s statement. Of these testimonies, those only
are worthy of attention which profess to be based on actual inspection of the
alleged perforated wooden types. Specklin
(who died in 1589) asserts that he
saw some of these relics at Strasburg<span class="footnote" data-note="05" id="note-05">In <em>Chronico Argentoratensi</em>, <em>m.s.</em> ed. Jo.
Schilterus,
p. 442. “Ich habe die erste press, auch die buchstaben gesehen, waren
von holtz geschnitten, auch gäntze wörter und syllaben, hatten löchle,
und fasst man an ein schnur nacheinander mit einer nadel, zoge sie
darnach den zeilen in die länge,” etc.</span>. Angelo Roccha,<span
class="footnote" data-note="06" id="note-06"><em>De Bibliothecâ Vaticanâ.</em> Romæ, 1591, p. 412.
“Characteres enim a primis illis inventoribus non ita eleganter et
expedite, ut a nostris fieri solet, sed filo in litterarum foramen
immisso connectebantur, sicut Venetiis id genus typos me vidisse
memini.”</span>
in 1591, vouches for the
existence of similar letters (though he does not say whether wood or metal) at
Venice. </p>
</body>
</html>
\ No newline at end of file
const TIMEOUT = 10000;
describe("footnotes", () => {
let page;
beforeAll(async () => {
page = await loadPage("notes/footnotes/footnotes.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should render 2 pages", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => {
return r.length;
});
expect(pages).toEqual(2);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
expect(pdf).toMatchPDFSnapshot(2);
});
}
}
);
<!DOCTYPE html PUBLIC>
<html lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>
Footnotes
</title>
<!-- Paged js-->
<script src="../../../dist/paged.polyfill.js"></script>
<style>
body {
widows: 1;
orphans: 1;
}
@media screen {
.pagedjs_page {
box-shadow: 0 0 0 1px rgba(0, 0,0,0.2);
}
}
.footnote {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 14px;
margin-top: 16px;
color: grey;
}
@page {
size: 160mm 210mm;
margin-top: 83px;
margin-bottom: 86px;
margin-left: 35mm;
margin-right: 35mm;
@bottom-left{
content: counter(page);
}
@footnote {
border-top: dashed red 1px;
margin-top: 12px;
float: bottom;
}
}
span.footnote {
float: footnote;
footnote-policy: auto;
footnote-display: compact;
}
.footnote::footnote-call {
color: red;
font-size: 30px;
}
.footnote::footnote-marker {
color: blue;
}
p{
font-family: Georgia, 'Times New Roman', Times, serif;
margin-top: 0;
margin-bottom: 0;
text-align: justify;
font-size: 14px;
line-height: 16px;
}
.afnanch{ display: none; }
hr{
border: none;
}
.pfirst{
padding-top: 50mm;
}
</style>
</head>
<body>
<p>the passage from Xylography to Typography. Those who write on the
affirmative side of the question profess to see in the earlier typographical works,
as well as in the historical statements handed down by the
old authorities, the clearest evidence that wooden types were used, and that several of the most
famous works of the first printers were executed by their means.</p>
<p>As regards the latter source of their confidence, it is at least remarkable
that no single writer of the fifteenth century makes the slightest allusion to the
use of wooden types. Indeed, it was not till Bibliander, in 1548,<span class="footnote" data-note="04" id="note-04"><em>In Commentatione de ratione
communi omnium linguarum et
literarum.</em> Tiguri, 1548, p. 80.</span>
first mentioned
and described them, that anything professing to be a record on the subject
existed. “First they cut their letters,” he says, “on wood blocks the size of an
entire page, but because the labour and cost of that way was so great, they devised
movable wooden types, perforated and joined one to the other by a thread.”</p>
<p>The legend, once started, found no lack of sponsors, and the typographical
histories of the sixteenth century and onward abound with testimonies confirmatory
more or less of Bibliander’s statement. Of these testimonies, those only
are worthy of attention which profess to be based on actual inspection of the
alleged perforated wooden types. Specklin
(who died in 1589) asserts that he
saw some of these relics at Strasburg<span class="footnote" data-note="05" id="note-05">In <em>Chronico Argentoratensi</em>, <em>m.s.</em> ed. Jo.
Schilterus,
p. 442. “Ich habe die erste press, auch die buchstaben gesehen, waren
von holtz geschnitten, auch gäntze wörter und syllaben, hatten löchle,
und fasst man an ein schnur nacheinander mit einer nadel, zoge sie
darnach den zeilen in die länge,” etc.</span>. Angelo Roccha,<span
class="footnote" data-note="06" id="note-06"><em>De Bibliothecâ Vaticanâ.</em> Romæ, 1591, p. 412.
“Characteres enim a primis illis inventoribus non ita eleganter et
expedite, ut a nostris fieri solet, sed filo in litterarum foramen
immisso connectebantur, sicut Venetiis id genus typos me vidisse
memini.”</span>
in 1591, vouches for the
existence of similar letters (though he does not say whether wood or metal) at
Venice. </p>
</body>
</html>
\ No newline at end of file
const TIMEOUT = 10000;
describe("footnotes", () => {
let page;
beforeAll(async () => {
page = await loadPage("notes/footnotes/footnotes-styles.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should render 2 pages", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => {
return r.length;
});
expect(pages).toEqual(2);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
expect(pdf).toMatchPDFSnapshot(2);
});
}
}
);
......@@ -31,15 +31,21 @@ class Footnotes extends Handler {
let policy = identifier && identifier.name;
if (policy) {
let selector = csstree.generate(rule.ruleNode.prelude);
this.footnotes[selector].policy = policy;
let note = this.footnotes[selector];
if(note) {
note.policy = policy;
}
}
}
if (property === "footnote-display") {
let identifier = declaration.value.children && declaration.value.children.first();
let display = identifier && identifier.name;
if (display) {
if (display && this.footnotes[selector]) {
let selector = csstree.generate(rule.ruleNode.prelude);
this.footnotes[selector].display = display;
let note = this.footnotes[selector];
if (note) {
note.display = display;
}
}
}
}
......@@ -48,33 +54,82 @@ class Footnotes extends Handler {
onPseudoSelector(pseudoNode, pItem, pList, selector, rule) {
let name = pseudoNode.name;
if (name === "footnote-marker" ) {
// switch ::footnote-marker to ::before
pseudoNode.name = "before";
// update class selector to include attribute
let selectors = rule.ruleNode.prelude;
csstree.walk(selectors, {
visit: "ClassSelector",
enter: (node, item, list) => {
if (node.name) {
node.name += `[data-${name}]`;
}
// switch ::footnote-marker to [data-footnote-marker]::before
let prelude = rule.ruleNode.prelude;
let newPrelude = new csstree.List();
// Can't get remove to work, so just copying everything else
prelude.children.first().children.each((node) => {
if (node.type !== "PseudoElementSelector") {
newPrelude.appendData(node);
}
})
// newPrelude.appendData({
// type: "WhiteSpace",
// value: " ",
// loc: null
// });
// Add our data call
newPrelude.appendData({
type: "AttributeSelector",
name: {
type: "Identifier",
name: "data-footnote-marker",
},
flags: null,
loc: null,
matcher: null,
value: null
});
// Add new pseudo element
newPrelude.appendData({
type: "PseudoElementSelector",
name: "marker",
loc: null,
children: null
});
prelude.children.first().children = newPrelude;
}
if (name === "footnote-call") {
// switch ::footnote-call to ::after
pseudoNode.name = "after";
// update class selector to include attribute and extension
let selectors = rule.ruleNode.prelude;
csstree.walk(selectors, {
visit: "ClassSelector",
enter: (node, item, list) => {
if (node.name) {
node.name += `_pagedjs-${name}`;
}
// switch ::footnote-call to [data-footnote-call]::after
let prelude = rule.ruleNode.prelude;
let newPrelude = new csstree.List();
// Can't get remove to work, so just copying everything else
prelude.children.first().children.each((node) => {
if (node.type !== "PseudoElementSelector") {
newPrelude.appendData(node);
}
})