update template

This commit is contained in:
2024-08-25 21:35:42 +08:00
parent 6e7e207274
commit 8882726770
15 changed files with 464 additions and 130 deletions
+17
View File
@@ -0,0 +1,17 @@
\relax
\providecommand\babel@aux[2]{}
\@nameuse{bbl@beforestart}
\providecommand\hyper@newdestlabel[2]{}
\providecommand*\HyPL@Entry[1]{}
\bibstyle{elsarticle-harv}
\emailauthor{mingsu@rcees.ac.cn}{Ming Su}
\emailauthor{yangmin@rcees.ac.cn}{Min Yang\corref {cor1}}
\Newlabel{cor1}{1}
\bibdata{../BB/Ref.bib,../BB/localRef.bib}
\HyPL@Entry{0<</S/D>>}
\babel@aux{english}{}
\Newlabel{1}{a}
\Newlabel{2}{b}
\newlabel{credit-authorship-contribution-statement}{{b}{1}{CRediT authorship contribution statement}{section*.1}{}}
\@writefile{toc}{\contentsline {section}{CRediT authorship contribution statement}{1}{section*.1}\protected@file@percent }
\gdef \@abspage@last{1}
+1 -1
View File
@@ -28,6 +28,6 @@ closing_greeting: "Yours Sincerely,"
Thank you for your consideration our manuscript (`{{< meta submitid >}}`) in publishing in {{< meta submitjournal >}}, and we also thank the reviewers for their kind and valuable comments.
We have carefully revised the manuscripte according to each comment from the reviewers. As requested, revision note with point to point responses and actions, change tracking manuscript and revised manuscript have been prepared and included in the revision submission.
We have carefully revised the manuscript according to each comment from the reviewers. As requested, revision note with point to point responses and actions, change tracking manuscript and revised manuscript have been prepared and included in the revision submission.
We believe that the paper has been greatly improved. Looking forward to your further instruction regarding its publication.
+33
View File
@@ -0,0 +1,33 @@
\relax
\providecommand\zref@newlabel[2]{}
\providecommand\hyper@newdestlabel[2]{}
\providecommand*\HyPL@Entry[1]{}
\providecommand\babel@aux[2]{}
\@nameuse{bbl@beforestart}
\bibstyle{elsarticle-harv}
\emailauthor{mingsu@rcees.ac.cn}{Ming Su}
\emailauthor{yangmin@rcees.ac.cn}{Min Yang\corref {cor1}}
\Newlabel{cor1}{1}
\bibdata{../BB/Ref.bib,../BB/localRef.bib}
\HyPL@Entry{0<</S/D>>}
\babel@aux{english}{}
\Newlabel{1}{a}
\Newlabel{2}{b}
\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}{section.1}\protected@file@percent }
\newlabel{introduction}{{1}{1}{Introduction}{section.1}{}}
\newlabel{r:r1q0101}{{Bla blaBla blaBla blaBla blaBla bla Bla bla.}{}}
\newlabel{r1q0101}{{1}{1}{Introduction}{section.1}{}}
\newlabel{r1q0101end}{{1}{1}{Introduction}{section.1}{}}
\newlabel{line:r1q0101}{{6}{1}{}{}{}}
\newlabel{line:r1q0101end}{{6}{1}{}{}{}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Materials and methods}{1}{section.2}\protected@file@percent }
\newlabel{materials-and-methods}{{2}{1}{Materials and methods}{section.2}{}}
\@writefile{toc}{\contentsline {section}{\numberline {3}Results}{1}{section.3}\protected@file@percent }
\newlabel{results}{{3}{1}{Results}{section.3}{}}
\@writefile{toc}{\contentsline {section}{\numberline {4}Discussion}{1}{section.4}\protected@file@percent }
\newlabel{discussion}{{4}{1}{Discussion}{section.4}{}}
\@writefile{toc}{\contentsline {section}{\numberline {5}Conclusions}{1}{section.5}\protected@file@percent }
\newlabel{conclusions}{{5}{1}{Conclusions}{section.5}{}}
\newlabel{acknowledgements}{{5}{1}{Acknowledgements}{section*.1}{}}
\@writefile{toc}{\contentsline {section}{Acknowledgements}{1}{section*.1}\protected@file@percent }
\gdef \@abspage@last{1}
+38 -30
View File
@@ -14,41 +14,41 @@ format:
elsevier-html:
css: _extensions/inst/css/style.css
keep-md: true
filters:
dplyr::filters:
- author-info-blocks
epub: default
docx:
reference-doc: _extensions/inst/word/MS.docx
filters:
dplyr::filters:
- author-info-blocks
elsevier-pdf:
keep-tex: true
keep-md: true
include-in-header: "./_extensions/quarto-journals/elsevier/partials/revision.tex"
latex-clean: false
header-includes:
# - \usepackage{threeparttable}
# - \usepackage{fontspec}
# - \usepackage{endfloat}
- \setmainfont{Calibri}
# - \usepackage[UTF8, scheme=plain]{ctex}
# - \usepackage{float}
- \usepackage[normalem]{ulem}
- \usepackage[doublespacing]{setspace}
- \usepackage{lineno}
- \linenumbers
journal:
formatting: preprint # preprint | review | doublebind
model: 1p
cite-style: authoryear
# graphical-abstract: "![](./figures/GA3.pdf)"
# highlights:
# - A comprehensive model was contructed to evaluate the risk of odor occurrences
# - Turbidity distribution determine underwater light and MIB-producing *Planktothrix*
# - Increasing flowrate increases turbidity that can control *Planktothrix* and MIB
# - Odor control based on flow regulation in source water is "green" and fundamental
filters:
- latex-environment
# elsevier-pdf:
# keep-tex: false
# keep-md: false
# include-in-header: "./_extensions/quarto-journals/elsevier/partials/revision.tex"
# latex-clean: false
# header-includes:
# # - \usepackage{threeparttable}
# # - \usepackage{fontspec}
# # - \usepackage{endfloat}
# - \setmainfont{Calibri}
# - \usepackage[UTF8, scheme=plain]{ctex}
# - \usepackage{float}
# - \usepackage[normalem]{ulem}
# - \usepackage[doublespacing]{setspace}
# - \usepackage{lineno}
# - \linenumbers
# journal:
# formatting: preprint # preprint | review | doublebind
# model: 1p
# cite-style: authoryear
# # graphical-abstract: "![](../figures/GA3.pdf)"
# # highlights:
# # - A comprehensive model was contructed to evaluate the risk of odor occurrences
# # - Turbidity distribution determine underwater light and MIB-producing *Planktothrix*
# # - Increasing flowrate increases turbidity that can control *Planktothrix* and MIB
# # - Odor control based on flow regulation in source water is "green" and fundamental
# filters:
# - latex-environment
commands: [clab]
---
@@ -57,6 +57,10 @@ commands: [clab]
::: {.content-visible when-format="html"}
# Color tip {.unnumbered}
@@ -81,6 +85,10 @@ commands: [clab]
# Introduction
Blabla. [Bla blaBla blaBla blaBla blaBla bla Bla bla.]{.clab options=r1q0101}
+34 -39
View File
@@ -14,44 +14,45 @@ format:
elsevier-html:
css: _extensions/inst/css/style.css
keep-md: true
filters:
dplyr::filters:
- author-info-blocks
epub: default
docx:
reference-doc: _extensions/inst/word/MS.docx
filters:
dplyr::filters:
- author-info-blocks
elsevier-pdf:
keep-tex: true
keep-md: true
include-in-header: "./_extensions/quarto-journals/elsevier/partials/revision.tex"
latex-clean: false
header-includes:
# - \usepackage{threeparttable}
# - \usepackage{fontspec}
# - \usepackage{endfloat}
- \setmainfont{Calibri}
# - \usepackage[UTF8, scheme=plain]{ctex}
# - \usepackage{float}
- \usepackage[normalem]{ulem}
- \usepackage[doublespacing]{setspace}
- \usepackage{lineno}
- \linenumbers
journal:
formatting: preprint # preprint | review | doublebind
model: 1p
cite-style: authoryear
# graphical-abstract: "![](./figures/GA3.pdf)"
# highlights:
# - A comprehensive model was contructed to evaluate the risk of odor occurrences
# - Turbidity distribution determine underwater light and MIB-producing *Planktothrix*
# - Increasing flowrate increases turbidity that can control *Planktothrix* and MIB
# - Odor control based on flow regulation in source water is "green" and fundamental
filters:
- latex-environment
# elsevier-pdf:
# keep-tex: false
# keep-md: false
# include-in-header: "./_extensions/quarto-journals/elsevier/partials/revision.tex"
# latex-clean: false
# header-includes:
# # - \usepackage{threeparttable}
# # - \usepackage{fontspec}
# # - \usepackage{endfloat}
# - \setmainfont{Calibri}
# - \usepackage[UTF8, scheme=plain]{ctex}
# - \usepackage{float}
# - \usepackage[normalem]{ulem}
# - \usepackage[doublespacing]{setspace}
# - \usepackage{lineno}
# - \linenumbers
# journal:
# formatting: preprint # preprint | review | doublebind
# model: 1p
# cite-style: authoryear
# # graphical-abstract: "![](../figures/GA3.pdf)"
# # highlights:
# # - A comprehensive model was contructed to evaluate the risk of odor occurrences
# # - Turbidity distribution determine underwater light and MIB-producing *Planktothrix*
# # - Increasing flowrate increases turbidity that can control *Planktothrix* and MIB
# # - Odor control based on flow regulation in source water is "green" and fundamental
# filters:
# - latex-environment
commands: [clab]
---
::: {.content-visible when-format="html"}
# Color tip {.unnumbered}
@@ -72,20 +73,14 @@ lang <- "en"
RM <- "F" # global rendermode, L: load pdata; F: fast load pdf # nolint
isRendering <- isTRUE(getOption("knitr.in.progress"))
require(tidyverse)
require(drwateR)
require(rmdify)
rmdify::rmd_init()
require(dateR)
require(uniteR)
require(langeR)
require(patchwork)
require(lubridate)
require(patchwork)
require(drwateR)
rmdify::rmd_init()
biburl <- "http://drwater.rcees.ac.cn/cloud/s/ref_ming/download/Ref.bib"
if (!isRendering) { download.file(biburl, destfile = "Ref.bib") }
```
# Introduction
Blabla. [Bla blaBla blaBla blaBla blaBla bla Bla bla.]{.clab options=r1q0101}
+18
View File
@@ -0,0 +1,18 @@
\relax
\providecommand\zref@newlabel[2]{}
\providecommand\hyper@newdestlabel[2]{}
\providecommand*\HyPL@Entry[1]{}
\providecommand\babel@aux[2]{}
\@nameuse{bbl@beforestart}
\bibstyle{elsarticle-num}
\emailauthor{mingsu@rcees.ac.cn}{Ming Su}
\emailauthor{yangmin@rcees.ac.cn}{Min Yang\corref {cor1}}
\Newlabel{cor1}{1}
\HyPL@Entry{0<</S/D>>}
\babel@aux{english}{}
\Newlabel{1}{a}
\Newlabel{2}{b}
\newlabel{supplementary-material}{{b}{1}{Supplementary Material}{section*.1}{}}
\@writefile{toc}{\contentsline {section}{Supplementary Material}{1}{section*.1}\protected@file@percent }
\bibdata{../BB/Ref.bib,../BB/localRef.bib}
\gdef \@abspage@last{2}
+5 -10
View File
@@ -38,25 +38,20 @@ filters:
commands: [clab]
---
```{r}
#| label: setup
#| include: false
#| cache: false
options(tinytex.clean = FALSE)
lang <- "en"
RM <- "F" # global rendermode, L: load pdata; F: fast load pdf
isRendering <- isTRUE(getOption('knitr.in.progress'))
require(lubridate)
RM <- "F" # global rendermode, L: load pdata; F: fast load pdf # nolint
isRendering <- isTRUE(getOption("knitr.in.progress"))
require(tidyverse)
require(lubridate)
require(patchwork)
require(drwateR)
require(dwfun)
require(rmdify)
rmdify::rmd_init()
require(langeR)
require(dateR)
require(uniteR)
biburl <- "http://drwater.rcees.ac.cn/cloud/s/ref_ming/download/Ref.bib"
if (!isRendering) { download.file(biburl, destfile = "Ref.bib") }
```
# Supplementary Material {-}
+90 -3
View File
@@ -42,14 +42,28 @@
\setlength{\emergencystretch}{3em} % prevent overfull lines
\setcounter{secnumdepth}{5}
% Make \paragraph and \subparagraph free-standing
\makeatletter
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\renewcommand{\paragraph}{
\@ifstar
\xxxParagraphStar
\xxxParagraphNoStar
}
\newcommand{\xxxParagraphStar}[1]{\oldparagraph*{#1}\mbox{}}
\newcommand{\xxxParagraphNoStar}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\renewcommand{\subparagraph}{
\@ifstar
\xxxSubParagraphStar
\xxxSubParagraphNoStar
}
\newcommand{\xxxSubParagraphStar}[1]{\oldsubparagraph*{#1}\mbox{}}
\newcommand{\xxxSubParagraphNoStar}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\makeatother
\providecommand{\tightlist}{%
@@ -152,6 +166,72 @@
\usepackage{lineno}
\linenumbers
\makeatletter
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{plain}
\@ifundefined{c@chapter}{\newfloat{sfg}{h}{lost}}{\newfloat{sfg}{h}{lost}[chapter]}
\floatname{sfg}{Fig. S}
\newcommand*\quartosfgref[1]{Fig. \hyperref[#1]{S\ref{#1}}}
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\DeclareCaptionLabelFormat{quartosfgreflabelformat}{#1#2}
\captionsetup[sfg]{labelformat=quartosfgreflabelformat}
\newcommand*\listofsfgs{\listof{sfg}{List of Supplementary Figures}}
\makeatother
\makeatletter
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{plain}
\@ifundefined{c@chapter}{\newfloat{stb}{h}{lost}}{\newfloat{stb}{h}{lost}[chapter]}
\floatname{stb}{Table S}
\newcommand*\quartostbref[1]{Table \hyperref[#1]{S\ref{#1}}}
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\DeclareCaptionLabelFormat{quartostbreflabelformat}{#1#2}
\captionsetup[stb]{labelformat=quartostbreflabelformat}
\newcommand*\listofstbs{\listof{stb}{List of Supplementary Tables}}
\makeatother
\makeatletter
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{plain}
\@ifundefined{c@chapter}{\newfloat{seq}{h}{lost}}{\newfloat{seq}{h}{lost}[chapter]}
\floatname{seq}{Eq S}
\newcommand*\quartoseqref[1]{Eq \hyperref[#1]{S\ref{#1}}}
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\DeclareCaptionLabelFormat{quartoseqreflabelformat}{#1#2}
\captionsetup[seq]{labelformat=quartoseqreflabelformat}
\newcommand*\listofseqs{\listof{seq}{List of Supplementary Equations}}
\makeatother
\makeatletter
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{plain}
\@ifundefined{c@chapter}{\newfloat{rfg}{h}{lost}}{\newfloat{rfg}{h}{lost}[chapter]}
\floatname{rfg}{Fig. R}
\newcommand*\quartorfgref[1]{Fig. \hyperref[#1]{R\ref{#1}}}
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\DeclareCaptionLabelFormat{quartorfgreflabelformat}{#1#2}
\captionsetup[rfg]{labelformat=quartorfgreflabelformat}
\newcommand*\listofrfgs{\listof{rfg}{List of Revision Figures}}
\makeatother
\makeatletter
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{plain}
\@ifundefined{c@chapter}{\newfloat{rtb}{h}{lost}}{\newfloat{rtb}{h}{lost}[chapter]}
\floatname{rtb}{Table R}
\newcommand*\quartortbref[1]{Table \hyperref[#1]{R\ref{#1}}}
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\DeclareCaptionLabelFormat{quartortbreflabelformat}{#1#2}
\captionsetup[rtb]{labelformat=quartortbreflabelformat}
\newcommand*\listofrtbs{\listof{rtb}{List of Revision Tables}}
\makeatother
\makeatletter
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{plain}
\@ifundefined{c@chapter}{\newfloat{req}{h}{lost}}{\newfloat{req}{h}{lost}[chapter]}
\floatname{req}{Eq R}
\newcommand*\quartoreqref[1]{Eq \hyperref[#1]{R\ref{#1}}}
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\DeclareCaptionLabelFormat{quartoreqreflabelformat}{#1#2}
\captionsetup[req]{labelformat=quartoreqreflabelformat}
\newcommand*\listofreqs{\listof{req}{List of Revision Equations}}
\makeatother
\makeatletter
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\AtBeginDocument{%
\ifdefined\contentsname
@@ -185,6 +265,7 @@
\@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]}
\floatname{codelisting}{Listing}
\newcommand*\listoflistings{\listof{codelisting}{List of Listings}}
\captionsetup{labelsep=none}
\makeatother
\makeatletter
\makeatother
@@ -192,6 +273,7 @@
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\@ifpackageloaded{subcaption}{}{\usepackage{subcaption}}
\makeatother
\ifLuaTeX
\usepackage[bidi=basic]{babel}
\else
@@ -206,7 +288,8 @@
\fi
\usepackage[]{natbib}
\bibliographystyle{elsarticle-num}
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same} % disable monospaced font for URLs
\hypersetup{
@@ -220,6 +303,7 @@
urlcolor={Blue},
pdfcreator={LaTeX via pandoc}}
\setlength{\parindent}{6pt}
\begin{document}
\begin{frontmatter}
@@ -251,6 +335,8 @@ Sciences},city={Beijing},postcode={100049}}
\end{frontmatter}
\section*{Supplementary Material}\label{supplementary-material}
\addcontentsline{toc}{section}{Supplementary Material}
@@ -263,4 +349,5 @@ to the main text.
\bibliography{../BB/Ref.bib,../BB/localRef.bib}
\end{document}
+76 -24
View File
@@ -1,6 +1,6 @@
title: "MANUSCRIPT TITLE"
submitjournal: "JOURNAL"
submitid:
submitid:
lang: en
date: today
bibliography: [BB/Ref.bib, BB/localRef.bib]
@@ -40,23 +40,77 @@ crossref:
tbl-prefix: Table # (default is "Table")
eq-prefix: Eq.
ref-hyperlink: true # (default is true)
custom:
- kind: float
key: sfg
reference-prefix: "Fig. S"
space-before-numbering: false
caption-prefix: "Fig. S"
latex-env: sfg
latex-list-of-file-extension: lost
latex-list-of-description: Supplementary Figure
- kind: float
key: stb
reference-prefix: "Table S"
space-before-numbering: false
caption-prefix: "Table S"
latex-env: stb
latex-list-of-file-extension: lost
latex-list-of-description: Supplementary Table
- kind: float
key: seq
reference-prefix: "Eq S"
space-before-numbering: false
caption-prefix: "Eq S"
latex-env: seq
latex-list-of-file-extension: lost
latex-list-of-description: Supplementary Equation
- kind: float
key: rfg
reference-prefix: "Fig. R"
space-before-numbering: false
caption-prefix: "Fig. R"
latex-env: rfg
latex-list-of-file-extension: lost
latex-list-of-description: Revision Figure
- kind: float
key: rtb
reference-prefix: "Table R"
space-before-numbering: false
caption-prefix: "Table R"
latex-env: rtb
latex-list-of-file-extension: lost
latex-list-of-description: Revision Table
- kind: float
key: req
reference-prefix: "Eq R"
space-before-numbering: false
caption-prefix: "Eq R"
latex-env: req
latex-list-of-file-extension: lost
latex-list-of-description: Revision Equation
prefer-html: true
# execute:
# freeze: auto # re-render only when source changes
# cache: true
project:
type: website
output-dir: www/
# render:
# - index.qmd
# - MS/SM.qmd
# - MS/MS.qmd
# - MS/CL.qmd
# - MS/HL.qmd
render:
- index.qmd
- MS/SM.qmd
- MS/MS.qmd
- MS/CL.qmd
- MS/HL.qmd
# - MS/RN.qmd
# - MS/AC.qmd
website:
title: "Version: {{< var branch >}}"
reader-mode: true
site-url: https://drwater.rcees.ac.cn/{{< var projtype >}}/{{< var reponame >}}/@{{< var branch >}}
repo-url: https://drwater.rcees.ac.cn/git/{{< var projtype >}}/{{< var reponame >}}/src/branch/{{< var branch >}}
site-url: https://drwater.rcees.ac.cn/{{< var pubtype >}}/{{< var projtype >}}/{{< var reponame >}}/@{{< var branch >}}
repo-url: https://drwater.rcees.ac.cn/git/{{< var projtype >}}/{{< var reponame >}}
repo-actions: [edit, source, issue]
page-navigation: true
page-footer: "Copyright 2023, [Ming Su](https://drwater.rcees.ac.cn)"
@@ -73,29 +127,27 @@ website:
file: MS/SM.qmd
- text: "Revision Notes"
file: MS/RN.qmd
- text: "Trackchanges"
file: TC/index.qmd
- text: "Slides"
file: SD/index.qmd
- text: "Other"
menu:
- text: "Highlights"
file: MS/HL.qmd
- text: "Cover Letter"
file: MS/CL.qmd
- text: "Author Credits"
file: MS/AC.qmd
- text: "Report"
file: RP/index.qmd
- text: "Acomplishment"
file: AC/index.qmd
- text: "Highlights"
file: MS/HL.qmd
- text: "Cover Letter"
file: MS/CL.qmd
# - text: "Author Credits"
# file: MS/AC.qmd
- text: "Trackchanges"
file: TC/index.qmd
- text: "Accomplishment"
file: AC/index.qmd
- icon: git
menu:
- text: Edit
url: https://drwater.rcees.ac.cn/git/{{< var projtype >}}/{{< var reponame >}}/_edit/
url: https://drwater.rcees.ac.cn/git/{{< var projtype >}}/{{< var reponame >}}/src/branch/{{< var branch >}}
- text: Issue
url: https://drwater.rcees.ac.cn/git/{{< var projtype >}}/{{< var reponame >}}/issues
comments:
url: https://drwater.rcees.ac.cn/git/manuscript/{{< var reponame >}}/issues
comments:
hypothesis:
theme: clean
openSidebar: false
+8
View File
@@ -1,5 +1,13 @@
---
subtitle: "Abstract"
author: ""
engine: knitr
---
```{bash}
#| echo: false
#| output: asis
grep "^abstract: " ./MS/MS.qmd | sed -e 's/^abstract: \"*\(.*\).$/\1/g'
```
File diff suppressed because one or more lines are too long
@@ -81,6 +81,7 @@ code span.st {
code span.cf {
color: #003B4F;
font-weight: bold;
font-style: inherit;
}
@@ -189,6 +190,7 @@ code span.dv {
code span.kw {
color: #003B4F;
font-weight: bold;
font-style: inherit;
}
+25 -6
View File
@@ -9,7 +9,7 @@ const layoutMarginEls = () => {
// Find any conflicting margin elements and add margins to the
// top to prevent overlap
const marginChildren = window.document.querySelectorAll(
".column-margin.column-container > * "
".column-margin.column-container > *, .margin-caption, .aside"
);
let lastBottom = 0;
@@ -19,7 +19,9 @@ const layoutMarginEls = () => {
marginChild.style.marginTop = null;
const top = marginChild.getBoundingClientRect().top + window.scrollY;
if (top < lastBottom) {
const margin = lastBottom - top;
const marginChildStyle = window.getComputedStyle(marginChild);
const marginBottom = parseFloat(marginChildStyle["marginBottom"]);
const margin = lastBottom - top + marginBottom;
marginChild.style.marginTop = `${margin}px`;
}
const styles = window.getComputedStyle(marginChild);
@@ -33,7 +35,15 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
// Recompute the position of margin elements anytime the body size changes
if (window.ResizeObserver) {
const resizeObserver = new window.ResizeObserver(
throttle(layoutMarginEls, 50)
throttle(() => {
layoutMarginEls();
if (
window.document.body.getBoundingClientRect().width < 990 &&
isReaderMode()
) {
quartoToggleReader();
}
}, 50)
);
resizeObserver.observe(window.document.body);
}
@@ -84,7 +94,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
if (link.href.indexOf("#") !== -1) {
const anchor = link.href.split("#")[1];
const heading = window.document.querySelector(
`[data-anchor-id=${anchor}]`
`[data-anchor-id="${anchor}"]`
);
if (heading) {
// Add the class
@@ -124,8 +134,10 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
window.innerHeight + window.pageYOffset >=
window.document.body.offsetHeight
) {
// This is the no-scroll case where last section should be the active one
sectionIndex = 0;
} else {
// This finds the last section visible on screen that should be made active
sectionIndex = [...sections].reverse().findIndex((section) => {
if (section) {
return window.pageYOffset >= section.offsetTop - sectionMargin;
@@ -307,6 +319,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
for (const child of el.children) {
child.style.opacity = 0;
child.style.overflow = "hidden";
child.style.pointerEvents = "none";
}
nexttick(() => {
@@ -348,6 +361,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
const clone = child.cloneNode(true);
clone.style.opacity = 1;
clone.style.pointerEvents = null;
clone.style.display = null;
toggleContents.append(clone);
}
@@ -422,6 +436,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
for (const child of el.children) {
child.style.opacity = 1;
child.style.overflow = null;
child.style.pointerEvents = null;
}
const placeholderEl = window.document.getElementById(
@@ -729,6 +744,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
// Process the collapse state if this is an UL
if (el.tagName === "UL") {
if (tocOpenDepth === -1 && depth > 1) {
// toc-expand: false
el.classList.add("collapse");
} else if (
depth <= tocOpenDepth ||
@@ -747,10 +763,9 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
};
// walk the TOC and expand / collapse any items that should be shown
if (tocEl) {
walk(tocEl, 0);
updateActiveLink();
walk(tocEl, 0);
}
// Throttle the scroll event and walk peridiocally
@@ -769,6 +784,10 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
window.addEventListener(
"resize",
throttle(() => {
if (tocEl) {
updateActiveLink();
walk(tocEl, 0);
}
if (!isReaderMode()) {
hideOverlappedSidebars();
}
+49 -1
View File
@@ -5,9 +5,45 @@ const headroomChanged = new CustomEvent("quarto-hrChanged", {
composed: false,
});
const announceDismiss = () => {
const annEl = window.document.getElementById("quarto-announcement");
if (annEl) {
annEl.remove();
const annId = annEl.getAttribute("data-announcement-id");
window.localStorage.setItem(`quarto-announce-${annId}`, "true");
}
};
const announceRegister = () => {
const annEl = window.document.getElementById("quarto-announcement");
if (annEl) {
const annId = annEl.getAttribute("data-announcement-id");
const isDismissed =
window.localStorage.getItem(`quarto-announce-${annId}`) || false;
if (isDismissed) {
announceDismiss();
return;
} else {
annEl.classList.remove("hidden");
}
const actionEl = annEl.querySelector(".quarto-announcement-action");
if (actionEl) {
actionEl.addEventListener("click", function (e) {
e.preventDefault();
// Hide the bar immediately
announceDismiss();
});
}
}
};
window.document.addEventListener("DOMContentLoaded", function () {
let init = false;
announceRegister();
// Manage the back to top button, if one is present.
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
const scrollDownBuffer = 5;
@@ -85,6 +121,17 @@ window.document.addEventListener("DOMContentLoaded", function () {
}
}
function dashboardOffset() {
const dashboardNavEl = window.document.getElementById(
"quarto-dashboard-header"
);
if (dashboardNavEl !== null) {
return dashboardNavEl.clientHeight;
} else {
return 0;
}
}
function updateDocumentOffsetWithoutAnimation() {
updateDocumentOffset(false);
}
@@ -92,7 +139,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
function updateDocumentOffset(animated) {
// set body offset
const topOffset = headerOffset();
const bodyOffset = topOffset + footerOffset();
const bodyOffset = topOffset + footerOffset() + dashboardOffset();
const bodyEl = window.document.body;
bodyEl.setAttribute("data-bs-offset", topOffset);
bodyEl.style.paddingTop = topOffset + "px";
@@ -226,6 +273,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
const links = window.document.querySelectorAll("a");
for (let i = 0; i < links.length; i++) {
if (links[i].href) {
links[i].dataset.originalHref = links[i].href;
links[i].href = links[i].href.replace(/\/index\.html/, "/");
}
}
+63 -14
View File
@@ -98,6 +98,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
classNames: {
form: "d-flex",
},
placeholder: language["search-text-placeholder"],
translations: {
clearButtonTitle: language["search-clear-button-title"],
detachedCancelButtonText: language["search-detached-cancel-button-title"],
@@ -392,7 +393,12 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
return focusedEl.tagName.toLowerCase() === tag;
});
if (kbds && kbds.includes(key) && !isFormElFocused) {
if (
kbds &&
kbds.includes(key) &&
!isFormElFocused &&
!document.activeElement.isContentEditable
) {
event.preventDefault();
window.quartoOpenSearch();
}
@@ -669,6 +675,18 @@ function showCopyLink(query, options) {
// create the index
var fuseIndex = undefined;
var shownWarning = false;
// fuse index options
const kFuseIndexOptions = {
keys: [
{ name: "title", weight: 20 },
{ name: "section", weight: 20 },
{ name: "text", weight: 10 },
],
ignoreLocation: true,
threshold: 0.1,
};
async function readSearchData() {
// Initialize the search index on demand
if (fuseIndex === undefined) {
@@ -679,17 +697,7 @@ async function readSearchData() {
shownWarning = true;
return;
}
// create fuse index
const options = {
keys: [
{ name: "title", weight: 20 },
{ name: "section", weight: 20 },
{ name: "text", weight: 10 },
],
ignoreLocation: true,
threshold: 0.1,
};
const fuse = new window.Fuse([], options);
const fuse = new window.Fuse([], kFuseIndexOptions);
// fetch the main search.json
const response = await fetch(offsetURL("search.json"));
@@ -1220,8 +1228,34 @@ function algoliaSearch(query, limit, algoliaOptions) {
});
}
function fuseSearch(query, fuse, fuseOptions) {
return fuse.search(query, fuseOptions).map((result) => {
let subSearchTerm = undefined;
let subSearchFuse = undefined;
const kFuseMaxWait = 125;
async function fuseSearch(query, fuse, fuseOptions) {
let index = fuse;
// Fuse.js using the Bitap algorithm for text matching which runs in
// O(nm) time (no matter the structure of the text). In our case this
// means that long search terms mixed with large index gets very slow
//
// This injects a subIndex that will be used once the terms get long enough
// Usually making this subindex is cheap since there will typically be
// a subset of results matching the existing query
if (subSearchFuse !== undefined && query.startsWith(subSearchTerm)) {
// Use the existing subSearchFuse
index = subSearchFuse;
} else if (subSearchFuse !== undefined) {
// The term changed, discard the existing fuse
subSearchFuse = undefined;
subSearchTerm = undefined;
}
// Search using the active fuse
const then = performance.now();
const resultsRaw = await index.search(query, fuseOptions);
const now = performance.now();
const results = resultsRaw.map((result) => {
const addParam = (url, name, value) => {
const anchorParts = url.split("#");
const baseUrl = anchorParts[0];
@@ -1238,4 +1272,19 @@ function fuseSearch(query, fuse, fuseOptions) {
crumbs: result.item.crumbs,
};
});
// If we don't have a subfuse and the query is long enough, go ahead
// and create a subfuse to use for subsequent queries
if (
now - then > kFuseMaxWait &&
subSearchFuse === undefined &&
resultsRaw.length < fuseOptions.limit
) {
subSearchTerm = query;
subSearchFuse = new window.Fuse([], kFuseIndexOptions);
resultsRaw.forEach((rr) => {
subSearchFuse.add(rr.item);
});
}
return results;
}