Skip to content

Commit

Permalink
Use Quarto mechanism for unfreezing index.qmd
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvartan committed Nov 10, 2023
1 parent 6a977e5 commit 32487fc
Show file tree
Hide file tree
Showing 36 changed files with 180 additions and 187 deletions.
1 change: 1 addition & 0 deletions R/_dev.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@
# * Fix the dark theme SCSS.
# * Finish translating `english-abnt-author-date.csl`.
# * Add DOI field into ABNT CSL files.
# * Create `check_quarto_urls()` based on `urlchecker::url_check()`.
15 changes: 0 additions & 15 deletions R/quarto-pre-render-common.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@
# lybrary(stringr)
# lybrary(yaml)

# Unfreeze documents -----

quarto_yml_path <- here::here("_quarto.yml")
quarto_yml_vars <- yaml::read_yaml(quarto_yml_path)

unfreeze_files <- c(
here::here("index.qmd")
)

if (!is.null(quarto_yml_vars$execute$freeze)) {
if (as.character(quarto_yml_vars$execute$freeze) %in% c("TRUE", "auto")) {
for (i in unfreeze_files) rutils:::unfreeze_quarto_file(i)
}
}

# Create environment variables -----

quarto_yml_path <- here::here("_quarto.yml")
Expand Down
34 changes: 9 additions & 25 deletions R/quarto-setup.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
## Based on <https://github.com/hadley/r4ds/blob/main/_common.R>.

