From aec0177c6f8ba623232efdb48e7fe7699c1dd5be Mon Sep 17 00:00:00 2001 From: Alexander Nutz Date: Sat, 26 Jul 2025 02:05:39 +0200 Subject: [PATCH] c --- common.typ | 13 ++++++------- core-page-style.typ | 8 ++++---- simple-page-layout.typ | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/common.typ b/common.typ index c55353d..94c9a29 100644 --- a/common.typ +++ b/common.typ @@ -183,9 +183,9 @@ else { fn(option) } } -#let stroke2css(stroke) = { +#let stroke2css(stroke, default:"none") = { if type(stroke) == dictionary { - return "none" + return default } let th = len2css(stroke.thickness, default: "1pt") return th + " solid black" // TODO: paint @@ -193,12 +193,11 @@ #let css-style(it) = { return " - display: inline-block; - border: "+stroke2css(it.stroke)+"; - border-radius: "+len2css(it.radius, default: "0px")+"; + " + option-map(stroke2css(it.stroke, default:none), "", x => "border:"+x+";") + " + " + option-map(len2css(it.radius, default:none), "", x => "border-radius:"+x+";") + " " + option-map(len2css(it.width, default:none), "", x => "width:"+x+";") +" " + option-map(len2css(it.height, default:none), "", x => "height:"+x+";") +" - padding: " + len2css(it.inset) + " + option-map(len2css(it.inset, default:none), "", x => "padding:"+x+";") } #let wimage(path, width:100%, alt:"image") = { @@ -249,7 +248,7 @@ // TODO: move to component #let table-of-contents() = { - html-style(class:"table-of-contents", "", box( + html-style(class:"table-of-contents", "", block( stroke: 1.2pt+black, radius: 2pt, inset: 3%, diff --git a/core-page-style.typ b/core-page-style.typ index dfe4cbd..d29bdae 100644 --- a/core-page-style.typ +++ b/core-page-style.typ @@ -36,10 +36,10 @@ } else { if it.block { html-style-div("margin-top:4pt;", - block( + box( stroke: black, radius: 2pt, - inset: if is-html() { 1.4pt } else { 5pt }, + inset: if is-html() { 1.6pt } else { 5pt }, outset: 0pt, it )) @@ -47,7 +47,7 @@ box( stroke: black, radius: 2pt, - inset: if is-html() { 1.4pt } else { 5pt }, + inset: if is-html() { 1.6pt } else { 5pt }, outset: 0pt, baseline: 3.1pt, it @@ -57,7 +57,7 @@ #show box: it => { context if is-html() { - html.elem("span", attrs: (style: css-style(it)))[#it.body] + html.elem("span", attrs: (style: css-style(it)+"display:inline-block"))[#it.body] } else { it } diff --git a/simple-page-layout.typ b/simple-page-layout.typ index 1c9dac3..df224d0 100644 --- a/simple-page-layout.typ +++ b/simple-page-layout.typ @@ -44,8 +44,8 @@ ]}], [#context if min-pdf-link and is-html() [ Renderings of this page: - - #variant-link("Minimal PDF (printable)", ".min.pdf") - - #variant-link("less bloated HTML", ".min.html") + - #variant-link("minimal PDF (printable)", ".min.pdf") + // TODO: fix and re-add - #variant-link("less bloated HTML", ".min.html") - #variant-link("minimal HTML", ".nano.html") ]],