1
0
Fork 0

refactor so that we can make slides now...
Some checks failed
Build Blog / Build (push) Failing after 2m21s

This commit is contained in:
saji 2025-04-12 11:06:19 -05:00
parent eed2412b92
commit ad6ffde972
9 changed files with 225 additions and 9 deletions

View file

@ -33,6 +33,7 @@
<style>{% getBundle "css" %}</style>
{#- Renders the CSS bundle using a separate file, if you can't set CSP directive style-src: 'unsafe-inline' #}
{#- <link rel="stylesheet" href="{% getBundleFileUrl "css" %}"> #}
<link rel="stylesheet" href="{% getBundleFileUrl "css", "defer" %}">
</head>
<body>
<a href="#skip" class="visually-hidden">Skip to main content</a>

View file

@ -0,0 +1,48 @@
<!doctype html>
<html lang="{{ metadata.language}}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>{{ title or metadata.title }}</title>
<meta name="description" content="{{ description or metadata.description }}">
<!--
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/black.css">
<link rel="stylesheet" href="plugin/highlight/monokai.css">
-->
<style>{% getBundle "css" %}</style>
{%- css %}{% include "node_modules/reveal.js/dist/reset.css" %} {% endcss %}
{%- css %}{% include "node_modules/reveal.js/dist/reveal.css" %} {% endcss %}
{%- css %}{% include "node_modules/reveal.js/dist/theme/black.css" %} {% endcss %}
{%- css %}{% include "node_modules/reveal.js/plugin/highlight/monokai.css" %} {% endcss %}
</head>
<body>
<div class="reveal">
<div class="slides">
{{ content | safe }}
</div>
</div>
<script>
{% include "node_modules/reveal.js/dist/reveal.js" %}
{% include "node_modules/reveal.js/plugin/notes/notes.js" %}
</script>
<script src="/revealjs-plugins/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealHighlight, RevealNotes ]
});
</script>
</body>
</html>

View file

