Skip to content

Commit

Permalink
Merge pull request #127 from qmd-lab/dev
Browse files Browse the repository at this point in the history
v1.0.1: sidebar-right fix, section fix, CR Prize announcement
  • Loading branch information
jimjam-slam authored Nov 11, 2024
2 parents 2555912 + f2ef21a commit c4da387
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ package-lock.json
# temporarily ignoring the _extensions folder within demos/ and tests/ until we organise them into a website
demos/*/_extensions
tests/*/_extensions

# .css.map (can be generated manually from .scss file)
_extensions/closeread/closeread.css.map
2 changes: 1 addition & 1 deletion _extensions/closeread/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
title: closeread
author: Andrew Bray and James Goldie
version: 1.0.0
version: 1.0.1
quarto-required: ">=1.3.0"
contributes:
formats:
Expand Down
2 changes: 1 addition & 1 deletion _extensions/closeread/closeread.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion _extensions/closeread/closeread.css.map

This file was deleted.

21 changes: 17 additions & 4 deletions _extensions/closeread/closeread.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,22 @@ document.addEventListener("DOMContentLoaded", () => {
document.body.classList.add("cr-removeheaderspace")
}

// attach layout classes to direct parents of `.cr-section`s
// attach layout classes to parents of `.cr-section`s up to main.content
/* this replicates quarto <= 1.6 functionality:
https://github.com/quarto-dev/quarto-cli/blob/
d85467627aae71c96e3d1e9718a3b47289329cde/src/format/html/
format-html-bootstrap.ts#L1163C1-L1186C7 */
format-html-bootstrap.ts#L1163C1-L1186C7 */
const ensureInGrid = el => {
const parent = el.parentElement
parent.classList.add("page-columns", "page-full")
if (isDocumentMain(parent)) {
return
} else {
ensureInGrid(parent)
}
}
const crSections = Array.from(document.querySelectorAll(".cr-section"))
crSections.map(
el => el.parentElement.classList.add("page-columns", "page-full"))
crSections.map(ensureInGrid)

const ojsModule = window._ojs?.ojsConnector?.mainModule
const ojsStickyName = ojsModule?.variable()
Expand Down Expand Up @@ -409,3 +417,8 @@ function getBooleanConfig(metaFlag) {
.querySelector("meta[" + metaFlag + "]")?.getAttribute(metaFlag)
return option === "true"
}

function isDocumentMain(el) {
return el === null ||
(el.tagName == "MAIN" && el.classList.contains("content"))
}
2 changes: 1 addition & 1 deletion _extensions/closeread/closeread.scss
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
}
}
.sidebar-right {
grid-template-columns: 2fr var(cr-narrative-sidebar-width);
grid-template-columns: 2fr var(--cr-narrative-sidebar-width);

.narrative-col {
grid-column: 2;
Expand Down
6 changes: 6 additions & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ project:

website:
title: "Closeread"
announcement:
icon: award
dismissable: false
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)\"}"
type: warning
position: below-navbar
page-navigation: true
navbar:
left:
Expand Down

0 comments on commit c4da387

Please sign in to comment.