Skip to content

Commit

Permalink
Merge pull request #64 from qmd-lab/revise-minard
Browse files Browse the repository at this point in the history
Revise minard
  • Loading branch information
andrewpbray authored Aug 5, 2024
2 parents fe21d01 + 067cd94 commit 913c808
Show file tree
Hide file tree
Showing 31 changed files with 1,541 additions and 66 deletions.
5 changes: 5 additions & 0 deletions _extensions/closeread/closeread.css

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

2 changes: 1 addition & 1 deletion _extensions/closeread/closeread.css.map

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

4 changes: 2 additions & 2 deletions _extensions/closeread/closeread.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ document.addEventListener("DOMContentLoaded", () => {

// attach meta classes to <body>
document.body.classList.add("closeread")
const debugMode = getBooleanConfig("debug-mode")
const removeHeaderSpace = getBooleanConfig("remove-header-space")
const debugMode = getBooleanConfig("cr-debug-mode")
const removeHeaderSpace = getBooleanConfig("cr-remove-header-space")
if (debugMode) {
document.body.classList.add("cr-debug")
}
Expand Down
23 changes: 16 additions & 7 deletions _extensions/closeread/closeread.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,15 @@ function make_section_layout(div)
local new_trigger_block = wrap_block(block, {"trigger", "new-trigger"})
table.insert(narrative_blocks, new_trigger_block)
else
local new_narrative_block = pandoc.Div(block, pandoc.Attr("", {"narrative"}, {}))
local not_new_trigger_block = wrap_block(new_narrative_block, {"trigger"})
-- if the block can hold attributes, make it a narrative block
if block.attr ~= nil then
table.insert(block.attr.classes, "narrative")
else
-- if it can't (like a Para), wrap it in a Div that can
block = wrap_block(block, {"narrative"})
end

local not_new_trigger_block = wrap_block(block, {"trigger"})
table.insert(narrative_blocks, not_new_trigger_block)
end
end
Expand Down Expand Up @@ -133,22 +140,24 @@ function shift_id_to_block(block)
end


-- wrap_block: wrap trigger blocks in a div that allows us to style triggers visually
-- wrap_block: wrap block in a div, adds the classList, and transfers the attributes
function wrap_block(block, classList)

-- extract attributes
local attributesToMove = {}
if block.attributes ~= nil then
for attr, value in pairs(block.attributes) do
if trigger_selectors[attr] or cr_attributes[attr] then
if block.attr ~= nil then
if block.attributes ~= nil then
for attr, value in pairs(block.attr.attributes) do
-- if trigger_selectors[attr] or cr_attributes[attr] then
attributesToMove[attr] = value
block.attributes[attr] = nil
--end
end
end
end

-- construct a pandoc.div with the new attributes to return
return pandoc.Div(block, pandoc.Attr("", classList, attributesToMove))
return pandoc.Div(block, pandoc.Attr("", classList, pandoc.AttributeList(attributesToMove)))
end


Expand Down
6 changes: 6 additions & 0 deletions _extensions/closeread/closeread.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

/* global layout styles */

/* helpful for docs with no header space
.cr-section .narrative-col > *:first-child {
padding-block-start: 10svh !important;
}
*/

.cr-section {
display: grid;
grid-template-rows: 1fr;
Expand Down
211 changes: 211 additions & 0 deletions docs/gallery/demos/minard-zoom/cr-tufte.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
@charset "UTF-8";

/* CSS adapted from https://github.com/edwardtufte/tufte-css */

/*
Import ET Book styles
adapted from https://github.com/edwardtufte/et-book/blob/gh-pages/et-book.css */

@font-face {
font-family: "et-book";
src: url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot");
src: url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot?#iefix") format("embedded-opentype"), url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff") format("woff"), url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf") format("truetype"), url("et-book/et-book-roman-line-figures/et-book-roman-line-figures.svg#etbookromanosf") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: "et-book";
src: url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot");
src: url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot?#iefix") format("embedded-opentype"), url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff") format("woff"), url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf") format("truetype"), url("et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.svg#etbookromanosf") format("svg");
font-weight: normal;
font-style: italic;
font-display: swap;
}

@font-face {
font-family: "et-book";
src: url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot");
src: url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot?#iefix") format("embedded-opentype"), url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff") format("woff"), url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf") format("truetype"), url("et-book/et-book-bold-line-figures/et-book-bold-line-figures.svg#etbookromanosf") format("svg");
font-weight: bold;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: "et-book-roman-old-style";
src: url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot");
src: url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot?#iefix") format("embedded-opentype"), url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff") format("woff"), url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf") format("truetype"), url("et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.svg#etbookromanosf") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}

/* Closeread CSS styles */

.cr-section.sticky-col.sticky-col-stack {
transition:
transform 3s ease-in-out !important;
}

.cr-section .narrative-col {
padding-left: 30px;
}

.cr-section .sticky-col {
padding-left: 30px;
padding-right: 30px;
}

#quarto-content .cr-section .narrative-col .trigger {
padding-top: 0;
padding-bottom: 65svh;
}

/* A small subset of the official Tufte CSS styles */

#quarto-content {
font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antqua", Georgia, serif;
background-color: #fffff8;
color: #111;
counter-reset: sidenote-counter;
}

#quarto-content main#quarto-document-content {
/*font-size: 1.2rem;*/
}

#quarto-content main#quarto-document-content h1 {
font-weight: 400;
margin-top: 4rem;
margin-bottom: 1.5rem;
font-size: 3.2rem;
line-height: 1;
}

