diff --git a/css/modules/_footnotes.scss b/css/modules/_footnotes.scss index 8284658..f99b5bb 100644 --- a/css/modules/_footnotes.scss +++ b/css/modules/_footnotes.scss @@ -15,7 +15,7 @@ line-height: calc(var(--baseline)*0.9); padding-left: var(--indent); position: relative; - font-weight: 100; + // font-weight: 100; &::marker{ display: none; diff --git a/css/modules/_text.scss b/css/modules/_text.scss index 0fd8176..4ba9a06 100644 --- a/css/modules/_text.scss +++ b/css/modules/_text.scss @@ -37,9 +37,9 @@ ol[type="1"]{ left: calc(var(--indent)*-3); &::before{ content: attr(start); - font-family: var(--font-sans); + font-family: var(--font-sans-txt); // font-weight: 200; - font-size: 0.6rem; + font-size: 9px; color: #999; display: block; padding: 0px 2px; @@ -72,37 +72,43 @@ blockquote{ padding-left: var(--indent); margin-top: calc(var(--baseline)*1); margin-bottom: calc(var(--baseline)*1); + + font-family: var(--font-sans-txt); + font-size: 10px; + line-height: calc(var(--baseline)*0.9); + + .inline-note::after{ + font-family: var(--font); + line-height: 0; + font-size: var(--font-size)!important; + } - p{ - font-style: italic; - em{ - font-style: normal; - } - } + // p{ + // font-style: italic; + // em{ + // font-style: normal; + // } + // } - u{ - font-variant: small-caps; - text-decoration: none; - } + // u{ + // font-variant: small-caps; + // text-decoration: none; + // } } - -blockquote + ol + p{ text-indent: 0px; } +.these + ol + p, +blockquote + ol + p{ + text-indent: 0px; +} .these{ - &::before{ - content: "---" - } - &::after{ - content: "---"; - } - &::before, &::after{ - display: flex; - // width: 3ch; - justify-content: center; - } + // color: red; + + margin-bottom: var(--baseline); + padding-left: var(--indent); + border-left: 4px solid #efefef; } \ No newline at end of file diff --git a/css/modules/_titles-counters.scss b/css/modules/_titles-counters.scss deleted file mode 100644 index efd6adc..0000000 --- a/css/modules/_titles-counters.scss +++ /dev/null @@ -1,50 +0,0 @@ -#section__content{ - - counter-reset: h1; - - h1{ - counter-increment: h1 1; - counter-reset: h2; - } - - h1::before{ - content: counter(h1, upper-alpha); - - } - - h2{ - counter-increment: h2 1; - counter-reset: h3; - } - - h2::before{ - content: counter(h2, upper-roman); - } - - h3{ - counter-increment: h3 1; - counter-reset: h4; - } - - h3::before{ - content: counter(h3); - } - - h4{ - counter-increment: h4 1; - counter-reset: h5; - } - - h4::before{ - content: counter(h4, lower-alpha) ". "; - } - - h5{ - counter-increment: h5 1; - counter-reset: h6; - } - - h5::before{ - content: counter(h5, lower-alpha) counter(h5, lower-alpha) ". "; - } - } \ No newline at end of file diff --git a/css/modules/_titles.scss b/css/modules/_titles.scss index b26db1e..4248539 100644 --- a/css/modules/_titles.scss +++ b/css/modules/_titles.scss @@ -2,6 +2,18 @@ #section__content{ + h1, h2, h3 { + &::before{ + content: attr(data-counter); + } + } + + h4, h5, h6{ + &::before{ + content: attr(data-counter) ". "; + } + } + h1, h2, h3 { break-inside: avoid; break-after: avoid; diff --git a/css/modules/_var.scss b/css/modules/_var.scss index 3b7e71a..72c4d5c 100644 --- a/css/modules/_var.scss +++ b/css/modules/_var.scss @@ -2,6 +2,7 @@ --font: 'Edgar', sans-serif; --font-title: "Heliotrope 3 Caps", sans-serif; --font-sans: "Heliotrope 4", sans-serif; + --font-sans-txt: 'Akkurat Std'; --font-size: 12px; --baseline: 16px; diff --git a/css/style.css b/css/style.css index f500709..876f2e2 100644 --- a/css/style.css +++ b/css/style.css @@ -3,6 +3,7 @@ --font: "Edgar", sans-serif; --font-title: "Heliotrope 3 Caps", sans-serif; --font-sans: "Heliotrope 4", sans-serif; + --font-sans-txt: "Akkurat Std"; --font-size: 12px; --baseline: 16px; --indent: 26px; @@ -202,8 +203,8 @@ ol[type="1"] { } ol[type="1"]::before { content: attr(start); - font-family: var(--font-sans); - font-size: 0.6rem; + font-family: var(--font-sans-txt); + font-size: 9px; color: #999; display: block; padding: 0px 2px; @@ -227,72 +228,33 @@ blockquote { padding-left: var(--indent); margin-top: calc(var(--baseline) * 1); margin-bottom: calc(var(--baseline) * 1); + font-family: var(--font-sans-txt); + font-size: 10px; + line-height: calc(var(--baseline) * 0.9); } -blockquote p { - font-style: italic; -} -blockquote p em { - font-style: normal; -} -blockquote u { - font-variant: small-caps; - text-decoration: none; +blockquote .inline-note::after { + font-family: var(--font); + line-height: 0; + font-size: var(--font-size) !important; } +.these + ol + p, blockquote + ol + p { text-indent: 0px; } -.these::before { - content: "---"; -} -.these::after { - content: "---"; -} -.these::before, .these::after { - display: flex; - justify-content: center; +.these { + margin-bottom: var(--baseline); + padding-left: var(--indent); + border-left: 4px solid #efefef; } -#section__content { - counter-reset: h1; +#section__content h1::before, #section__content h2::before, #section__content h3::before { + content: attr(data-counter); } -#section__content h1 { - counter-increment: h1 1; - counter-reset: h2; +#section__content h4::before, #section__content h5::before, #section__content h6::before { + content: attr(data-counter) ". "; } -#section__content h1::before { - content: counter(h1, upper-alpha); -} -#section__content h2 { - counter-increment: h2 1; - counter-reset: h3; -} -#section__content h2::before { - content: counter(h2, upper-roman); -} -#section__content h3 { - counter-increment: h3 1; - counter-reset: h4; -} -#section__content h3::before { - content: counter(h3); -} -#section__content h4 { - counter-increment: h4 1; - counter-reset: h5; -} -#section__content h4::before { - content: counter(h4, lower-alpha) ". "; -} -#section__content h5 { - counter-increment: h5 1; - counter-reset: h6; -} -#section__content h5::before { - content: counter(h5, lower-alpha) counter(h5, lower-alpha) ". "; -} - #section__content h1, #section__content h2, #section__content h3 { -moz-column-break-inside: avoid; break-inside: avoid; @@ -404,7 +366,6 @@ blockquote + ol + p { line-height: calc(var(--baseline) * 0.9); padding-left: var(--indent); position: relative; - font-weight: 100; } .inline-note::marker { display: none; diff --git a/css/style.css.map b/css/style.css.map index fc0a9af..913ab00 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-counters.scss","modules/_titles.scss","modules/_footnotes.scss","modules/_list-of-abbr.scss"],"names":[],"mappings":"AAAA,gBAAgB;ACAhB;EACI,2BAAA;EACA,6CAAA;EACA,u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sCAAA;APiYF;;AO9XA;EACE,eAAA;EACA,cAAA;EACA,wCAAA;EACA,2BAAA;EACA,kBAAA;EACA,gBAAA;APiYF;AO/XE;EACE,aAAA;EACA,WAAA;APiYJ;;AO1XA;EACI,oCAAA;EACA,kBAAA;EAEA,SAAA;AP4XJ;;AOxXA;EACM,cAAA;AP2XN;;AQhaA;EACI,aAAA;EACA,UAAA;ARmaJ","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,2BAAA;EACA,6CAAA;EACA,uCAAA;EACA,8BAAA;EACA,iBAAA;EACA,gBAAA;EAEA,cAAA;ADCJ;;AETA;EACI,SAAA;EACA,UAAA;EACA,sBAAA;AFYJ;;AEVA;EACI,mBAAA;AFaJ;;AEVA;EACI,mCAAA,EAAA,wBAAA;EACA,kCAAA,EAAA,kBAAA;EAEA,kCAAA,EAAA,6CAAA;EACA,+BAAA,EAAA,mDAAA;EAEA,wBAAA;EACA,2BAAA;EACA,4BAAA;AFWJ;;AG7BA;EACI;IACI,iBAAA;IAEA,gBAAA;IACA,mBAAA;IACA,iBAAA;IACA,kBAAA;IACA,UAAA;IACA,WAAA;EH+BN;EG7BE;IACI,iBAAA;IACA,kBAAA;IACA;MACI,sBAAA;IH+BR;EACF;EGxBE;IACI,iBAAA;IACA,kBAAA;IACA;MACI,sBAAA;IH0BR;IGxBI;MACI,+BAAA;MACA,6BAAA;MACA,sBAAA;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;IHw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AA;EACA,wCAAA;EACA,2CAAA;ALyNR;;AKjNA;EACQ,aAAA;ALoNR;;AM1VA;EACI;IACE,aAAA;EN6VJ;AACF;AMzVE;EACA,sCAAA;AN2VF;;AMxVA;EACE,eAAA;EACA,cAAA;EACA,wCAAA;EACA,2BAAA;EACA,kBAAA;AN2VF;AMxVE;EACE,aAAA;EACA,WAAA;AN0VJ;;AMnVA;EACI,oCAAA;EACA,kBAAA;EAEA,SAAA;ANqVJ;;AMjVA;EACM,cAAA;ANoVN;;AOzXA;EACI,aAAA;EACA,UAAA;AP4XJ","file":"style.css"} \ No newline at end of file diff --git a/css/style.scss b/css/style.scss index d81f558..59fbe83 100644 --- a/css/style.scss +++ b/css/style.scss @@ -3,7 +3,6 @@ @import 'modules/init'; @import 'modules/layout'; @import 'modules/text'; -@import 'modules/titles-counters'; @import 'modules/titles'; @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 7aa95e6..c5d0eff 100644 --- a/csspageweaver/manifest.json +++ b/csspageweaver/manifest.json @@ -11,8 +11,7 @@ } }, "hook": [ - "/js/custom-handler-example-1.js", - "/js/custom-handler-example-2.js" + "/js/counters.js" ] } diff --git a/index.html b/index.html index fafa53c..bd82baf 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,7 @@ + diff --git a/js/counters.js b/js/counters.js new file mode 100644 index 0000000..967125e --- /dev/null +++ b/js/counters.js @@ -0,0 +1,94 @@ +import { Handler } from '/csspageweaver/lib/paged.esm.js'; + +export default class counters extends Handler { + constructor(chunker, polisher, caller) { + super(chunker, polisher, caller); + } + + // Convertir en upper-alpha (A, B, C...) + toUpperAlpha(num) { + return String.fromCharCode(64 + num); + } + + // Convertir en lower-alpha (a, b, c...) + toLowerAlpha(num) { + return String.fromCharCode(96 + num); + } + + // Convertir en upper-roman (I, II, III...) + toUpperRoman(num) { + const romanNumerals = [ + ['M', 1000], ['CM', 900], ['D', 500], ['CD', 400], + ['C', 100], ['XC', 90], ['L', 50], ['XL', 40], + ['X', 10], ['IX', 9], ['V', 5], ['IV', 4], ['I', 1] + ]; + let result = ''; + for (const [letter, value] of romanNumerals) { + while (num >= value) { + result += letter; + num -= value; + } + } + return result; + } + + beforeParsed(content) { + const sectionContent = content.querySelector('#section__content'); + if (!sectionContent) return; + + // Compteurs + let h1Count = 0; + let h2Count = 0; + let h3Count = 0; + let h4Count = 0; + let h5Count = 0; + let h6Count = 0; + + // Parcourir tous les éléments dans l'ordre du document + const allElements = sectionContent.querySelectorAll('h1, h2, h3, h4, h5, h6'); + + allElements.forEach(el => { + const tagName = el.tagName.toLowerCase(); + + switch (tagName) { + case 'h1': + h1Count++; + h2Count = 0; // reset h2 + el.setAttribute('data-counter', this.toUpperAlpha(h1Count)); + break; + + case 'h2': + h2Count++; + h3Count = 0; // reset h3 + el.setAttribute('data-counter', this.toUpperRoman(h2Count)); + break; + + case 'h3': + h3Count++; + h4Count = 0; // reset h4 + el.setAttribute('data-counter', h3Count.toString()); + break; + + case 'h4': + h4Count++; + h5Count = 0; // reset h5 + el.setAttribute('data-counter', this.toLowerAlpha(h4Count)); + break; + + case 'h5': + h5Count++; + h6Count = 0; // reset h6 + const letter = this.toLowerAlpha(h5Count); + el.setAttribute('data-counter', letter + letter); + break; + + case 'h6': + h6Count++; + el.setAttribute('data-counter', '(' + h6Count + ')'); + break; + } + }); + } +} + + diff --git a/js/custom-handler-example-1.js b/js/custom-handler-example-1.js deleted file mode 100644 index 2b01603..0000000 --- a/js/custom-handler-example-1.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Handler } from '/csspageweaver/lib/paged.esm.js'; - -export default class myCustomHandler1 extends Handler { - constructor(chunker, polisher, caller) { - super(chunker, polisher, caller); - } - - beforeParsed(content){ - // let h2 = content.querySelectorAll('h2'); - // h2.forEach( h2 => { - // h2.insertAdjacentHTML("afterbegin", '🍄'); - // }); - } - - afterParsed(parsed) { - console.info("%c [CSS Page Weaver] Example custom handler 1 with afterParsed hook (see js/custom-handler-example-1.js", 'color: green;'); - } - -} - - diff --git a/js/custom-handler-example-2.js b/js/custom-handler-example-2.js deleted file mode 100644 index 5111051..0000000 --- a/js/custom-handler-example-2.js +++ /dev/null @@ -1,16 +0,0 @@ -import { Handler } from '/csspageweaver/lib/paged.esm.js'; - - -export default class myCustomHandler2 extends Handler { - constructor(chunker, polisher, caller) { - super(chunker, polisher, caller); - } - - - afterPageLayout(pageElement, page, breakToken) { - if(pageElement.id == "page-1"){ - console.info("%c [CSS Page Weaver] Example custom handler 2 with afterPageLayout hook (see js/custom-handler-example-2.js", 'color: green;') - } - } -} - diff --git a/lua/add-style-as-class.lua b/lua/add-style-as-class.lua deleted file mode 100644 index c277278..0000000 --- a/lua/add-style-as-class.lua +++ /dev/null @@ -1,11 +0,0 @@ -function Span(el) - local cs = el.attributes['custom-style'] - if cs then - local class = cs - :lower() - :gsub("%s+", "-") - :gsub("[^a-z0-9%-]", "") - el.classes:insert("style-" .. class) - end - return el -end diff --git a/lua/blockquote.lua b/lua/blockquote.lua deleted file mode 100644 index ce8c43a..0000000 --- a/lua/blockquote.lua +++ /dev/null @@ -1,6 +0,0 @@ -function Para(el) - if el.style then - io.stderr:write("STYLE: " .. el.style .. "\n") - end - return el -end \ No newline at end of file