diff --git a/css/modules/_followingNotes.scss b/css/modules/_followingNotes.scss deleted file mode 100644 index add30be..0000000 --- a/css/modules/_followingNotes.scss +++ /dev/null @@ -1,27 +0,0 @@ -.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)*1); - position: relative; -} - -.following-note_marker{ - position: absolute; - // left: calc(var(--indent)*2); - left: 0; -} - -.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 e1501ac..0695543 100644 --- a/css/modules/_text.scss +++ b/css/modules/_text.scss @@ -2,9 +2,6 @@ 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 4761304..78bb725 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,10 +183,6 @@ sup { line-height: 0; } -.smallcaps { - font-variant: small-caps; -} - hr { border: none; height: var(--baseline); @@ -204,7 +200,8 @@ p { } p, li { - hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; hyphenate-limit-chars: 7 3 4; hyphenate-limit-lines: 2; hyphenate-limit-zone: 8%; @@ -397,32 +394,50 @@ 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) * 1); - position: relative; -} - -.following-note_marker { - position: absolute; - left: 0; -} - -.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 233d3d8..1cd0617 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/_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,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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,gBAAA;EACA,yBAAA;EACA,wCAAA;EACA,kBAAA;EACA,2CAAA;EACA,yCAAA;EACA,kBAAA;EACA,qCAAA;ALiPR;AKhPQ;EACI,kBAAA;EACA,OAAA;ALkPZ;AKzOI;EACI,8BAAA;EACA,gBAAA;EACA,eAAA;EACA,sCAAA;EAGA,sCAAA;EACA,kBAAA;EACA,2CAAA;EACA,4CAAA;EACQ,qCAAA;ALyOhB;AKxOQ;EAEI,kBAAA;EACA,OAAA;ALyOZ;AKrOI;EACI,8BAAA;EACA,gBAAA;EACA,iBAAA;EACA,sCAAA;EACA,sCAAA;EACA,kBAAA;EACA,2CAAA;EACA,4CAAA;EACA,8CAAA;UAAA,sCAAA;EACA,0BAAA;EAEI,qCAAA;ALsOZ;AK7NK;EACG,8BAAA;EACA,gBAAA;EACA,iBAAA;EACA,sCAAA;EACA,qCAAA;EAEA,kBAAA;EACA,2CAAA;EACA,4CAAA;AL8NR;AK3NI;EACO,8BAAA;EACH,gBAAA;EACK,iBAAA;EACJ,uCAAA;EACA,4CAAA;EACA,WAAA;AL6NT;;AKrNA;EACQ,aAAA;ALwNR;;AKrNG;EACK,8BAAA;EACA,iBAAA;EACA,gBAAA;EACA,yBAAA;EACA,wCAAA;EAEA,kBAAA;EACA,2CAAA;EACA,yCAAA;EACA,qCAAA;EACA,kBAAA;ALuNR;AKpNQ;EASK,kBAAA;EACA,OAAA;EACA,sCAAA;AL8Mb;;AKxMI;EACI,0BAAA;AL2MR;;AMrYA;EACI,aAAA;EACA,UAAA;ANwYJ;;AO1YA;EACI,0BAAA;EACA,wCAAA;EAEA,kBAAA;EAEA,eAAA;OAAA,UAAA;AP2YJ;;AOxYA;EACI,qCAAA;EACA,kBAAA;AP2YJ;;AOxYA;EACI,kBAAA;EAEA,OAAA;AP0YJ;;AOvYA;EACI,0BAAA;EACA,cAAA;EACA,kBAAA;EACA,SAAA;AP0YJ","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/_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;IHsCnB;IGrCI;MAAe,aAAA;IHwCnB;IGvCI;MAAa,aAAA;IH0CjB;IGzCI;MAAgB,aAAA;IH4CpB;IG3CI;MAAgB,aAAA;IH8CpB;IG7CI;MAAsB,aAAA;IHgD1B;IG/CI;MAAe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yNT;;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 diff --git a/css/style.scss b/css/style.scss index e90d3a3..59fbe83 100644 --- a/css/style.scss +++ b/css/style.scss @@ -4,6 +4,5 @@ @import 'modules/layout'; @import 'modules/text'; @import 'modules/titles'; -// @import 'modules/footnotes'; -@import 'modules/list-of-abbr'; -@import 'modules/followingNotes'; \ No newline at end of file +@import 'modules/footnotes'; +@import 'modules/list-of-abbr'; \ No newline at end of file diff --git a/csspageweaver/manifest.json b/csspageweaver/manifest.json index dd86589..5bd177d 100644 --- a/csspageweaver/manifest.json +++ b/csspageweaver/manifest.json @@ -1,12 +1,5 @@ { - "plugins": [ - "baseline", - "grid", - "marginBox", - "imposition","spread","previewPage","reloadInPlace", - "inlineNotes", - "followingNotes" - ], + "plugins": ["baseline","grid","marginBox","imposition","spread","previewPage","reloadInPlace","inlineNotes"], "pluginsParameters":{}, "css": [ "css/style.css" @@ -14,12 +7,7 @@ "pluginsParameters": { "inlineNotes": { "input": ".footnote-ref", - "containerNotes": "#footnotes", - "newClass": "inline-note" - }, - "followingNotes": { - "selector": ".inline-note", - "reset": ".chapter" + "containerNotes": ".footnotes" } }, "hook": [ diff --git a/csspageweaver/plugins/followingNotes/.gitignore b/csspageweaver/plugins/followingNotes/.gitignore deleted file mode 100644 index 496ee2c..0000000 --- a/csspageweaver/plugins/followingNotes/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.DS_Store \ No newline at end of file diff --git a/csspageweaver/plugins/followingNotes/config.json b/csspageweaver/plugins/followingNotes/config.json deleted file mode 100644 index bc66d35..0000000 --- a/csspageweaver/plugins/followingNotes/config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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 deleted file mode 100644 index 15b4c17..0000000 --- a/csspageweaver/plugins/followingNotes/followingNotes.js +++ /dev/null @@ -1,220 +0,0 @@ -/** - * @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 8f2fca1..72c4526 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; 1 adjustable molds; mechanical movable type; and the use of a wooden printing press similar to the agricultural screw presses of the period.

-