Skip to content

Commit

Permalink
render with recent Quarto version
Browse files Browse the repository at this point in the history
  • Loading branch information
drganghe committed Oct 19, 2023
1 parent 0087c24 commit 418e594
Show file tree
Hide file tree
Showing 55 changed files with 2,995 additions and 2,186 deletions.
4 changes: 4 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ project:
type: website
output-dir: docs

# Meta
description-meta: "An open course on energy systems analysis developed by Dr. Gang He, covering topics including: energy systems overview; make sense of energy numbers; energy project economics; energy sources and technologies; energy demand; energy, environment, and human health; energy and climate change; power system analysis; energy transition; energy efficiency; behavior, and sustainable consumption; energy poverty, access, and justice; big data and AI for clean energy; limitations of models; and other emerging topics for the energy systems; and real world energy assignments. Other key words: energy system analysis, energy course, energy class, open course."
author-meta: "Gang He"

website:
title: "Energy Systems Analysis"
description: "An open course on energy systems analysis developed by Dr. Gang He, covering topics including: energy systems overview; make sense of energy numbers; energy project economics; energy sources and technologies; energy demand; energy, environment, and human health; energy and climate change; power system analysis; energy transition; energy efficiency; behavior, and sustainable consumption; energy poverty, access, and justice; big data and AI for clean energy; limitations of models; and other emerging topics for the energy systems; and real world energy assignments. Other key words: energy system analysis, energy course, energy class, open course."
Expand Down
2 changes: 1 addition & 1 deletion assignments/hw0.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Homework 0 IRA emission reduction assessment
description-meta: "{{< meta website.description >}}"
#description-meta: "{{< meta website.description >}}"
#aliases:
# - /homeworks/hw0.html
format:
Expand Down
2 changes: 1 addition & 1 deletion assignments/hw1.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Homework 1 Air quality in China and India
description-meta: "{{< meta website.description >}}"
#description-meta: "{{< meta website.description >}}"
#aliases:
# - /homeworks/hw1.html
format:
Expand Down
2 changes: 1 addition & 1 deletion assignments/hw2.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Homework 2 Energy project economics
description-meta: "{{< meta website.description >}}"
#description-meta: "{{< meta website.description >}}"
#aliases:
# - /homeworks/hw2.html
#draft: true
Expand Down
2 changes: 1 addition & 1 deletion assignments/hw3.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Homework 3 Energy technology and impacts
description-meta: "{{< meta website.description >}}"
#description-meta: "{{< meta website.description >}}"
#aliases:
# - /homeworks/hw3.html
#draft: true
Expand Down
2 changes: 1 addition & 1 deletion assignments/hw4.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Homework 4 Load forecast, energy justice
description-meta: "{{< meta website.description >}}"
#description-meta: "{{< meta website.description >}}"
#draft: true
format:
html:
Expand Down
65 changes: 59 additions & 6 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.4.330">
<meta name="generator" content="quarto-1.4.415">

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

<meta name="author" content="Gang He">
<meta name="description" content="An open course on energy systems analysis developed by Dr.&nbsp;Gang He, covering topics including: energy systems overview; make sense of energy numbers; energy project economics; energy sources and technologies; energy demand; energy, environment, and human health; energy and climate change; power system analysis; energy transition; energy efficiency; behavior, and sustainable consumption; energy poverty, access, and justice; big data and AI for clean energy; limitations of models; and other emerging topics for the energy systems; and real world energy assignments. Other key words: energy system analysis, energy course, energy class, open course.">

<title>Energy Systems Analysis - Page Unplugged</title>
<style>
Expand Down Expand Up @@ -45,7 +47,7 @@
"collapse-after": 3,
"panel-placement": "end",
"type": "textbox",
"limit": 20,
"limit": 50,
"keyboard-shortcut": [
null
],
Expand Down Expand Up @@ -178,6 +180,7 @@ <h1 class="title">Page Unplugged</h1>

</header>


<p>The page you requested cannot be found (perhaps it was unplugged).</p>
<p>You may want to try searching to find the page’s new plug.</p>

