From db9468de74f5a2796c33b03396e6bda489f01094 Mon Sep 17 00:00:00 2001
From: Julie Blanc
Date: Mon, 9 Mar 2026 23:11:46 +0100
Subject: [PATCH] following notes
---
css/modules/_followingNotes.scss | 26 +++
css/modules/_text.scss | 3 +
css/style.css | 83 +++----
css/style.css.map | 2 +-
css/style.scss | 5 +-
csspageweaver/manifest.json | 16 +-
.../plugins/followingNotes/.gitignore | 1 +
.../plugins/followingNotes/config.json | 8 +
.../plugins/followingNotes/followingNotes.js | 220 ++++++++++++++++++
csspageweaver/plugins/inlineNotes/README.md | 4 +-
10 files changed, 312 insertions(+), 56 deletions(-)
create mode 100644 css/modules/_followingNotes.scss
create mode 100644 csspageweaver/plugins/followingNotes/.gitignore
create mode 100644 csspageweaver/plugins/followingNotes/config.json
create mode 100644 csspageweaver/plugins/followingNotes/followingNotes.js
diff --git a/css/modules/_followingNotes.scss b/css/modules/_followingNotes.scss
new file mode 100644
index 0000000..84362bd
--- /dev/null
+++ b/css/modules/_followingNotes.scss
@@ -0,0 +1,26 @@
+.container-following-note{
+ font-size: var(--fs-small);
+ line-height: calc(var(--baseline)*0.8);
+ // padding-left: var(--indent);
+ position: relative;
+
+ columns: 2;
+}
+
+.body_note{
+ padding-left: calc(var(--indent)*3);
+ position: relative;
+}
+
+.following-note_marker{
+ position: absolute;
+ left: calc(var(--indent)*2);
+}
+
+.following-note_call{
+ font-size: var(--fs-small);
+ line-height: 1;
+ position: relative;
+ top: -4px;
+}
+
diff --git a/css/modules/_text.scss b/css/modules/_text.scss
index 0695543..e1501ac 100644
--- a/css/modules/_text.scss
+++ b/css/modules/_text.scss
@@ -2,6 +2,9 @@ sup{
line-height: 0;
}
+.smallcaps{
+ font-variant: small-caps;
+}
hr{
border: none;
height: var(--baseline);
diff --git a/css/style.css b/css/style.css
index 78bb725..85fe687 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1,9 +1,9 @@
@charset "UTF-8";
:root {
- --font: "Akkurat Std", sans-serif;
- --font-serif: "Edgar", sans-serif;
- --font-title: "Allium Rounded", sans-serif;
- --font-sans: "Allium Rounded", sans-serif;
+ --font: 'Akkurat Std', sans-serif;
+ --font-serif: 'Edgar', sans-serif;
+ --font-title: 'Allium Rounded', sans-serif;
+ --font-sans: 'Allium Rounded', sans-serif;
--font-size: 11px;
--fs-small: 8.5px;
--fs-num: 14px;
@@ -183,6 +183,10 @@ sup {
line-height: 0;
}
+.smallcaps {
+ font-variant: small-caps;
+}
+
hr {
border: none;
height: var(--baseline);
@@ -200,8 +204,7 @@ p {
}
p, li {
- -webkit-hyphens: auto;
- hyphens: auto;
+ hyphens: auto;
hyphenate-limit-chars: 7 3 4;
hyphenate-limit-lines: 2;
hyphenate-limit-zone: 8%;
@@ -394,50 +397,32 @@ section h1:first-of-type {
margin-top: 3px !important;
}
-@page {
- @footnote {
- float: bottom;
- footnote-policy: auto;
- }
-}
-.pagedjs_footnote_content {
- padding-top: calc(var(--baseline) * 1);
-}
-
-.inline-note {
- float: footnote;
- footnote-policy: auto;
- font-size: var(--fs-small);
- line-height: calc(var(--baseline) * 0.8);
- padding-left: var(--indent);
- position: relative;
- font-weight: 600;
-}
-.inline-note::marker {
- display: none;
- content: "";
-}
-
-[data-counter-note]::before {
- content: attr(data-counter-note) ".";
- position: absolute;
- left: 0px;
-}
-
-.inline-note::after {
- font-family: var(--font);
- font-size: var(--fs-small);
- line-height: 0;
- position: relative;
- top: -3px;
- font-variant-position: normal !important;
-}
-
-blockquote .inline-note {
- font-variant-position: normal !important;
-}
-
#section__list-of-abbr {
display: none;
color: red;
+}
+
+.container-following-note {
+ font-size: var(--fs-small);
+ line-height: calc(var(--baseline) * 0.8);
+ position: relative;
+ -moz-columns: 2;
+ columns: 2;
+}
+
+.body_note {
+ padding-left: calc(var(--indent) * 3);
+ position: relative;
+}
+
+.following-note_marker {
+ position: absolute;
+ left: calc(var(--indent) * 2);
+}
+
+.following-note_call {
+ font-size: var(--fs-small);
+ line-height: 1;
+ position: relative;
+ top: -4px;
}/*# sourceMappingURL=style.css.map */
\ No newline at end of file
diff --git a/css/style.css.map b/css/style.css.map
index 1cd0617..30ad544 100644
--- a/css/style.css.map
+++ b/css/style.css.map
@@ -1 +1 @@
-{"version":3,"sources":["style.css","modules/_var.scss","modules/_init.scss","modules/_layout.scss","modules/_text.scss","modules/_titles.scss","modules/_footnotes.scss","modules/_list-of-abbr.scss"],"names":[],"mappings":"AAAA,gBAAgB;ACAhB;EACI,iCAAA;EACA,iCAAA;EACA,0CAAA;EACA,yCAAA;EACA,iBAAA;EACA,iBAAA;EACA,cAAA;EACA,gBAAA;EAEA,cAAA;ADCJ;;AEXA;EACI,SAAA;EACA,UAAA;EACA,sBAAA;AFcJ;;AEZA;EACI,mBAAA;AFeJ;;AEZA;EACI,mCAAA,EAAA,wBAAA;EACA,kCAAA,EAAA,kBAAA;EAEA,kCAAA,EAAA,6CAAA;EACA,+BAAA,EAAA,mDAAA;EAEA,wBAAA;EACA,2BAAA;EACA,4BAAA;AFaJ;;AG/BA;EACI;IACI,iBAAA;IAEA,gBAAA;IACA,mBAAA;IAEA,UAAA;IACA,WAAA;EHgCN;EG9BE;IACI,iBAAA;IACA,kBAAA;IACA;MACI,sBAAA;MACA,8BAAA;MACA,gBAAA;MACA,wBAAA;IHgCR;EACF;EGzBE;IACI,iBAAA;IACA,kBAAA;IACA;MACI,sBAAA;MACA,8BAAA;MACA,gBAAA;MACC,wBAAA;IH2BT;IGzBI;MACI,+BAAA;MACA,8BAAA;MACA,mBAAA;MAEA,0BAAA;MACA,iCAAA;MACA,oBAAA;MACA,WAAA;MACA,wBAAA;MACA,gBAAA;MACA,kBAAA;MACA,UAAA;MACA,iBAAA;IH0BR;EACF;EGvBE;IACI;MAAmB,aAAA;IH0BvB;IGzBI;MAAY,aAAA;IH4BhB;IG3BI;MAAc,aAAA;IH8BlB;IG7BI;MAAa,aAAA;IHgCjB;IG/BI;MAAoB,aAAA;IHkCxB;IGjCI;MAAY,aAAA;IHoChB;IGnCI;MAAe,aAAA;I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ACA,iBAAA;EACA,sCAAA;EACA,qCAAA;EAEA,kBAAA;EACA,2CAAA;EACA,4CAAA;AL0NR;AKvNI;EACO,8BAAA;EACH,gBAAA;EACK,iBAAA;EACJ,uCAAA;EACA,4CAAA;EACA,WAAA;ALyNT;;AKjNA;EACQ,aAAA;ALoNR;;AKjNG;EACK,8BAAA;EACA,iBAAA;EACA,gBAAA;EACA,yBAAA;EACA,wCAAA;EAEA,kBAAA;EACA,2CAAA;EACA,yCAAA;EACA,qCAAA;EACA,kBAAA;ALmNR;AKhNQ;EASK,kBAAA;EACA,OAAA;EACA,sCAAA;AL0Mb;;AKpMI;EACI,0BAAA;ALuMR;;AMjYA;EACI;IACE,aAAA;IACA,qBAAA;ENoYJ;AACF;AMjYE;EACI,sCAAA;ANmYN;;AMhYA;EACE,eAAA;EACA,qBAAA;EACA,0BAAA;EACA,wCAAA;EACA,2BAAA;EACA,kBAAA;EACA,gBAAA;ANmYF;AMjYE;EACE,aAAA;EACA,WAAA;ANmYJ;;AM5XA;EACI,oCAAA;EACA,kBAAA;EACA,SAAA;AN+XJ;;AM3XA;EACE,wBAAA;EACA,0BAAA;EACA,cAAA;EACA,kBAAA;EACA,SAAA;EACA,wCAAA;AN8XF;;AM1XA;EACI,wCAAA;AN6XJ;;AO5aA;EACI,aAAA;EACA,UAAA;AP+aJ","file":"style.css"}
\ No newline at end of file
+{"version":3,"sources":["style.css","modules/_var.scss","modules/_init.scss","modules/_layout.scss","modules/_text.scss","modules/_titles.scss","modules/_list-of-abbr.scss","modules/_followingNotes.scss"],"names":[],"mappings":"AAAA,gBAAgB;ACAhB;EACI,iCAAA;EACA,iCAAA;EACA,0CAAA;EACA,yCAAA;EACA,iBAAA;EACA,iBAAA;EACA,cAAA;EACA,gBAAA;EAEA,cAAA;ADCJ;;AEXA;EACI,SAAA;EACA,UAAA;EACA,sBAAA;AFcJ;;AEZA;EACI,mBAAA;AFeJ;;AEZA;EACI,mCAAA,EAAA,wBAAA;EACA,kCAAA,EAA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;EAEA,eAAA;OAAA,UAAA;AP2YJ;;AOxYA;EACI,qCAAA;EACA,kBAAA;AP2YJ;;AOxYA;EACI,kBAAA;EACA,6BAAA;AP2YJ;;AOxYA;EACI,0BAAA;EACA,cAAA;EACA,kBAAA;EACA,SAAA;AP2YJ","file":"style.css"}
\ No newline at end of file
diff --git a/css/style.scss b/css/style.scss
index 59fbe83..e90d3a3 100644
--- a/css/style.scss
+++ b/css/style.scss
@@ -4,5 +4,6 @@
@import 'modules/layout';
@import 'modules/text';
@import 'modules/titles';
-@import 'modules/footnotes';
-@import 'modules/list-of-abbr';
\ No newline at end of file
+// @import 'modules/footnotes';
+@import 'modules/list-of-abbr';
+@import 'modules/followingNotes';
\ No newline at end of file
diff --git a/csspageweaver/manifest.json b/csspageweaver/manifest.json
index 5bd177d..dd86589 100644
--- a/csspageweaver/manifest.json
+++ b/csspageweaver/manifest.json
@@ -1,5 +1,12 @@
{
- "plugins": ["baseline","grid","marginBox","imposition","spread","previewPage","reloadInPlace","inlineNotes"],
+ "plugins": [
+ "baseline",
+ "grid",
+ "marginBox",
+ "imposition","spread","previewPage","reloadInPlace",
+ "inlineNotes",
+ "followingNotes"
+ ],
"pluginsParameters":{},
"css": [
"css/style.css"
@@ -7,7 +14,12 @@
"pluginsParameters": {
"inlineNotes": {
"input": ".footnote-ref",
- "containerNotes": ".footnotes"
+ "containerNotes": "#footnotes",
+ "newClass": "inline-note"
+ },
+ "followingNotes": {
+ "selector": ".inline-note",
+ "reset": ".chapter"
}
},
"hook": [
diff --git a/csspageweaver/plugins/followingNotes/.gitignore b/csspageweaver/plugins/followingNotes/.gitignore
new file mode 100644
index 0000000..496ee2c
--- /dev/null
+++ b/csspageweaver/plugins/followingNotes/.gitignore
@@ -0,0 +1 @@
+.DS_Store
\ No newline at end of file
diff --git a/csspageweaver/plugins/followingNotes/config.json b/csspageweaver/plugins/followingNotes/config.json
new file mode 100644
index 0000000..bc66d35
--- /dev/null
+++ b/csspageweaver/plugins/followingNotes/config.json
@@ -0,0 +1,8 @@
+{
+ "name": "FollowingNotes",
+ "description": "Create followingNotes with call & markers",
+ "author": ["Julie Blanc"],
+ "licence": "MIT",
+ "version": "1.0",
+ "hook": "followingNotes.js"
+}
diff --git a/csspageweaver/plugins/followingNotes/followingNotes.js b/csspageweaver/plugins/followingNotes/followingNotes.js
new file mode 100644
index 0000000..15b4c17
--- /dev/null
+++ b/csspageweaver/plugins/followingNotes/followingNotes.js
@@ -0,0 +1,220 @@
+/**
+ * @name FollowingNotes
+ * @author Julie Blanc
+ * @see { @link https://gitlab.com/csspageweaver/plugins/followingNotes/ }
+ */
+
+import { Handler } from '/csspageweaver/lib/paged.esm.js';
+
+export default class followingNotes extends Handler {
+
+ constructor(chunker, polisher, caller) {
+ super(chunker, polisher, caller);
+ this.parameters = cssPageWeaver.features.followingNotes.parameters;
+ this.notesClass = this.parameters?.selector || ".inline-note";
+ this.newNotesClass = this.parameters?.newNotesClass || "following-note";
+ this.reset = this.parameters?.reset;
+ this.align = this.parameters?.align;
+ this.followingNoteOverflow = new Set();
+ }
+
+ beforeParsed(content) {
+
+ console.log("floatnotes");
+
+ let newNotesClass = this.newNotesClass;
+ resetCounter(content, this.reset, this.notesClass);
+ createCallandMarker(content, this.notesClass, newNotesClass);
+
+
+ let notes = content.querySelectorAll(this.notesClass);
+ notes.forEach(function (note) {
+ let paragraph = note.closest("p");
+ if (!paragraph) return;
+
+ let container = paragraph.nextElementSibling;
+ if (!container || !container.classList.contains("container-following-note")) {
+ container = document.createElement("div");
+ container.classList.add("container-following-note");
+ paragraph.after(container);
+ }
+
+ container.appendChild(note);
+ });
+
+
+ }
+
+
+
+}
+
+
+
+
+/// FUNCTIONS -----------------------------------------------------
+
+
+// RESET COUNTER
+
+function resetCounter(content, reset, notesClass){
+
+ if(reset && reset != ""){
+ const elements = content.querySelectorAll(reset + ", " + notesClass);
+ let resetEligible = false;
+ elements.forEach(element => {
+ if (element.matches(reset)) {
+ resetEligible = true;
+ } else if (resetEligible && element.matches(notesClass)) {
+ element.dataset.resetCounterFollowingNote = true;
+ resetEligible = false;
+ }
+ });
+ }
+
+}
+
+
+// CALL & MARKER
+function createCallandMarker(content, notesClass, newNotesClass){
+
+ let notes = content.querySelectorAll(notesClass);
+ let resetNum = 0;
+
+ notes.forEach(function (note, index) {
+
+ if (note.dataset.resetCounterFollowingNote === "true") {
+ resetNum = index;
+ }
+ let num = index + 1 - resetNum;
+
+ note.classList.add(newNotesClass);
+ note.dataset.counterNote = num;
+
+ // call
+ let ref_note = document.createElement('span');
+ ref_note.className = newNotesClass + "_call";
+ ref_note.dataset.counterNote = num;
+ ref_note.innerHTML = num;
+
+ // wrap preceding word + call in .wrapper__note-call
+ let wrapper = document.createElement('span');
+ wrapper.className = 'wrapper__note-call';
+
+ let prevSibling = note.previousSibling;
+ if (prevSibling && prevSibling.nodeType === Node.TEXT_NODE) {
+ let text = prevSibling.textContent;
+ let m = text.match(/^([\s\S]*\s)(\S+\s*)$/);
+ if (m) {
+ let before = m[1];
+ let extracted = m[2];
+
+ // Si le dernier mot extrait est uniquement », prendre aussi le mot d'avant
+ if (/^»\s*$/.test(extracted)) {
+ let m2 = before.trimEnd().match(/^([\s\S]*\s|)(\S+)$/);
+ if (m2) {
+ let spaceBetween = before.slice(m2[1].length + m2[2].length);
+ before = m2[1];
+ extracted = m2[2] + spaceBetween + extracted;
+ }
+ }
+
+ prevSibling.textContent = before;
+ wrapper.appendChild(document.createTextNode(extracted));
+ } else {
+ prevSibling.textContent = '';
+ wrapper.appendChild(document.createTextNode(text));
+ }
+ }
+
+ wrapper.appendChild(ref_note);
+ note.after(wrapper);
+
+ // marker + content note wrapped in body_note
+ let marker_note = document.createElement('span');
+ marker_note.className = newNotesClass + "_marker";
+ //marker_note.innerHTML = num + ". ";
+ marker_note.innerHTML = num;
+
+ let body_note = document.createElement('div');
+ body_note.className = 'body_note';
+ while (note.firstChild) {
+ body_note.appendChild(note.firstChild);
+ }
+ body_note.prepend(marker_note);
+ note.appendChild(body_note);
+
+ });
+
+ }
+
+
+
+
+// MARGINS
+
+function marginNoteTop(elem) {
+ let marginTop = parseInt(window.getComputedStyle(elem).marginTop, 10)
+ return marginTop;
+}
+
+function marginNoteBottom(elem) {
+ let marginBottom = parseInt(window.getComputedStyle(elem).marginBottom, 10)
+ return marginBottom;
+}
+
+function biggestMargin(a, b) {
+ let margin;
+ let marginBottom = marginNoteBottom(a);
+ let marginTop = marginNoteTop(b);
+ if (marginBottom > marginTop) {
+ margin = marginBottom;
+ } else {
+ margin = marginTop;
+ }
+ return margin;
+}
+
+
+
+function checkOverflownote(notesClass, pageElement, maxHeight, arrayOverflow, container) {
+ let notes = pageElement.querySelectorAll(notesClass);
+
+ let notesHeightAll = [];
+
+ for (let n = 0; n < notes.length; ++n) {
+
+ // Add height of the notes to array notesHeightAll
+ let noteHeight = notes[n].offsetHeight;
+ notesHeightAll.push(noteHeight);
+ // Add margins of the notes to array notesHeightAll
+ if (n >= 1) {
+ let margins = biggestMargin(notes[n - 1], notes[n]);
+ notesHeightAll.push(margins);
+ }
+ }
+
+ // If notes on page
+ if (notesHeightAll.length > 0) {
+
+ // Calculate if all notes fit on the page;
+ let reducer = (accumulator, currentValue) => accumulator + currentValue;
+ let allHeight = notesHeightAll.reduce(reducer);
+ let paddingTop = getComputedStyle(container).paddingTop;
+ let paddingContainer = parseInt(paddingTop);
+
+ let totalHeight = allHeight + paddingContainer;
+
+ if (totalHeight > maxHeight) {
+
+ let lastNote = notes[notes.length - 1];
+ arrayOverflow.add(lastNote);
+ lastNote.remove();
+
+ checkOverflownote(notesClass, pageElement, maxHeight, arrayOverflow, container);
+
+ }
+
+
+ }
+}
diff --git a/csspageweaver/plugins/inlineNotes/README.md b/csspageweaver/plugins/inlineNotes/README.md
index 72c4526..8f2fca1 100644
--- a/csspageweaver/plugins/inlineNotes/README.md
+++ b/csspageweaver/plugins/inlineNotes/README.md
@@ -35,7 +35,7 @@ In `manifest.json`, you can modify/add some parameters:
// parameters of other plugins ...
"inlineNotes": {
"input": ".footnote-ref",
- "containerNotes": ".footnotes"
+ "containerNotes": "#footnotes"
}
},
```
@@ -54,7 +54,7 @@ Before :
Among his many contributions to printing are: the invention of
a process for mass-producing movable type; the use of oil-based
ink for printing books; adjustable molds; mechanical movable type; and the use of a wooden printing press similar to the agricultural screw presses of the period.
-