1<!DOCTYPE html> 2<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> 3 4<meta charset="utf-8"> 5<meta name="generator" content="quarto-1.6.40"> 6 7<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> 8 9 10<title>Teaching â Ewen Gallic</title> 11<style> 12code{white-space: pre-wrap;} 13span.smallcaps{font-variant: small-caps;} 14div.columns{display: flex; gap: min(4vw, 1.5em);} 15div.column{flex: auto; overflow-x: auto;} 16div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} 17ul.task-list{list-style: none;} 18ul.task-list li input[type="checkbox"] { 19 width: 0.8em; 20 margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */ 21 vertical-align: middle; 22} 23</style> 24 25
26<script src="site_libs/quarto-nav/quarto-nav.js"></script>
vendor: 1 bytes, line 26
26
27<script src="site_libs/quarto-nav/headroom.min.js"></script>
vendor: 1 bytes, line 27
27
28<script src="site_libs/clipboard/clipboard.min.js"></script>
vendor: 1 bytes, line 28
28
29<script src="site_libs/quarto-search/autocomplete.umd.js"></script>
vendor: 1 bytes, line 29
29
30<script src="site_libs/quarto-search/fuse.min.js"></script>
vendor: 1 bytes, line 30
30
31<script src="site_libs/quarto-search/quarto-search.js"></script>
31 32<meta name="quarto:offset" content="./">
33<script src="site_libs/quarto-html/quarto.js"></script>
vendor: 1 bytes, line 33
33
34<script src="site_libs/quarto-html/popper.min.js"></script>
vendor: 1 bytes, line 34
34
35<script src="site_libs/quarto-html/tippy.umd.min.js"></script>
vendor: 1 bytes, line 35
35
36<script src="site_libs/quarto-html/anchor.min.js"></script>
36 37<link href="site_libs/quarto-html/tippy.css" rel="stylesheet"> 38<link href="site_libs/quarto-html/quarto-syntax-highlighting-f17a943e65a20cbde4a240cc1e34e1e2.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles"> 39<link href="site_libs/quarto-html/quarto-syntax-highlighting-dark-85d74762ea2f274ae3b214c584e61c69.css" rel="prefetch" class="quarto-color-scheme quarto-color-alternate" id="quarto-text-highlighting-styles">
40<script src="site_libs/bootstrap/bootstrap.min.js"></script>
40 41<link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet"> 42<link href="site_libs/bootstrap/bootstrap-957c71bbe5c1fad35b6ec449664d6a87.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light"> 43<link href="site_libs/bootstrap/bootstrap-dark-18215383573c450d8873a84056be1fb3.min.css" rel="prefetch" append-hash="true" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark"> 44<link href="site_libs/quarto-contrib/fontawesome6-0.1.0/all.css" rel="stylesheet"> 45<link href="site_libs/quarto-contrib/fontawesome6-0.1.0/latex-fontsize.css" rel="stylesheet">
46<script id="quarto-search-options" type="application/json">{ 47 "location": "navbar", 48 "copy-button": false, 49 "collapse-after": 3, 50 "panel-placement": "end", 51 "type": "overlay", 52 "limit": 50, 53 "keyboard-shortcut": [ 54 "f", 55 "/", 56 "s" 57 ], 58 "show-item-context": false, 59 "language": { 60 "search-no-results-text": "No results", 61 "search-matching-documents-text": "matching documents", 62 "search-copy-link-title": "Copy link to search", 63 "search-hide-matches-text": "Hide additional matches", 64 "search-more-match-text": "more match in this document", 65 "search-more-matches-text": "more matches in this document", 66 "search-clear-button-title": "Clear", 67 "search-text-placeholder": "", 68 "search-detached-cancel-button-title": "Cancel", 69 "search-submit-button-title": "Submit", 70 "search-label": "Search" 71 } 72}</script>
72 73 74 75<link rel="stylesheet" href="styles.css"> 76</head> 77 78<body class="nav-fixed"> 79 80<div id="quarto-search-results"></div> 81 <header id="quarto-header" class="headroom fixed-top"> 82 <nav class="navbar navbar-expand-lg " data-bs-theme="dark"> 83 <div class="navbar-container container-fluid"> 84 <div class="navbar-brand-container mx-auto"> 85 <a class="navbar-brand" href="./index.html"> 86 <span class="navbar-title">Ewen Gallic</span> 87 </a> 88 </div> 89 <div id="quarto-search" class="" title="Search"></div> 90 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" role="menu" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> 91 <span class="navbar-toggler-icon"></span> 92</button> 93 <div class="collapse navbar-collapse" id="navbarCollapse"> 94 <ul class="navbar-nav navbar-nav-scroll me-auto"> 95 <li class="nav-item"> 96 <a class="nav-link" href="./index.html"> 97<span class="menu-text">Home</span></a> 98 </li> 99 <li class="nav-item"> 100 <a class="nav-link" href="./research.html"> 101<span class="menu-text">Research</span></a> 102 </li> 103 <li class="nav-item"> 104 <a class="nav-link active" href="./teaching.html" aria-current="page"> 105<span class="menu-text">Teaching</span></a> 106 </li> 107 <li class="nav-item"> 108 <a class="nav-link" href="./students.html"> 109<span class="menu-text">Students</span></a> 110 </li> 111 <li class="nav-item"> 112 <a class="nav-link" href="./r-codes.html"> 113<span class="menu-text">R codes</span></a> 114 </li> 115 <li class="nav-item"> 116 <a class="nav-link" href="./blog.html"> 117<span class="menu-text">Blog</span></a> 118 </li> 119</ul> 120 </div> <!-- /navcollapse --> 121 <div class="quarto-navbar-tools"> 122 <a href="" class="quarto-color-scheme-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleColorScheme(); return false;" title="Toggle dark mode"><i class="bi"></i></a> 123</div> 124 </div> <!-- /container-fluid --> 125 </nav> 126</header> 127<!-- content --> 128<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar"> 129<!-- sidebar --> 130<!-- margin-sidebar --> 131 <div id="quarto-margin-sidebar" class="sidebar margin-sidebar"> 132 <nav id="TOC" role="doc-toc" class="toc-active"> 133 <h2 id="toc-title">On this page</h2> 134 135 <ul> 136 <li><a href="#current-courses" id="toc-current-courses" class="nav-link active" data-scroll-target="#current-courses">Current courses</a></li> 137 <li><a href="#former-courses" id="toc-former-courses" class="nav-link" data-scroll-target="#former-courses">Former courses</a></li> 138 <li><a href="#e-books" id="toc-e-books" class="nav-link" data-scroll-target="#e-books">E-books</a></li> 139 <li><a href="#templates" id="toc-templates" class="nav-link" data-scroll-target="#templates">Templates</a></li> 140 </ul> 141</nav> 142 </div> 143<!-- main --> 144<main class="content" id="quarto-document-content"> 145 146<header id="title-block-header" class="quarto-title-block default"> 147<div class="quarto-title"> 148<h1 class="title">Teaching</h1> 149</div> 150 151 152 153<div class="quarto-title-meta"> 154 155 156 157 158 </div> 159 160 161 162</header> 163 164 165<section id="current-courses" class="level1"> 166<h1>Current courses</h1> 167<table class="table-striped caption-top table"> 168<thead> 169<tr class="header"> 170<th>Course</th> 171<th>Level</th> 172<th style="text-align: center;"></th> 173</tr> 174</thead> 175<tbody> 176<tr class="odd"> 177<td>Applied Economics Issues</td> 178<td>Master (2nd year)</td> 179<td style="text-align: center;"><a href="Teaching/Applied-economics/index.html" class="resource-chip"><i class="fa-solid fa-arrow-right" aria-label="arrow-right"></i> Go to course</a></td> 180</tr> 181<tr class="even"> 182<td>Data Visualisation with R</td> 183<td>Master (2nd year)</td> 184<td style="text-align: center;"><a href="Teaching/Dataviz/index.html" class="resource-chip"><i class="fa-solid fa-arrow-right" aria-label="arrow-right"></i> Go to course</a></td> 185</tr> 186<tr class="odd"> 187<td>Introduction to programming for data analysis (with R)</td> 188<td>Master (1st year)</td> 189<td style="text-align: center;"><a href="Teaching/Intro-R/index.html" class="resource-chip"><i class="fa-solid fa-arrow-right" aria-label="arrow-right"></i> Go to course</a></td> 190</tr> 191<tr class="even"> 192<td>Probability Theory</td> 193<td>Undergraduate (L3)</td> 194<td style="text-align: center;"><a href="Teaching/Probability/index.html" class="resource-chip"><i class="fa-solid fa-arrow-right" aria-label="arrow-right"></i> Go to course</a></td> 195</tr> 196</tbody> 197</table> 198</section> 199<section id="former-courses" class="level1"> 200<h1>Former courses</h1> 201<table class="table-striped caption-top table"> 202<thead> 203<tr class="header"> 204<th>Course</th> 205<th>Level</th> 206<th style="text-align: center;"></th> 207</tr> 208</thead> 209<tbody> 210<tr class="odd"> 211<td>Machine Learning and Statistical Learning</td> 212<td>Master (2nd year)</td> 213<td style="text-align: center;"><a href="Teaching/ML/index.html" class="resource-chip"><i class="fa-solid fa-arrow-right" aria-label="arrow-right"></i> Go to course</a></td> 214</tr> 215<tr class="even"> 216<td>Introduction to programming with R (old course)</td> 217<td>Undergraduate</td> 218<td style="text-align: center;"><a href="Teaching/R/index.html" class="resource-chip"><i class="fa-solid fa-arrow-right" aria-label="arrow-right"></i> Go to course</a></td> 219</tr> 220<tr class="odd"> 221<td>Machine Learning Training</td> 222<td>Summer School</td> 223<td style="text-align: center;"><a href="Enseignement/ML/ECB/" class="resource-chip"><i class="fa-solid fa-arrow-right" aria-label="arrow-right"></i> Go to course</a></td> 224</tr> 225</tbody> 226</table> 227</section> 228<section id="e-books" class="level1"> 229<h1>E-books</h1> 230<table class="table-striped caption-top table"> 231<thead> 232<tr class="header"> 233<th>Title</th> 234<th style="text-align: center;">HTML</th> 235<th style="text-align: center;">PDF</th> 236</tr> 237</thead> 238<tbody> 239<tr class="odd"> 240<td>Notes de cours de R, version 2</td> 241<td style="text-align: center;"><a href="https://egallic.fr/Enseignement/R/Book/avant-propos.html" class="resource-chip"><i class="fa-solid fa-book-atlas" aria-label="book-atlas"></i></a></td> 242<td style="text-align: center;"><a href="https://egallic.fr/Enseignement/R/Book/_main.pdf" class="resource-chip"><i class="fa-solid fa-file-pdf" aria-label="file-pdf"></i></a></td> 243</tr> 244<tr class="even"> 245<td>Python pour les économistes</td> 246<td style="text-align: center;"><a href="http://egallic.fr/Enseignement/Python" class="resource-chip"><i class="fa-solid fa-book-atlas" aria-label="book-atlas"></i></a></td> 247<td style="text-align: center;"><a href="https://egallic.fr/Enseignement/Python/_main.pdf" class="resource-chip"><i class="fa-solid fa-file-pdf" aria-label="file-pdf"></i></a></td> 248</tr> 249<tr class="odd"> 250<td>Python for economists</td> 251<td style="text-align: center;"><a href="https://egallic.fr/Enseignement/Python/en/opening-remarks.html" class="resource-chip"><i class="fa-solid fa-book-atlas" aria-label="book-atlas"></i></a></td> 252<td style="text-align: center;"><a href="https://egallic.fr/Enseignement/Python/en/_main.pdf" class="resource-chip"><i class="fa-solid fa-file-pdf" aria-label="file-pdf"></i></a></td> 253</tr> 254</tbody> 255</table> 256</section> 257<section id="templates" class="level1"> 258<h1>Templates</h1> 259<table class="table-striped caption-top table"> 260<thead> 261<tr class="header"> 262<th>Title</th> 263<th style="text-align: center;">Template</th> 264<th style="text-align: center;">PDF view</th> 265</tr> 266</thead> 267<tbody> 268<tr class="odd"> 269<td>LaTeX template for reports</td> 270<td style="text-align: center;"><a href="https://egallic.fr/Teaching/Templates/amse_report_template.zip" class="resource-chip"><i class="fa-solid fa-file-zipper" aria-label="file-zipper"></i></a></td> 271<td style="text-align: center;"><a href="https://egallic.fr/Teaching/Templates/amse_report_template.pdf" class="resource-chip"><i class="fa-solid fa-file-pdf" aria-label="file-pdf"></i></a></td> 272</tr> 273<tr class="even"> 274<td>MS Word template for reports</td> 275<td style="text-align: center;"><a href="https://egallic.fr/Teaching/Templates/amse_report_template.docx" class="resource-chip"><i class="fa-solid fa-file-word" aria-label="file-word"></i></a></td> 276<td style="text-align: center;"><a href="https://egallic.fr/Teaching/Templates/amse_report_template_word.pdf" class="resource-chip"><i class="fa-solid fa-file-pdf" aria-label="file-pdf"></i></a></td> 277</tr> 278</tbody> 279</table> 280 281 282</section> 283 284</main> <!-- /main -->
285<script id="quarto-html-after-body" type="application/javascript"> 286window.document.addEventListener("DOMContentLoaded", function (event) { 287 const toggleBodyColorMode = (bsSheetEl) => { 288 const mode = bsSheetEl.getAttribute("data-mode"); 289 const bodyEl = window.document.querySelector("body"); 290 if (mode === "dark") { 291 bodyEl.classList.add("quarto-dark"); 292 bodyEl.classList.remove("quarto-light"); 293 } else { 294 bodyEl.classList.add("quarto-light"); 295 bodyEl.classList.remove("quarto-dark"); 296 } 297 } 298 const toggleBodyColorPrimary = () => { 299 const bsSheetEl = window.document.querySelector("link#quarto-bootstrap"); 300 if (bsSheetEl) { 301 toggleBodyColorMode(bsSheetEl); 302 } 303 } 304 toggleBodyColorPrimary(); 305 const disableStylesheet = (stylesheets) => { 306 for (let i=0; i < stylesheets.length; i++) { 307 const stylesheet = stylesheets[i]; 308 stylesheet.rel = 'prefetch'; 309 } 310 } 311 const enableStylesheet = (stylesheets) => { 312 for (let i=0; i < stylesheets.length; i++) { 313 const stylesheet = stylesheets[i]; 314 stylesheet.rel = 'stylesheet'; 315 } 316 } 317 const manageTransitions = (selector, allowTransitions) => { 318 const els = window.document.querySelectorAll(selector); 319 for (let i=0; i < els.length; i++) { 320 const el = els[i]; 321 if (allowTransitions) { 322 el.classList.remove('notransition'); 323 } else { 324 el.classList.add('notransition'); 325 } 326 } 327 } 328 const toggleGiscusIfUsed = (isAlternate, darkModeDefault) => { 329 const baseTheme = document.querySelector('#giscus-base-theme')?.value ?? 'light'; 330 const alternateTheme = document.querySelector('#giscus-alt-theme')?.value ?? 'dark'; 331 let newTheme = ''; 332 if(darkModeDefault) { 333 newTheme = isAlternate ? baseTheme : alternateTheme; 334 } else { 335 newTheme = isAlternate ? alternateTheme : baseTheme; 336 } 337 const changeGiscusTheme = () => { 338 // From: https://github.com/giscus/giscus/issues/336 339 const sendMessage = (message) => { 340 const iframe = document.querySelector('iframe.giscus-frame'); 341 if (!iframe) return; 342 iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app'); 343 } 344 sendMessage({ 345 setConfig: { 346 theme: newTheme 347 } 348 }); 349 } 350 const isGiscussLoaded = window.document.querySelector('iframe.giscus-frame') !== null; 351 if (isGiscussLoaded) { 352 changeGiscusTheme(); 353 } 354 } 355 const toggleColorMode = (alternate) => { 356 // Switch the stylesheets 357 const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate'); 358 manageTransitions('#quarto-margin-sidebar .nav-link', false); 359 if (alternate) { 360 enableStylesheet(alternateStylesheets); 361 for (const sheetNode of alternateStylesheets) { 362 if (sheetNode.id === "quarto-bootstrap") { 363 toggleBodyColorMode(sheetNode); 364 } 365 } 366 } else { 367 disableStylesheet(alternateStylesheets); 368 toggleBodyColorPrimary(); 369 } 370 manageTransitions('#quarto-margin-sidebar .nav-link', true); 371 // Switch the toggles 372 const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle'); 373 for (let i=0; i < toggles.length; i++) { 374 const toggle = toggles[i]; 375 if (toggle) { 376 if (alternate) { 377 toggle.classList.add("alternate"); 378 } else { 379 toggle.classList.remove("alternate"); 380 } 381 } 382 } 383 // Hack to workaround the fact that safari doesn't 384 // properly recolor the scrollbar when toggling (#1455) 385 if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) { 386 manageTransitions("body", false); 387 window.scrollTo(0, 1); 388 setTimeout(() => { 389 window.scrollTo(0, 0); 390 manageTransitions("body", true); 391 }, 40); 392 } 393 } 394 const isFileUrl = () => { 395 return window.location.protocol === 'file:'; 396 } 397 const hasAlternateSentinel = () => { 398 let styleSentinel = getColorSchemeSentinel(); 399 if (styleSentinel !== null) { 400 return styleSentinel === "alternate"; 401 } else { 402 return false;
403 } 404 } 405 const setStyleSentinel = (alternate) => { 406 const value = alternate ? "alternate" : "default"; 407 if (!isFileUrl()) { 408 window.localStorage.setItem("quarto-color-scheme", value); 409 } else { 410 localAlternateSentinel = value; 411 } 412 } 413 const getColorSchemeSentinel = () => { 414 if (!isFileUrl()) { 415 const storageValue = window.localStorage.getItem("quarto-color-scheme"); 416 return storageValue != null ? storageValue : localAlternateSentinel; 417 } else { 418 return localAlternateSentinel; 419 } 420 } 421 const darkModeDefault = false; 422 let localAlternateSentinel = darkModeDefault ? 'alternate' : 'default'; 423 // Dark / light mode switch 424 window.quartoToggleColorScheme = () => { 425 // Read the current dark / light value 426 let toAlternate = !hasAlternateSentinel(); 427 toggleColorMode(toAlternate); 428 setStyleSentinel(toAlternate); 429 toggleGiscusIfUsed(toAlternate, darkModeDefault); 430 }; 431 // Ensure there is a toggle, if there isn't float one in the top right 432 if (window.document.querySelector('.quarto-color-scheme-toggle') === null) { 433 const a = window.document.createElement('a'); 434 a.classList.add('top-right'); 435 a.classList.add('quarto-color-scheme-toggle'); 436 a.href = ""; 437 a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; }; 438 const i = window.document.createElement("i"); 439 i.classList.add('bi'); 440 a.appendChild(i); 441 window.document.body.appendChild(a); 442 } 443 // Switch to dark mode if need be 444 if (hasAlternateSentinel()) { 445 toggleColorMode(true); 446 } else { 447 toggleColorMode(false); 448 } 449 const icon = "î§"; 450 const anchorJS = new window.AnchorJS(); 451 anchorJS.options = { 452 placement: 'right', 453 icon: icon 454 }; 455 anchorJS.add('.anchored'); 456 const isCodeAnnotation = (el) => { 457 for (const clz of el.classList) { 458 if (clz.startsWith('code-annotation-')) { 459 return true; 460 } 461 } 462 return false; 463 } 464 const onCopySuccess = function(e) { 465 // button target 466 const button = e.trigger; 467 // don't keep focus 468 button.blur(); 469 // flash "checked" 470 button.classList.add('code-copy-button-checked'); 471 var currentTitle = button.getAttribute("title"); 472 button.setAttribute("title", "Copied!"); 473 let tooltip; 474 if (window.bootstrap) { 475 button.setAttribute("data-bs-toggle", "tooltip"); 476 button.setAttribute("data-bs-placement", "left"); 477 button.setAttribute("data-bs-title", "Copied!"); 478 tooltip = new bootstrap.Tooltip(button, 479 { trigger: "manual", 480 customClass: "code-copy-button-tooltip", 481 offset: [0, -8]}); 482 tooltip.show(); 483 } 484 setTimeout(function() { 485 if (tooltip) { 486 tooltip.hide(); 487 button.removeAttribute("data-bs-title"); 488 button.removeAttribute("data-bs-toggle"); 489 button.removeAttribute("data-bs-placement"); 490 } 491 button.setAttribute("title", currentTitle); 492 button.classList.remove('code-copy-button-checked'); 493 }, 1000); 494 // clear code selection 495 e.clearSelection(); 496 } 497 const getTextToCopy = function(trigger) { 498 const codeEl = trigger.previousElementSibling.cloneNode(true); 499 for (const childEl of codeEl.children) { 500 if (isCodeAnnotation(childEl)) { 501 childEl.remove(); 502 } 503 } 504 return codeEl.innerText; 505 } 506 const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', { 507 text: getTextToCopy 508 }); 509 clipboard.on('success', onCopySuccess); 510 if (window.document.getElementById('quarto-embedded-source-code-modal')) { 511 const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', { 512 text: getTextToCopy, 513 container: window.document.getElementById('quarto-embedded-source-code-modal') 514 }); 515 clipboardModal.on('success', onCopySuccess); 516 } 517 var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//); 518 var mailtoRegex = new RegExp(/^mailto:/); 519 var filterRegex = new RegExp('/' + window.location.host + '/'); 520 var isInternal = (href) => { 521 return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href); 522 } 523 // Inspect non-navigation links and adorn them if external 524 var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)'); 525 for (var i=0; i<links.length; i++) { 526 const link = links[i]; 527 if (!isInternal(link.href)) { 528 // undo the damage that might have been done by quarto-nav.js in the case of 529 // links that we want to consider external 530 if (link.dataset.originalHref !== undefined) { 531 link.href = link.dataset.originalHref; 532 } 533 } 534 } 535 function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) { 536 const config = { 537 allowHTML: true, 538 maxWidth: 500, 539 delay: 100,
540 arrow: false, 541 appendTo: function(el) { 542 return el.parentElement; 543 }, 544 interactive: true, 545 interactiveBorder: 10, 546 theme: 'quarto', 547 placement: 'bottom-start', 548 }; 549 if (contentFn) { 550 config.content = contentFn; 551 } 552 if (onTriggerFn) { 553 config.onTrigger = onTriggerFn; 554 } 555 if (onUntriggerFn) { 556 config.onUntrigger = onUntriggerFn; 557 } 558 window.tippy(el, config); 559 } 560 const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]'); 561 for (var i=0; i<noterefs.length; i++) { 562 const ref = noterefs[i]; 563 tippyHover(ref, function() { 564 // use id or data attribute instead here 565 let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href'); 566 try { href = new URL(href).hash; } catch {} 567 const id = href.replace(/^#\/?/, ""); 568 const note = window.document.getElementById(id); 569 if (note) { 570 return note.innerHTML; 571 } else { 572 return ""; 573 } 574 }); 575 } 576 const xrefs = window.document.querySelectorAll('a.quarto-xref'); 577 const processXRef = (id, note) => { 578 // Strip column container classes 579 const stripColumnClz = (el) => { 580 el.classList.remove("page-full", "page-columns"); 581 if (el.children) { 582 for (const child of el.children) { 583 stripColumnClz(child); 584 } 585 } 586 } 587 stripColumnClz(note) 588 if (id === null || id.startsWith('sec-')) { 589 // Special case sections, only their first couple elements 590 const container = document.createElement("div"); 591 if (note.children && note.children.length > 2) { 592 container.appendChild(note.children[0].cloneNode(true)); 593 for (let i = 1; i < note.children.length; i++) { 594 const child = note.children[i]; 595 if (child.tagName === "P" && child.innerText === "") { 596 continue; 597 } else { 598 container.appendChild(child.cloneNode(true)); 599 break; 600 } 601 } 602 if (window.Quarto?.typesetMath) { 603 window.Quarto.typesetMath(container); 604 } 605 return container.innerHTML 606 } else { 607 if (window.Quarto?.typesetMath) { 608 window.Quarto.typesetMath(note); 609 } 610 return note.innerHTML; 611 } 612 } else { 613 // Remove any anchor links if they are present 614 const anchorLink = note.querySelector('a.anchorjs-link'); 615 if (anchorLink) { 616 anchorLink.remove(); 617 } 618 if (window.Quarto?.typesetMath) { 619 window.Quarto.typesetMath(note); 620 } 621 if (note.classList.contains("callout")) { 622 return note.outerHTML; 623 } else { 624 return note.innerHTML; 625 } 626 } 627 } 628 for (var i=0; i<xrefs.length; i++) { 629 const xref = xrefs[i]; 630 tippyHover(xref, undefined, function(instance) { 631 instance.disable(); 632 let url = xref.getAttribute('href'); 633 let hash = undefined; 634 if (url.startsWith('#')) { 635 hash = url; 636 } else { 637 try { hash = new URL(url).hash; } catch {} 638 } 639 if (hash) { 640 const id = hash.replace(/^#\/?/, ""); 641 const note = window.document.getElementById(id); 642 if (note !== null) { 643 try { 644 const html = processXRef(id, note.cloneNode(true)); 645 instance.setContent(html); 646 } finally { 647 instance.enable(); 648 instance.show(); 649 } 650 } else { 651 // See if we can fetch this 652 fetch(url.split('#')[0]) 653 .then(res => res.text()) 654 .then(html => { 655 const parser = new DOMParser(); 656 const htmlDoc = parser.parseFromString(html, "text/html"); 657 const note = htmlDoc.getElementById(id); 658 if (note !== null) { 659 const html = processXRef(id, note); 660 instance.setContent(html); 661 } 662 }).finally(() => { 663 instance.enable(); 664 instance.show(); 665 }); 666 } 667 } else { 668 // See if we can fetch a full url (with no hash to target)
669 // This is a special case and we should probably do some content thinning / targeting 670 fetch(url) 671 .then(res => res.text()) 672 .then(html => { 673 const parser = new DOMParser(); 674 const htmlDoc = parser.parseFromString(html, "text/html"); 675 const note = htmlDoc.querySelector('main.content'); 676 if (note !== null) { 677 // This should only happen for chapter cross references 678 // (since there is no id in the URL) 679 // remove the first header 680 if (note.children.length > 0 && note.children[0].tagName === "HEADER") { 681 note.children[0].remove(); 682 } 683 const html = processXRef(null, note); 684 instance.setContent(html); 685 } 686 }).finally(() => { 687 instance.enable(); 688 instance.show(); 689 }); 690 } 691 }, function(instance) { 692 }); 693 } 694 let selectedAnnoteEl; 695 const selectorForAnnotation = ( cell, annotation) => { 696 let cellAttr = 'data-code-cell="' + cell + '"'; 697 let lineAttr = 'data-code-annotation="' + annotation + '"'; 698 const selector = 'span[' + cellAttr + '][' + lineAttr + ']'; 699 return selector; 700 } 701 const selectCodeLines = (annoteEl) => { 702 const doc = window.document; 703 const targetCell = annoteEl.getAttribute("data-target-cell"); 704 const targetAnnotation = annoteEl.getAttribute("data-target-annotation"); 705 const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation)); 706 const lines = annoteSpan.getAttribute("data-code-lines").split(","); 707 const lineIds = lines.map((line) => { 708 return targetCell + "-" + line; 709 }) 710 let top = null; 711 let height = null; 712 let parent = null; 713 if (lineIds.length > 0) { 714 //compute the position of the single el (top and bottom and make a div) 715 const el = window.document.getElementById(lineIds[0]); 716 top = el.offsetTop; 717 height = el.offsetHeight; 718 parent = el.parentElement.parentElement; 719 if (lineIds.length > 1) { 720 const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]); 721 const bottom = lastEl.offsetTop + lastEl.offsetHeight; 722 height = bottom - top; 723 } 724 if (top !== null && height !== null && parent !== null) { 725 // cook up a div (if necessary) and position it 726 let div = window.document.getElementById("code-annotation-line-highlight"); 727 if (div === null) { 728 div = window.document.createElement("div"); 729 div.setAttribute("id", "code-annotation-line-highlight"); 730 div.style.position = 'absolute'; 731 parent.appendChild(div); 732 } 733 div.style.top = top - 2 + "px"; 734 div.style.height = height + 4 + "px"; 735 div.style.left = 0; 736 let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter"); 737 if (gutterDiv === null) { 738 gutterDiv = window.document.createElement("div"); 739 gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter"); 740 gutterDiv.style.position = 'absolute'; 741 const codeCell = window.document.getElementById(targetCell); 742 const gutter = codeCell.querySelector('.code-annotation-gutter'); 743 gutter.appendChild(gutterDiv); 744 } 745 gutterDiv.style.top = top - 2 + "px"; 746 gutterDiv.style.height = height + 4 + "px"; 747 } 748 selectedAnnoteEl = annoteEl; 749 } 750 }; 751 const unselectCodeLines = () => { 752 const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"]; 753 elementsIds.forEach((elId) => { 754 const div = window.document.getElementById(elId); 755 if (div) { 756 div.remove(); 757 } 758 }); 759 selectedAnnoteEl = undefined; 760 }; 761 // Handle positioning of the toggle 762 window.addEventListener( 763 "resize", 764 throttle(() => { 765 elRect = undefined; 766 if (selectedAnnoteEl) { 767 selectCodeLines(selectedAnnoteEl); 768 } 769 }, 10) 770 ); 771 function throttle(fn, ms) { 772 let throttle = false;
773 let timer; 774 return (...args) => { 775 if(!throttle) { // first call gets through 776 fn.apply(this, args); 777 throttle = true; 778 } else { // all the others get throttled 779 if(timer) clearTimeout(timer); // cancel #2 780 timer = setTimeout(() => { 781 fn.apply(this, args); 782 timer = throttle = false; 783 }, ms); 784 } 785 }; 786 } 787 // Attach click handler to the DT 788 const annoteDls = window.document.querySelectorAll('dt[data-target-cell]'); 789 for (const annoteDlNode of annoteDls) { 790 annoteDlNode.addEventListener('click', (event) => { 791 const clickedEl = event.target; 792 if (clickedEl !== selectedAnnoteEl) { 793 unselectCodeLines(); 794 const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active'); 795 if (activeEl) { 796 activeEl.classList.remove('code-annotation-active'); 797 } 798 selectCodeLines(clickedEl); 799 clickedEl.classList.add('code-annotation-active'); 800 } else { 801 // Unselect the line 802 unselectCodeLines(); 803 clickedEl.classList.remove('code-annotation-active'); 804 } 805 }); 806 } 807 const findCites = (el) => { 808 const parentEl = el.parentElement; 809 if (parentEl) { 810 const cites = parentEl.dataset.cites; 811 if (cites) { 812 return { 813 el, 814 cites: cites.split(' ') 815 }; 816 } else { 817 return findCites(el.parentElement) 818 } 819 } else { 820 return undefined; 821 } 822 }; 823 var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]'); 824 for (var i=0; i<bibliorefs.length; i++) { 825 const ref = bibliorefs[i]; 826 const citeInfo = findCites(ref); 827 if (citeInfo) { 828 tippyHover(citeInfo.el, function() { 829 var popup = window.document.createElement('div'); 830 citeInfo.cites.forEach(function(cite) { 831 var citeDiv = window.document.createElement('div'); 832 citeDiv.classList.add('hanging-indent'); 833 citeDiv.classList.add('csl-entry'); 834 var biblioDiv = window.document.getElementById('ref-' + cite); 835 if (biblioDiv) { 836 citeDiv.innerHTML = biblioDiv.innerHTML; 837 } 838 popup.appendChild(citeDiv); 839 }); 840 return popup.innerHTML; 841 }); 842 } 843 } 844}); 845</script>
845 846</div> <!-- /content --> 847 848 849 850 851</body></html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.