Skip to content

Commit

Permalink
update quarto; remove CV toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinschmitt committed Oct 12, 2023
1 parent a380184 commit ac2f6f5
Show file tree
Hide file tree
Showing 19 changed files with 1,306 additions and 234 deletions.
4 changes: 2 additions & 2 deletions _freeze/cv/index/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"hash": "9752aed9ed20d0451a04cc2a36d7909c",
"hash": "c1396f1f9307a539f1597a232ceb2381",
"result": {
"markdown": "---\nlayout: page\ntitle: Curriculum vitae\nexcerpt: My current CV\nexecute:\n freeze: true # never re-render during project render\nengine: knitr \nresources:\n - \"cv.pdf\"\ncv:\n pdf: \"cv.pdf\"\n---\n\n::: {.cell}\n<style type=\"text/css\">\n.embed-container {\n position: relative;\n padding-bottom: 129%;\n height: 0;\n overflow: hidden;\n max-width: 100%;\n}\n.embed-container iframe,\n.embed-container object,\n.embed-container embed {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n</style>\n:::\n\n```{=html}\n<p class=\"text-center\">\n <a class=\"btn btn-primary btn-lg cv-download\" href=\"cv.pdf\" target=\"_blank\">\n <i class=\"fa-solid fa-file-arrow-down\"></i>&ensp;Download current CV\n </a>\n</p>\n<div class=\"embed-container\">\n <iframe src=\"cv.pdf\" style=\"border: 0.5px\"></iframe>\n</div>\n```\n\n```{=html}\n<div style=\"margin: 30px; text-align: center;\">\n<a class=\"btn btn-primary\" href=\"https://www.marvinschmitt.com/blog/website-tutorial-quarto/\" role=\"button\" target=\"_blank\" style=\"padding: 15px 30px;\">View the tutorial for this template (+ download link)</a>\n</div>\n```",
"markdown": "---\nlayout: page\ntitle: Curriculum vitae\nexcerpt: My current CV\nexecute:\n freeze: true # never re-render during project render\nengine: knitr \nresources:\n - \"cv.pdf\"\ncv:\n pdf: \"cv.pdf\"\n---\n\n::: {.cell}\n<style type=\"text/css\">\n.embed-container {\n position: relative;\n padding-bottom: 129%;\n height: 0;\n overflow: hidden;\n max-width: 100%;\n}\n.embed-container iframe,\n.embed-container object,\n.embed-container embed {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n</style>\n:::\n\n```{=html}\n<p class=\"text-center\">\n <a class=\"btn btn-primary btn-lg cv-download\" href=\"cv.pdf\" target=\"_blank\">\n <i class=\"fa-solid fa-file-arrow-down\"></i>&ensp;Download current CV\n </a>\n</p>\n<div class=\"embed-container\">\n <iframe src=\"cv.pdf#toolbar=0\" style=\"border: 0.5px;width: 100%;\"></iframe>\n</div>\n```\n\n```{=html}\n<div style=\"margin: 30px; text-align: center;\">\n<a class=\"btn btn-primary\" href=\"https://www.marvinschmitt.com/blog/website-tutorial-quarto/\" role=\"button\" target=\"_blank\" style=\"padding: 15px 30px;\">View the tutorial for this template (+ download link)</a>\n</div>\n```",
"supporting": [],
"filters": [
"rmarkdown/pagebreak.lua"
Expand Down
4 changes: 2 additions & 2 deletions _freeze/site_libs/clipboard/clipboard.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cv/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cv:
</a>
</p>
<div class="embed-container">
<iframe src="`r rmarkdown::metadata$cv$pdf`" style="border: 0.5px"></iframe>
<iframe src="`r rmarkdown::metadata$cv$pdf`#toolbar=0" style="border: 0.5px;width: 100%;"></iframe>
</div>
```

Expand Down
131 changes: 117 additions & 14 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.2.313">
<meta name="generator" content="quarto-1.3.450">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand All @@ -17,7 +17,7 @@
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
</style>
Expand Down Expand Up @@ -55,7 +55,8 @@
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit"
"search-submit-button-title": "Submit",
"search-label": "Search"
}
}</script>

Expand All @@ -76,47 +77,49 @@
<span class="navbar-title">Gandalf</span>
</a>
</div>
<div id="quarto-search" class="" title="Search"></div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav navbar-nav-scroll me-auto">
<li class="nav-item">
<a class="nav-link" href="/projects/index.html">
<a class="nav-link" href="/projects/index.html" rel="" target="">
<span class="menu-text">Projects</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/photography/index.html">
<a class="nav-link" href="/photography/index.html" rel="" target="">
<span class="menu-text">Photography</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/cv/index.html">
<a class="nav-link" href="/cv/index.html" rel="" target="">
<span class="menu-text">CV</span></a>
</li>
</ul>
<ul class="navbar-nav navbar-nav-scroll ms-auto">
<li class="nav-item compact">
<a class="nav-link" href="https://www.marvinschmitt.com/blog/website-tutorial-quarto/"><i class="bi bi-folder-symlink" role="img">
<a class="nav-link" href="https://www.marvinschmitt.com/blog/website-tutorial-quarto/" rel="" target=""><i class="bi bi-folder-symlink" role="img">
</i>
<span class="menu-text"></span></a>
</li>
<li class="nav-item compact">
<a class="nav-link" href="https://twitter.com/MarvinSchmittML"><i class="bi bi-twitter" role="img">
<a class="nav-link" href="https://twitter.com/MarvinSchmittML" rel="" target=""><i class="bi bi-twitter" role="img">
</i>
<span class="menu-text"></span></a>
</li>
<li class="nav-item compact">
<a class="nav-link" href="https://www.linkedin.com/in/marvin-schmitt-a85b321a2/"><i class="bi bi-linkedin" role="img">
<a class="nav-link" href="https://www.linkedin.com/in/marvin-schmitt-a85b321a2/" rel="" target=""><i class="bi bi-linkedin" role="img">
</i>
<span class="menu-text"></span></a>
</li>
<li class="nav-item compact">
<a class="nav-link" href="mailto:[email protected]"><i class="bi bi-envelope" role="img" aria-label="email">
<a class="nav-link" href="mailto:[email protected]" rel="" target=""><i class="bi bi-envelope" role="img" aria-label="email">
</i>
<span class="menu-text"></span></a>
</li>
</ul>
<div id="quarto-search" class="" title="Search"></div>
<div class="quarto-navbar-tools">
</div>
</div> <!-- /navcollapse -->
</div> <!-- /container-fluid -->
</nav>
Expand Down Expand Up @@ -178,9 +181,23 @@ <h1 class="title">404</h1>
icon: icon
};
anchorJS.add('.anchored');
const isCodeAnnotation = (el) => {
for (const clz of el.classList) {
if (clz.startsWith('code-annotation-')) {
return true;
}
}
return false;
}
const clipboard = new window.ClipboardJS('.code-copy-button', {
target: function(trigger) {
return trigger.previousElementSibling;
text: function(trigger) {
const codeEl = trigger.previousElementSibling.cloneNode(true);
for (const childEl of codeEl.children) {
if (isCodeAnnotation(childEl)) {
childEl.remove();
}
}
return codeEl.innerText;
}
});
clipboard.on('success', function(e) {
Expand Down Expand Up @@ -245,6 +262,92 @@ <h1 class="title">404</h1>
return note.innerHTML;
});
}
let selectedAnnoteEl;
const selectorForAnnotation = ( cell, annotation) => {
let cellAttr = 'data-code-cell="' + cell + '"';
let lineAttr = 'data-code-annotation="' + annotation + '"';
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
return selector;
}
const selectCodeLines = (annoteEl) => {
const doc = window.document;
const targetCell = annoteEl.getAttribute("data-target-cell");
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
const lineIds = lines.map((line) => {
return targetCell + "-" + line;
})
let top = null;
let height = null;
let parent = null;
if (lineIds.length > 0) {
//compute the position of the single el (top and bottom and make a div)
const el = window.document.getElementById(lineIds[0]);
top = el.offsetTop;
height = el.offsetHeight;
parent = el.parentElement.parentElement;
if (lineIds.length > 1) {
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
height = bottom - top;
}
if (top !== null && height !== null && parent !== null) {
// cook up a div (if necessary) and position it
let div = window.document.getElementById("code-annotation-line-highlight");
if (div === null) {
div = window.document.createElement("div");
div.setAttribute("id", "code-annotation-line-highlight");
div.style.position = 'absolute';
parent.appendChild(div);
}
div.style.top = top - 2 + "px";
div.style.height = height + 4 + "px";
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
if (gutterDiv === null) {
gutterDiv = window.document.createElement("div");
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
gutterDiv.style.position = 'absolute';
const codeCell = window.document.getElementById(targetCell);
const gutter = codeCell.querySelector('.code-annotation-gutter');
gutter.appendChild(gutterDiv);
}
gutterDiv.style.top = top - 2 + "px";
gutterDiv.style.height = height + 4 + "px";
}
selectedAnnoteEl = annoteEl;
}
};
const unselectCodeLines = () => {
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
elementsIds.forEach((elId) => {
const div = window.document.getElementById(elId);
if (div) {
div.remove();
}
});
selectedAnnoteEl = undefined;
};
// Attach click handler to the DT
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
for (const annoteDlNode of annoteDls) {
annoteDlNode.addEventListener('click', (event) => {
const clickedEl = event.target;
if (clickedEl !== selectedAnnoteEl) {
unselectCodeLines();
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
if (activeEl) {
activeEl.classList.remove('code-annotation-active');
}
selectCodeLines(clickedEl);
clickedEl.classList.add('code-annotation-active');
} else {
// Unselect the line
unselectCodeLines();
clickedEl.classList.remove('code-annotation-active');
}
});
}
const findCites = (el) => {
const parentEl = el.parentElement;
if (parentEl) {
Expand Down Expand Up @@ -288,7 +391,7 @@ <h1 class="title">404</h1>
<footer class="footer">
<div class="nav-footer">
<div class="nav-footer-left"><span class="faux-block">© 2023 Marvin Schmitt CC BY-SA 4.0</span></div>
<div class="nav-footer-center"><span class="faux-block"><a href="https://www.marvinschmitt.com/blog/website-tutorial-quarto/">View the tutorial for this template!</a></span></div>
<div class="nav-footer-center"><span class="faux-block"><a href="https://www.marvinschmitt.com/blog/website-tutorial-quarto/">View the tutorial for this template!</a></span></div>
<div class="nav-footer-right"><span class="faux-block"><a href="https://github.com/marvinschmitt/quarto-website-template/">View source on GitHub</a></span></div>
</div>
</footer>
Expand Down
Loading

0 comments on commit ac2f6f5

Please sign in to comment.