# library(checkmate, quietly = TRUE)
# library(extrafont)
# library(here, quietly = TRUE)
# library(kableExtra, quietly = TRUE)
# library(knitr, quietly = TRUE)
# library(ggplot2, quietly = TRUE)
# lybrary(yaml)
Expand Down Expand Up @@ -48,38 +46,24 @@ knitr::opts_chunk$set(
# Set general options -----

options(
scipen = 10,
digits = 3,
dplyr.print_min = 6,
dplyr.print_max = 6,
pillar.max_footer_lines = 2,
pillar.min_chars = 15,
stringr.view_n = 6,
# Temporarily deactivate cli output for quarto
# cli.num_colors = 0,
# cli.hyperlink = FALSE,
pillar.bold = TRUE,
width = 77 # 80 - 3 for #> comment
)

# Set `ggplot2` -----

if (env_vars$format == "pdf") {
ggplot2::theme_set(
ggplot2::theme_gray(
base_size = base_size,
base_family = env_vars$sansfont,
base_line_size = base_size / 22, # `ggplot2::theme_gray` default
base_rect_size = base_size / 22 # `ggplot2::theme_gray` default
)
ggplot2::theme_set(
ggplot2::theme_gray(
base_size = base_size,
base_family = env_vars$sansfont,
base_line_size = base_size / 22, # `ggplot2::theme_gray` default
base_rect_size = base_size / 22 # `ggplot2::theme_gray` default
)
}

if (env_vars$format == "html") {
ggplot2::theme_set(
ggplot2::theme_gray(
base_size = base_size,
base_family = env_vars$sansfont,
base_line_size = base_size/22, # `ggplot2::theme_gray` default
base_rect_size = base_size/22 # `ggplot2::theme_gray` default
)
)
}
)
16 changes: 9 additions & 7 deletions _extensions/abnt/scss/theme-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ $font-size-root: 18px !default;

// Code

$code-block-bg: #373A3C;
$code-block-bg-alpha: 1;
$code-block-bg-alpha: -.8;

/*-- scss:rules --*/

Expand Down Expand Up @@ -49,9 +48,9 @@ h2 {
}

h3 {
margin-top: 1.5em;
font-size: 1.2rem;
font-weight: 500;
margin-top: 1.5em;
font-size: 1.2rem;
font-weight: 500;
}

h4 {
Expand Down Expand Up @@ -80,6 +79,9 @@ code a:any-link {
text-decoration-color: #ccc;
}

pre {
background-image: linear-gradient(160deg,#f8f8f8 0,#f1f1f1 100%);
/* Captions ---------- */

legend {
font-size: .9rem;
color: #bfbfbf;
}
13 changes: 10 additions & 3 deletions _extensions/abnt/scss/theme-light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ h2 {
}

h3 {
margin-top: 1.5em;
font-size: 1.2rem;
font-weight: 500;
margin-top: 1.5em;
font-size: 1.2rem;
font-weight: 500;
}

h4 {
Expand Down Expand Up @@ -71,3 +71,10 @@ code a:any-link {
pre {
background-image: linear-gradient(160deg,#f8f8f8 0,#f1f1f1 100%);
}

/* Captions ---------- */

legend {
font-size: .9rem;
color: #747a7f;
}
Binary file modified docs/index.pdf
Binary file not shown.
61 changes: 35 additions & 26 deletions docs/qmd/pdf-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,16 @@
<li><a href="#redenring-pdf-after-rendering-html-and-vice-versa" id="toc-redenring-pdf-after-rendering-html-and-vice-versa" class="nav-link" data-scroll-target="#redenring-pdf-after-rendering-html-and-vice-versa"><span class="header-section-number">B.6</span> Redenring PDF after rendering HTML (and vice-versa)</a></li>
<li><a href="#crossreferenceable-elements" id="toc-crossreferenceable-elements" class="nav-link" data-scroll-target="#crossreferenceable-elements"><span class="header-section-number">B.7</span> Crossreferenceable elements</a></li>
<li><a href="#freezing-and-cache" id="toc-freezing-and-cache" class="nav-link" data-scroll-target="#freezing-and-cache"><span class="header-section-number">B.8</span> Freezing and cache</a></li>
<li><a href="#spelling-check" id="toc-spelling-check" class="nav-link" data-scroll-target="#spelling-check"><span class="header-section-number">B.9</span> Spelling check</a></li>
<li><a href="#url-check" id="toc-url-check" class="nav-link" data-scroll-target="#url-check"><span class="header-section-number">B.10</span> URL check</a></li>
<li>
<a href="#how-to-customize-this-quarto-format" id="toc-how-to-customize-this-quarto-format" class="nav-link" data-scroll-target="#how-to-customize-this-quarto-format"><span class="header-section-number">B.9</span> How to customize this Quarto format</a>
<a href="#how-to-customize-this-quarto-format" id="toc-how-to-customize-this-quarto-format" class="nav-link" data-scroll-target="#how-to-customize-this-quarto-format"><span class="header-section-number">B.11</span> How to customize this Quarto format</a>
<ul class="collapse">
<li><a href="#quarto-system" id="toc-quarto-system" class="nav-link" data-scroll-target="#quarto-system"><span class="header-section-number">B.9.1</span> Quarto system</a></li>
<li><a href="#template-and-template-partials" id="toc-template-and-template-partials" class="nav-link" data-scroll-target="#template-and-template-partials"><span class="header-section-number">B.9.2</span> Template and template partials</a></li>
<li><a href="#spacing-rules" id="toc-spacing-rules" class="nav-link" data-scroll-target="#spacing-rules"><span class="header-section-number">B.9.3</span> Spacing rules</a></li>
<li><a href="#how-to-add-new-citation-styles" id="toc-how-to-add-new-citation-styles" class="nav-link" data-scroll-target="#how-to-add-new-citation-styles"><span class="header-section-number">B.9.4</span> How to add new citation styles</a></li>
<li><a href="#must-see-references" id="toc-must-see-references" class="nav-link" data-scroll-target="#must-see-references"><span class="header-section-number">B.9.5</span> Must see references</a></li>
<li><a href="#quarto-system" id="toc-quarto-system" class="nav-link" data-scroll-target="#quarto-system"><span class="header-section-number">B.11.1</span> Quarto system</a></li>
<li><a href="#template-and-template-partials" id="toc-template-and-template-partials" class="nav-link" data-scroll-target="#template-and-template-partials"><span class="header-section-number">B.11.2</span> Template and template partials</a></li>
<li><a href="#spacing-rules" id="toc-spacing-rules" class="nav-link" data-scroll-target="#spacing-rules"><span class="header-section-number">B.11.3</span> Spacing rules</a></li>
<li><a href="#how-to-add-new-citation-styles" id="toc-how-to-add-new-citation-styles" class="nav-link" data-scroll-target="#how-to-add-new-citation-styles"><span class="header-section-number">B.11.4</span> How to add new citation styles</a></li>
<li><a href="#must-see-references" id="toc-must-see-references" class="nav-link" data-scroll-target="#must-see-references"><span class="header-section-number">B.11.5</span> Must see references</a></li>
</ul>
</li>
</ul></nav>
Expand Down Expand Up @@ -546,16 +548,23 @@ <h1 class="title"><span id="sec-settings" class="quarto-section-identifier">Appe
</section><section id="freezing-and-cache" class="level2" data-number="B.8"><h2 data-number="B.8" class="anchored" data-anchor-id="freezing-and-cache">
<span class="header-section-number">B.8</span> Freezing and cache</h2>
<p>See <a href="https://quarto.org/docs/projects/code-execution.html#freeze">Freeze</a>.</p>
</section><section id="how-to-customize-this-quarto-format" class="level2" data-number="B.9"><h2 data-number="B.9" class="anchored" data-anchor-id="how-to-customize-this-quarto-format">
<span class="header-section-number">B.9</span> How to customize this Quarto format</h2>
<section id="quarto-system" class="level3" data-number="B.9.1"><h3 data-number="B.9.1" class="anchored" data-anchor-id="quarto-system">
<span class="header-section-number">B.9.1</span> Quarto system</h3>
</section><section id="spelling-check" class="level2" data-number="B.9"><h2 data-number="B.9" class="anchored" data-anchor-id="spelling-check">
<span class="header-section-number">B.9</span> Spelling check</h2>
<p>See <code>rutils:::spell_check_quarto()</code></p>
</section><section id="url-check" class="level2" data-number="B.10"><h2 data-number="B.10" class="anchored" data-anchor-id="url-check">
<span class="header-section-number">B.10</span> URL check</h2>
<p>Soon.</p>
<p>(Based on <code><a href="https://rdrr.io/pkg/urlchecker/man/url_check.html">urlchecker::url_check()</a></code>).</p>
</section><section id="how-to-customize-this-quarto-format" class="level2" data-number="B.11"><h2 data-number="B.11" class="anchored" data-anchor-id="how-to-customize-this-quarto-format">
<span class="header-section-number">B.11</span> How to customize this Quarto format</h2>
<section id="quarto-system" class="level3" data-number="B.11.1"><h3 data-number="B.11.1" class="anchored" data-anchor-id="quarto-system">
<span class="header-section-number">B.11.1</span> Quarto system</h3>
<p>See <a href="https://quarto.org/docs/guide/">Quarto’s guide</a>.</p>
</section><section id="template-and-template-partials" class="level3" data-number="B.9.2"><h3 data-number="B.9.2" class="anchored" data-anchor-id="template-and-template-partials">
<span class="header-section-number">B.9.2</span> Template and template partials</h3>
</section><section id="template-and-template-partials" class="level3" data-number="B.11.2"><h3 data-number="B.11.2" class="anchored" data-anchor-id="template-and-template-partials">
<span class="header-section-number">B.11.2</span> Template and template partials</h3>
<p>See <a href="https://quarto.org/docs/journals/templates.html#template-partials">Tempalte partials</a>.</p>
</section><section id="spacing-rules" class="level3" data-number="B.9.3"><h3 data-number="B.9.3" class="anchored" data-anchor-id="spacing-rules">
<span class="header-section-number">B.9.3</span> Spacing rules</h3>
</section><section id="spacing-rules" class="level3" data-number="B.11.3"><h3 data-number="B.11.3" class="anchored" data-anchor-id="spacing-rules">
<span class="header-section-number">B.11.3</span> Spacing rules</h3>
<ul>
<li>Set fixed dimensions (e.g., page dimensions) in <code>cm</code> or <code>pt</code>. <code>cm</code> is the prefer unit for margins.</li>
<li>Set line spacing as a proportion of <code>\baselineskip</code> (e.g., <code>1.5\baselineskip</code>).</li>
Expand All @@ -564,14 +573,14 @@ <h1 class="title"><span id="sec-settings" class="quarto-section-identifier">Appe
<li>For relative horizontal spacing, use the <code>em</code> unit.</li>
</ul>
<p>See <span class="citation" data-cites="oetiker2023">OETIKER et al. (<a href="references.html#ref-oetiker2023" role="doc-biblioref">2023, sec. 7.5</a>)</span> to learn more about LaTeX spacing features. The articles on <a href="https://www.overleaf.com">Overleaf</a> are also a great source of information. Check <a href="https://www.overleaf.com/learn/latex/Lengths_in_LaTeX">Lengths in LaTeX</a> and <a href="https://www.overleaf.com/learn/latex/Articles/How_to_change_paragraph_spacing_in_LaTeX">How to change paragraph spacing in LaTeX</a> to get a sense of the subject.</p>
<section id="unit-equivalences" class="level4" data-number="B.9.3.1"><h4 data-number="B.9.3.1" class="anchored" data-anchor-id="unit-equivalences">
<span class="header-section-number">B.9.3.1</span> Unit equivalences</h4>
<section id="unit-equivalences" class="level4" data-number="B.11.3.1"><h4 data-number="B.11.3.1" class="anchored" data-anchor-id="unit-equivalences">
<span class="header-section-number">B.11.3.1</span> Unit equivalences</h4>
<ul>
<li>1<code>em</code> <span class="math inline">\(==\)</span> 12<code>pt</code> or <span class="math inline">\(\approx\)</span> 0.423333<code>cm</code>.</li>
<li>1<code>ex</code> <span class="math inline">\(==\)</span> <span class="math inline">\(\approx\)</span> 6.22266<code>pt</code> or <span class="math inline">\(\approx\)</span> 0.219521<code>cm</code>.</li>
</ul>
<section id="baselineskip" class="level5" data-number="B.9.3.1.1"><h5 data-number="B.9.3.1.1" class="anchored" data-anchor-id="baselineskip">
<span class="header-section-number">B.9.3.1.1</span> <code>\baselineskip</code>
<section id="baselineskip" class="level5" data-number="B.11.3.1.1"><h5 data-number="B.11.3.1.1" class="anchored" data-anchor-id="baselineskip">
<span class="header-section-number">B.11.3.1.1</span> <code>\baselineskip</code>
</h5>
<p>These are the equivalences for a Arial typeface with size 12<code>pt</code>:</p>
<p>Use <code>\the\baselineskip</code> and <code>\gevalue{}</code> to figure out the exact value. Note that <code>\gevalue{}</code> will return the value in <code>pt</code>.</p>
Expand Down Expand Up @@ -609,13 +618,13 @@ <h1 class="title"><span id="sec-settings" class="quarto-section-identifier">Appe
<code>3\baselineskip</code> <span class="math inline">\(==\)</span> 65.25<code>pt</code> or <span class="math inline">\(\approx\)</span> 2.301875<code>cm</code>.</li>
</ul>
</li>
</ul></section></section></section><section id="how-to-add-new-citation-styles" class="level3" data-number="B.9.4"><h3 data-number="B.9.4" class="anchored" data-anchor-id="how-to-add-new-citation-styles">
<span class="header-section-number">B.9.4</span> How to add new citation styles</h3>
</section><section id="must-see-references" class="level3" data-number="B.9.5"><h3 data-number="B.9.5" class="anchored" data-anchor-id="must-see-references">
<span class="header-section-number">B.9.5</span> Must see references</h3>
</ul></section></section></section><section id="how-to-add-new-citation-styles" class="level3" data-number="B.11.4"><h3 data-number="B.11.4" class="anchored" data-anchor-id="how-to-add-new-citation-styles">
<span class="header-section-number">B.11.4</span> How to add new citation styles</h3>
</section><section id="must-see-references" class="level3" data-number="B.11.5"><h3 data-number="B.11.5" class="anchored" data-anchor-id="must-see-references">
<span class="header-section-number">B.11.5</span> Must see references</h3>
<p>To learn the basics about LaTeX, see <span class="citation" data-cites="oetiker2023">OETIKER et al. (<a href="references.html#ref-oetiker2023" role="doc-biblioref">2023</a>)</span>. To delve deeper into the LaTeX system, see <span class="citation" data-cites="lamport1994">LAMPORT (<a href="references.html#ref-lamport1994" role="doc-biblioref">1994</a>)</span> and <span class="citation" data-cites="knuth1986">KNUTH (<a href="references.html#ref-knuth1986" role="doc-biblioref">1986</a>)</span>.</p>
<section id="manuals" class="level4" data-number="B.9.5.1"><h4 data-number="B.9.5.1" class="anchored" data-anchor-id="manuals">
<span class="header-section-number">B.9.5.1</span> Manuals</h4>
<section id="manuals" class="level4" data-number="B.11.5.1"><h4 data-number="B.11.5.1" class="anchored" data-anchor-id="manuals">
<span class="header-section-number">B.11.5.1</span> Manuals</h4>
<div>

</div>
Expand All @@ -640,8 +649,8 @@ <h1 class="title"><span id="sec-settings" class="quarto-section-identifier">Appe
</div>
</div>
</div>
</section><section id="r-packages" class="level4" data-number="B.9.5.2"><h4 data-number="B.9.5.2" class="anchored" data-anchor-id="r-packages">
<span class="header-section-number">B.9.5.2</span> R packages</h4>
</section><section id="r-packages" class="level4" data-number="B.11.5.2"><h4 data-number="B.11.5.2" class="anchored" data-anchor-id="r-packages">
<span class="header-section-number">B.11.5.2</span> R packages</h4>
<div>

</div>
Expand Down
12 changes: 6 additions & 6 deletions docs/qmd/references.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ <h1 class="title">References</h1>
<div id="ref-kuhlman2018" class="csl-entry" role="listitem">
KUHLMAN, S. J.; CRAIG, L. M.; DUFFY, J. F. <a href="https://doi.org/10.1101/cshperspect.a033613">Introduction to
chronobiology</a>. <strong>Cold Spring Harbor Perspectives in
Biology</strong>, v. 10, n. 9, p. a033613, set. 2018.
Biology</strong>, v. 10, n. 9, p. a033613, Sep. 2018.
</div>
<div id="ref-lamport1994" class="csl-entry" role="listitem">
LAMPORT, L. <strong><span>LaTeX</span>: a document preparation system:
Expand All @@ -321,7 +321,7 @@ <h1 class="title">References</h1>
</div>
<div id="ref-latinitium" class="csl-entry" role="listitem">
LATINITIUM. <strong>Latin dictionaries</strong>. Disponível em: &lt;<a href="https://latinitium.com/latin-dictionaries/">https://latinitium.com/latin-dictionaries/</a>&gt;.
Acesso em: 21 set. 2023.
Acesso em: 21 sep. 2023.
</div>
<div id="ref-marques2012" class="csl-entry" role="listitem">
MARQUES, M. D.; ODA, G. <a href="https://www.revistas.usp.br/revbiologia/article/view/114816">Glossário</a>.
Expand All @@ -330,7 +330,7 @@ <h1 class="title">References</h1>
<div id="ref-mitchell2013" class="csl-entry" role="listitem">
MITCHELL, M. <strong>Introduction to complexity</strong>. Online course.
Disponível em: &lt;<a href="https://www.complexityexplorer.org/courses/1-https://www.complexityexplorer.org/courses/1">https://www.complexityexplorer.org/courses/1-https://www.complexityexplorer.org/courses/1</a>&gt;.
Acesso em: 21 set. 2023.
Acesso em: 21 sep. 2023.
</div>
<div id="ref-oetiker2023" class="csl-entry" role="listitem">
OETIKER, T. et al. <strong><a href="https://tobi.oetiker.ch/lshort">The
Expand All @@ -347,7 +347,7 @@ <h1 class="title">References</h1>
PITTENDRIGH, C. S. <a href="https://doi.org/10.1146/annurev.ph.55.030193.000313">Temporal
organization: reflections of a darwinian clock-watcher</a>.
<strong>Annual Review of Physiology</strong>, v. 55, n. 1, p. 17–54,
out. 1993.
Oct. 1993.
</div>
<div id="ref-popper1979" class="csl-entry" role="listitem">
POPPER, K. R. <strong>Objective knowledge: an evolutionary
Expand All @@ -356,12 +356,12 @@ <h1 class="title">References</h1>
<div id="ref-roenneberg2012a" class="csl-entry" role="listitem">
ROENNEBERG, T. et al. <a href="https://doi.org/10.1016/j.cub.2012.03.038">Social jetlag and
obesity</a>. <strong>Current Biology</strong>, v. 22, n. 10, p. 939–943,
maio 2012.
May 2012.
</div>
<div id="ref-roenneberg2003" class="csl-entry" role="listitem">
ROENNEBERG, T.; WIRZ-JUSTICE, A.; MERROW, M. <a href="https://doi.org/10.1177/0748730402239679">Life between clocks:
daily temporal patterns of human chronotypes</a>. <strong>Journal of
Biological Rhythms</strong>, v. 18, n. 1, p. 80–90, fev. 2003.
Biological Rhythms</strong>, v. 18, n. 1, p. 80–90, Feb. 2003.
</div>
<div id="ref-wickham2016a" class="csl-entry" role="listitem">
WICKHAM, H. <strong><a href="https://doi.org/10.1007/978-3-319-24277-4">ggplot2: elegant
Expand Down
Loading

0 comments on commit 32487fc

Please sign in to comment.