@ -2,8 +2,9 @@
layout: layouts/base.njk
---
{# Only include the syntax highlighter CSS on blog posts #}
{%- css %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %}
{%- css %}{% include "public/css/prism-diff.css" %}{%- endcss %}
{%- css "defer" %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %}
{%- css "defer" %}{% include "public/css/prism-diff.css" %}{%- endcss %}
{%- css "defer" %}{% include "node_modules/katex/dist/katex.min.css" %}{% endcss %}
<h1>{{ title }}</h1>
<ul class="post-metadata">

View file

View file

@ -0,0 +1,6 @@
export default {
tags: [
"posts"
],
"layout": "layouts/deck.njk",
};

80
content/decks/test.html Normal file
View file

@ -0,0 +1,80 @@
<section>
<h2>Object (dis)orientation</h2>
<h6> How to survive a "post-OO" world</h6>
</section>
<section>
<section>
Class/Inheritance has challenges
</section>
<section>
Combining Data + Code
<pre><code data-trim data-noescape data-line-numbers="5|7-9">
class MyBase {
protected:
int useless;
public:
virtual void makeSound() = 0;
virtual int get_thing() {
return -1;
};
};
</code></pre>
<p class="fragment">You have to know if this is an "interface", abstract class, or regular class.</p>
<small class="fragment">(it's an abstract class, since <code>makeSound</code> is pure virtual)</small>
</section>
<section>
<p> A class can be one of many things </p>
<ul>
<li>Interface - abstract class with no members, and purely virtual </li>
<li>Abstract Class - class with <em>some</em> pure virtual methods </li>
<li>"Regular" Class - class that is standalone and is fully implemented </li>
</ul>
<small class="fragment">These concepts all exist under the <code>class</code> keyword </small>
</section>
</section>
<section>
In Rust, you trade <em>Inheritance</em> for <em>Traits</em> and <em>Types</em>.
</section>
<section>
<section>
<p>Traits are <em>Interfaces</em></p>
<pre><code data-trim data-noescape>
pub trait Mammal {
fn get_temp(&self) -> i32;
}
</code></pre>
</section>
<section>
<p>... that are explicitly implemented</p>
<pre><code data-trim data-noescape>
pub struct Cat {
age: i32,
outdoor: bool,
}
impl Mammal for Cat {
fn get_temp(&self) -> i32 {
if self.outdoor {
65
} else {
72
}
}
}
</code></pre>
</section>
<section>
<p> And can be used statically <em>or</em> dynamically!</p>
<pre><code data-trim>
fn static_mammal&lt;T: Mammal&gt;(m: T) {
// the type of T must be known at compile time.
}
fn dyn_mammal(m: &dyn Mammal) {
// This uses a vtable to dispatch at runtime.
}
</code></pre>
</section>
</section>

View file

@ -1,5 +1,8 @@
import { DateTime } from "luxon";
import markdownItAnchor from "markdown-it-anchor";
import markdownItAbbr from "markdown-it-abbr/dist/markdown-it-abbr.js";
import markdownItKatex from "@iktakahiro/markdown-it-katex";
import markdownItRevealJs from "./markdown-it-revealjs.js";
import pluginRss from "@11ty/eleventy-plugin-rss";
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
@ -12,7 +15,6 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
import pluginDrafts from "./eleventy.config.drafts.js";
import markdownItAbbr from "markdown-it-abbr/dist/markdown-it-abbr.js";
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
export default async function (eleventyConfig) {
@ -20,7 +22,10 @@ export default async function (eleventyConfig) {
// For example, `./public/css/` ends up in `_site/css/`
eleventyConfig.addPassthroughCopy({
"./public/": "/",
"./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css"
"./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css",
"./node_modules/katex/dist/katex.min.css": "/css/katex.min.css",
"./node_modules/reveal.js/dist/": "/revealjs/",
"./node_modules/reveal.js/plugin/": "/revealjs-plugins/",
});
// Run Eleventy when these files change:
@ -103,8 +108,11 @@ export default async function (eleventyConfig) {
return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1);
});
let mdIt;
// Customize Markdown library settings:
eleventyConfig.amendLibrary("md", mdLib => {
// hack to let us use the markdown renderer for later.
mdIt = mdLib;
mdLib.use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.ariaHidden({
placement: "after",
@ -116,12 +124,17 @@ export default async function (eleventyConfig) {
slugify: eleventyConfig.getFilter("slugify")
});
mdLib.use(markdownItAbbr);
mdLib.use(markdownItKatex);
});
eleventyConfig.addShortcode("currentBuildDate", () => {
return (new Date()).toISOString();
})
//eleventyConfig.addPairedShortcode("section", async (content, transition = "none") => {
// return `<section data-transition=${transition}> ${mdIt.renderInline(content)} </section>`;
//})
// Features to make your build faster (when you need them)
// If your passthrough copy gets heavy and cumbersome, add this line

72
package-lock.json generated
View file

@ -11,7 +11,10 @@
"dependencies": {
"@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-img": "^4.0.2",
"@iktakahiro/markdown-it-katex": "^4.0.1",
"katex": "^0.16.22",
"markdown-it-abbr": "^2.0.0",
"reveal.js": "^5.2.1",
"ttf2woff2": "^6.0.1"
},
"devDependencies": {
@ -373,6 +376,33 @@
"tslib": "^2.4.0"
}
},
"node_modules/@iktakahiro/markdown-it-katex": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@iktakahiro/markdown-it-katex/-/markdown-it-katex-4.0.1.tgz",
"integrity": "sha512-kGFooO7fIOgY34PSG8ZNVsUlKhhNoqhzW2kq94TNGa8COzh73PO4KsEoPOsQVG1mEAe8tg7GqG0FoVao0aMHaw==",
"license": "MIT",
"dependencies": {
"katex": "^0.12.0"
}
},
"node_modules/@iktakahiro/markdown-it-katex/node_modules/commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"license": "MIT"
},
"node_modules/@iktakahiro/markdown-it-katex/node_modules/katex": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/katex/-/katex-0.12.0.tgz",
"integrity": "sha512-y+8btoc/CK70XqcHqjxiGWBOeIL8upbS0peTPXTvgrh21n1RiWWcIpSWM+4uXq+IAgNh9YYQWdc7LVDPDAEEAg==",
"license": "MIT",
"dependencies": {
"commander": "^2.19.0"
},
"bin": {
"katex": "cli.js"
}
},
"node_modules/@img/sharp-darwin-arm64": {
"version": "0.33.5",
"resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz",
@ -1270,12 +1300,12 @@
}
},
"node_modules/commander": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz",
"integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==",
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
"integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
"license": "MIT",
"engines": {
"node": ">=14"
"node": ">= 12"
}
},
"node_modules/concat-map": {
@ -2212,6 +2242,22 @@
"node": ">=0.10.0"
}
},
"node_modules/katex": {
"version": "0.16.22",
"resolved": "https://registry.npmjs.org/katex/-/katex-0.16.22.tgz",
"integrity": "sha512-XCHRdUw4lf3SKBaJe4EvgqIuWwkPSo9XoeO8GjQW94Bp7TWv9hNhzZjZ+OH9yf1UmLygb7DIT5GSFQiyt16zYg==",
"funding": [
"https://opencollective.com/katex",
"https://github.com/sponsors/katex"
],
"license": "MIT",
"dependencies": {
"commander": "^8.3.0"
},
"bin": {
"katex": "cli.js"
}
},
"node_modules/keyv": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
@ -2268,6 +2314,15 @@
"url": "https://opencollective.com/liquidjs"
}
},
"node_modules/liquidjs/node_modules/commander": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz",
"integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==",
"license": "MIT",
"engines": {
"node": ">=14"
}
},
"node_modules/list-to-array": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/list-to-array/-/list-to-array-1.1.0.tgz",
@ -3133,6 +3188,15 @@
"node": ">=0.10.0"
}
},
"node_modules/reveal.js": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/reveal.js/-/reveal.js-5.2.1.tgz",
"integrity": "sha512-r7//6mIM5p34hFiDMvYfXgyjXqGRta+/psd9YtytsgRlrpRzFv4RbH76TXd2qD+7ZPZEbpBDhdRhJaFgfQ7zNQ==",
"license": "MIT",
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/rimraf": {
"version": "5.0.10",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz",

View file

@ -22,7 +22,10 @@
"dependencies": {
"@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-img": "^4.0.2",
"@iktakahiro/markdown-it-katex": "^4.0.1",
"katex": "^0.16.22",
"markdown-it-abbr": "^2.0.0",
"reveal.js": "^5.2.1",
"ttf2woff2": "^6.0.1"
},
"devDependencies": {