HTMLize code study files
task id: htmlize-codestudy-files2024-06-19 15:34: How does sourcehut handle source code highlighting #htmlize-codestudy-files #timelog:00:51:30
2024-06-21 16:40: Attempts to study sourcehut CSS again #htmlize-codestudy-files #timelog:00:15:59
2024-06-21 16:46: Ha, okay I managed to make it go. Magic! #htmlize-codestudy-files
2024-06-21 16:53: Did some clean-up. I now need to start pre-planning htmlization #htmlize-codestudy-files
2024-06-21 16:55: Re-familiarizing myself with the schemas used here. #htmlize-codestudy-files
What does the schema look like? What kind of information does it have? How do file names get translated into things "seen" by dagzet? How to make sure file range links go to the right place? All this and more... later...
2024-06-23 15:50: Making decisions on file design #htmlize-codestudy-files #timelog:00:15:11
Files are stored in dz_textfiles
.
Files given some sort of path, which can be analogous to a dagzet namespace URL. I'd probably opt to replace things like periods with underscores though.
Take something like codestudy/potential/mag_sign.cpp
, that could a page called codestudy/potential/mag_sign_cpp
. Some assumptions could be made that codestudy/potential
would already exist and that mag_sign_cpp
wouldn't be a pre-existing node.
A janet function could be written to generate the appropriate HTML given a file path. This could then be called using inline Janet, which could then be created procedurally using a script.
2024-06-23 16:05: Bottoms-up: create initial render page. #htmlize-codestudy-files
Gosh there's so friction getting this to work cuz everything is so connected. I wanted to just write Janet code, but I needed other things, so I put it inside a placeholder org file and ran parse, but the CSS parse path is wrong.
2024-06-23 16:37: We're going to need to re-work the HTML generator in weewiki.janet #htmlize-codestudy-files #timelog:00:32:04
I need to point to a brand new CSS file. Overwriting the usual one isn't going to work. Stopping for now because this will require fresh thinking.
2024-06-24 08:30: It would be great to get this done this week #htmlize-codestudy-files
I think this is a very important aspect.
2024-06-25 10:02: Initial refactoring attempt of my weewiki system #htmlize-codestudy-files #timelog:01:04:09
Basically, there are default header/footer functions for HTML pages. I need to rework this so that the dagzet files use their own custom header/footer functions.
Does weewiki store the current page name somewhere? Yes, it's ww-name
.
I'm going with global mutable state, because that's ultimately going to be easier.
Oh boy, this is tricky. By the time the Org gets parsed, the headers/footers are already set up. This means I can't actually disable the templates from the Org file itself. It needs to come from a lower level.
I can add the files to a list, but that's error prone.
Okay, files are going to have the "dzfiles" or perhaps "dzf" extension for terseness. So for example, a file called codestudy/potential/mag_sign.rs
would have a prefix of dzf/codestudy/potential/mag_sign.rs
. My weewiki server would then be able to filter those pages and disable templates entirely. So far this is the best hack I got.
testing out hacky idea
Initial idea working. I'll need to inject the rest of the HTML next.
2024-06-26 15:45: Re-acquainting myself with last progress. Final remaining bits with any luck #htmlize-codestudy-files #timelog:00:23:06
2024-06-26 16:05: The CSS works, now the links need to be hooked up into the HTMLized output #htmlize-codestudy-files #timelog:00:15:43
2024-06-26 16:22: Test it out on website. #htmlize-codestudy-files #timelog:00:18:43
Initial extraction and studies in
scratch/lines_css/
.