~e_wizard@TTBP



23 october 2022

Debating whether to use an existing HTML pre-processor or just forge on ahead with Python. So far, using beautifulSoup, I've managed to generate a table of contents automatically, and of course clean up my indenting. It does generate #ids for headings if they don't have their own, but it doesn't work as well for the little blog section on my index. This is all about my Neocities, by the way.

What I want out of a template:

<blogpost>
<htime datetime="2022-10-23" />
<p>Here's a bunch of text</p>
</blogpost>

to render as

<section id="2022-10-23">
  <h3><time datetime="2022-10-23">October 23, 2022</time></h3>
  <!-- or h4, h5, depends on the page -->
  <a href="table-of-contents">Back to top</a>
  <!-- hidden with CSS, only for keyboard navigation -->
  <p>Here's a bunch of text</p>
</section>

Additionally,

<codeblock>
  <summary>Graphing code</summary>
  code goes here
</codeblock>

to render as

<details>
  <summary>Graphing code</summary>
  <pre><code>
code goes here
  </code></pre>
</details>

Is there a semantic reason to use pre? I'm pretty sure I can just slap a class on the code element and be done with it, but if there's a semantic reason I probably shouldn't.