Expand Down Expand Up @@ -312,15 +315,38 @@ <h1 class="title">Page Unplugged</h1>
}
}
stripColumnClz(note)
if (id.startsWith('sec-')) {
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
if (id === null || id.startsWith('sec-')) {
// Special case sections, only their first couple elements
const container = document.createElement("div");
if (note.children && note.children.length > 2) {
for (let i = 0; i < 2; i++) {
container.appendChild(note.children[i].cloneNode(true));
}
typesetMath(container);
return container.innerHTML
} else {
typesetMath(note);
return note.innerHTML;
}
} else {
Expand All @@ -329,6 +355,7 @@ <h1 class="title">Page Unplugged</h1>
if (anchorLink) {
anchorLink.remove();
}
typesetMath(note);
return note.innerHTML;
}
}
Expand Down Expand Up @@ -371,6 +398,29 @@ <h1 class="title">Page Unplugged</h1>
instance.show();
});
}
} else {
// See if we can fetch a full url (with no hash to target)
// This is a special case and we should probably do some content thinning / targeting
fetch(url)
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.querySelector('main.content');
if (note !== null) {
// This should only happen for chapter cross references
// (since there is no id in the URL)
// remove the first header
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
note.children[0].remove();
}
const html = processXRef(null, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
}, function(instance) {
});
Expand Down Expand Up @@ -446,7 +496,6 @@ <h1 class="title">Page Unplugged</h1>
window.addEventListener(
"resize",
throttle(() => {
console.log("RESIZE");
elRect = undefined;
if (selectedAnnoteEl) {
selectCodeLines(selectedAnnoteEl);
Expand Down Expand Up @@ -527,17 +576,21 @@ <h1 class="title">Page Unplugged</h1>
}
}
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
var mailtoRegex = new RegExp(/^mailto:/);
var filterRegex = new RegExp("https:\/\/drganghe\.github\.io\/est603-energy-systems-analysis-2022-fall");
var isInternal = (href) => {
return filterRegex.test(href) || localhostRegex.test(href);
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
}
// Inspect non-navigation links and adorn them if external
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):(.quarto-navigation-tool)');
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)');
for (var i=0; i<links.length; i++) {
const link = links[i];
if (!isInternal(link.href)) {
// target, if specified
link.setAttribute("target", "_blank");
if (link.getAttribute("rel") === null) {
link.setAttribute("rel", "noopener");
}
}
}
});
Expand Down
65 changes: 59 additions & 6 deletions docs/assignments.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.4.330">
<meta name="generator" content="quarto-1.4.415">

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

<meta name="author" content="Gang He">
<meta name="description" content="An open course on energy systems analysis developed by Dr.&nbsp;Gang He, covering topics including: energy systems overview; make sense of energy numbers; energy project economics; energy sources and technologies; energy demand; energy, environment, and human health; energy and climate change; power system analysis; energy transition; energy efficiency; behavior, and sustainable consumption; energy poverty, access, and justice; big data and AI for clean energy; limitations of models; and other emerging topics for the energy systems; and real world energy assignments. Other key words: energy system analysis, energy course, energy class, open course.">

<title>Energy Systems Analysis - Assignments</title>
<style>
Expand Down Expand Up @@ -45,7 +47,7 @@
"collapse-after": 3,
"panel-placement": "end",
"type": "textbox",
"limit": 20,
"limit": 50,
"keyboard-shortcut": [
null
],
Expand Down Expand Up @@ -176,6 +178,7 @@ <h1 class="title">Assignments</h1>

</header>


<table class="table">
<thead>
<tr class="header">
Expand Down Expand Up @@ -350,15 +353,38 @@ <h1 class="title">Assignments</h1>
}
}
stripColumnClz(note)
if (id.startsWith('sec-')) {
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
if (id === null || id.startsWith('sec-')) {
// Special case sections, only their first couple elements
const container = document.createElement("div");
if (note.children && note.children.length > 2) {
for (let i = 0; i < 2; i++) {
container.appendChild(note.children[i].cloneNode(true));
}
typesetMath(container);
return container.innerHTML
} else {
typesetMath(note);
return note.innerHTML;
}
} else {
Expand All @@ -367,6 +393,7 @@ <h1 class="title">Assignments</h1>
if (anchorLink) {
anchorLink.remove();
}
typesetMath(note);
return note.innerHTML;
}
}
Expand Down Expand Up @@ -409,6 +436,29 @@ <h1 class="title">Assignments</h1>
instance.show();
});
}
} else {
// See if we can fetch a full url (with no hash to target)
// This is a special case and we should probably do some content thinning / targeting
fetch(url)
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.querySelector('main.content');
if (note !== null) {
// This should only happen for chapter cross references
// (since there is no id in the URL)
// remove the first header
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
note.children[0].remove();
}
const html = processXRef(null, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
}, function(instance) {
});
Expand Down Expand Up @@ -484,7 +534,6 @@ <h1 class="title">Assignments</h1>
window.addEventListener(
"resize",
throttle(() => {
console.log("RESIZE");
elRect = undefined;
if (selectedAnnoteEl) {
selectCodeLines(selectedAnnoteEl);
Expand Down Expand Up @@ -565,17 +614,21 @@ <h1 class="title">Assignments</h1>
}
}
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
var mailtoRegex = new RegExp(/^mailto:/);
var filterRegex = new RegExp("https:\/\/drganghe\.github\.io\/est603-energy-systems-analysis-2022-fall");
var isInternal = (href) => {
return filterRegex.test(href) || localhostRegex.test(href);
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
}
// Inspect non-navigation links and adorn them if external
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):(.quarto-navigation-tool)');
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)');
for (var i=0; i<links.length; i++) {
const link = links[i];
if (!isInternal(link.href)) {
// target, if specified
link.setAttribute("target", "_blank");
if (link.getAttribute("rel") === null) {
link.setAttribute("rel", "noopener");
}
}
}
});
Expand Down

0 comments on commit 418e594

Please sign in to comment.