Skip to content

Commit c4da387

Browse files
authored
Merge pull request #127 from qmd-lab/dev
v1.0.1: sidebar-right fix, section fix, CR Prize announcement
2 parents 2555912 + f2ef21a commit c4da387

File tree

7 files changed

+29
-8
lines changed

7 files changed

+29
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ package-lock.json
2525
# temporarily ignoring the _extensions folder within demos/ and tests/ until we organise them into a website
2626
demos/*/_extensions
2727
tests/*/_extensions
28+
29+
# .css.map (can be generated manually from .scss file)
30+
_extensions/closeread/closeread.css.map

_extensions/closeread/_extension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: closeread
22
author: Andrew Bray and James Goldie
3-
version: 1.0.0
3+
version: 1.0.1
44
quarto-required: ">=1.3.0"
55
contributes:
66
formats:

_extensions/closeread/closeread.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_extensions/closeread/closeread.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

_extensions/closeread/closeread.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,22 @@ document.addEventListener("DOMContentLoaded", () => {
2828
document.body.classList.add("cr-removeheaderspace")
2929
}
3030

31-
// attach layout classes to direct parents of `.cr-section`s
31+
// attach layout classes to parents of `.cr-section`s up to main.content
3232
/* this replicates quarto <= 1.6 functionality:
3333
https://github.com/quarto-dev/quarto-cli/blob/
3434
d85467627aae71c96e3d1e9718a3b47289329cde/src/format/html/
35-
format-html-bootstrap.ts#L1163C1-L1186C7 */
35+
format-html-bootstrap.ts#L1163C1-L1186C7 */
36+
const ensureInGrid = el => {
37+
const parent = el.parentElement
38+
parent.classList.add("page-columns", "page-full")
39+
if (isDocumentMain(parent)) {
40+
return
41+
} else {
42+
ensureInGrid(parent)
43+
}
44+
}
3645
const crSections = Array.from(document.querySelectorAll(".cr-section"))
37-
crSections.map(
38-
el => el.parentElement.classList.add("page-columns", "page-full"))
46+
crSections.map(ensureInGrid)
3947

4048
const ojsModule = window._ojs?.ojsConnector?.mainModule
4149
const ojsStickyName = ojsModule?.variable()
@@ -409,3 +417,8 @@ function getBooleanConfig(metaFlag) {
409417
.querySelector("meta[" + metaFlag + "]")?.getAttribute(metaFlag)
410418
return option === "true"
411419
}
420+
421+
function isDocumentMain(el) {
422+
return el === null ||
423+
(el.tagName == "MAIN" && el.classList.contains("content"))
424+
}

_extensions/closeread/closeread.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
}
242242
}
243243
.sidebar-right {
244-
grid-template-columns: 2fr var(cr-narrative-sidebar-width);
244+
grid-template-columns: 2fr var(--cr-narrative-sidebar-width);
245245

246246
.narrative-col {
247247
grid-column: 2;

docs/_quarto.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ project:
55

66
website:
77
title: "Closeread"
8+
announcement:
9+
icon: award
10+
dismissable: false
11+
content: "**[The Closeread Prize](https://posit.co/blog/closeread-prize-announcement/){style=\"color: var(--bs-warning-text-emphasis)\"}:** prizes for the best scrollytelling! Entries close Dec 15. [**Learn more and enter!**](https://posit.co/blog/closeread-prize-announcement/){style=\"color: var(--bs-warning-text-emphasis)\"}"
12+
type: warning
13+
position: below-navbar
814
page-navigation: true
915
navbar:
1016
left:

0 commit comments

Comments
 (0)