#quarto-content main#quarto-document-content h2 {
font-style: italic;
font-weight: 400;
margin-top: 2.1rem;
margin-bottom: 1.4rem;
font-size: 2.2rem;
line-height: 1;
}

#quarto-content main#quarto-document-content h3 {
font-style: italic;
font-weight: 400;
font-size: 1.7rem;
margin-top: 2rem;
margin-bottom: 1.4rem;
line-height: 1;
}

#quarto-content main#quarto-document-content hr {
display: block;
height: 1px;
width: 55%;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}

#quarto-content main#quarto-document-content p.subtitle {
font-style: italic;
margin-top: 1rem;
margin-bottom: 1rem;
font-size: 1.8rem;
display: block;
line-height: 1;
}

#quarto-content main#quarto-document-content .numeral {
font-family: et-book-roman-old-style;
}

#quarto-content main#quarto-document-content .danger {
color: red;
}

#quarto-content main#quarto-document-content article {
padding: 5rem 0rem;
}

#quarto-content main#quarto-document-content section {
padding-top: 1rem;
padding-bottom: 1rem;
}

#quarto-content main#quarto-document-content p,
#quarto-content main#quarto-document-content dl,
#quarto-content main#quarto-document-content ol,
#quarto-content main#quarto-document-content ul {
font-size: 1.4rem;
line-height: 2rem;
}

#quarto-content main#quarto-document-content p {
margin-top: 1.4rem;
margin-bottom: 1.4rem;
padding-right: 0;
vertical-align: baseline;
}

/* Chapter Epigraphs */
#quarto-content main#quarto-document-content div.epigraph {
margin: 5em 0;
}

#quarto-content main#quarto-document-content div.epigraph > blockquote {
margin-top: 3em;
margin-bottom: 3em;
}

#quarto-content main#quarto-document-content div.epigraph > blockquote,
#quarto-content main#quarto-document-content div.epigraph > blockquote > p {
font-style: italic;
}

#quarto-content main#quarto-document-content div.epigraph > blockquote > footer {
font-style: normal;
}

#quarto-content main#quarto-document-content div.epigraph > blockquote > footer > cite {
font-style: italic;
}

#quarto-content main#quarto-document-content a:link::selection,
#quarto-content main#quarto-document-content a:link::-moz-selection {
text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe, 0 0.03em #b4d5fe, 0 -0.03em #b4d5fe, 0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe, 0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe, 0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe, 0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe;
background: #b4d5fe;
}


#quarto-content main#quarto-document-content code,
#quarto-content main#quarto-document-content pre > code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 1.0rem;
line-height: 1.42;
-webkit-text-size-adjust: 100%; /* Prevent adjustments of font size after orientation changes in iOS. See https://github.com/edwardtufte/tufte-css/issues/81#issuecomment-261953409 */
}

#quarto-content main#quarto-document-content .sans > code {
font-size: 1.2rem;
}

#quarto-content main#quarto-document-content h1 > code,
#quarto-content main#quarto-document-content h2 > code,
#quarto-content main#quarto-document-content h3 > code {
font-size: 0.80em;
}

#quarto-content main#quarto-document-content pre > code {
font-size: 0.9rem;
width: 52.5%;
margin-left: 2.5%;
overflow-x: auto;
display: block;
}

Binary file not shown.
Loading

0 comments on commit 913c808

Please sign in to comment.