Feature Creep 2026, 36 - Multioutput Parser
I want to add another feature to the LaTeX helper that comes from the way that I work with the website. I don't immediately move finished study notes to the website, because usually I have a lot of time and I find the process a little tedious. Instead I wait until I've accumulated several files or a deadline is coming up, and I do everything that's finished in one go. As it is now, I would have to run the script each time per file, or I would have to remember where the images for one file end and where the next one begins, neither of which is a good solution when I have to fight the website builder in between. Instead, I'm going to add another option to the argparser and make it sort the outputs for me. This will slightly change the way I write markdown files as well, which perhaps isn't terrible either. As it is, the filename is just the filename, and it's not included when I copy/paste the thing. However, if I ever want to do the compiled study notes, in which I glue all my notes for a book together into a giant document, it devolves into loose entries. From now on, my study notes should include the markdown header at the top, which I can then use as a delimiter (I'm going to use sub-sub-headers for aesthetic and practical reasons we'll get into) for the parser to slice the inputfile into segments, which will then use the filename to either create subdirectories or name the outputfiles after them, depending on which is easier.
We find the parser block from last week and hack the file into pieces before doing the comprehension
with open(args.inputfile, 'r') as inputfile:
inff = inputfile.read()
first = True
for con in inff.split("###"):
snippets = []
if first:
first = False
continue
title = con.split("\n")[0]
snippets = [con[i] for i in range(1, len(con), 2)]
for s in snippets:
s = "\\begin{align}" + s + "\\end{align}" if not "begin{align}" in s else s
# Call the POST as a function here
The biggest change here is that the post request will have to be called as a function at this point. Currently it's a loose snippet in a for loop. It should then also take the title variable as a parameter. Then, depending on how the new argparse option is flagged, it's used for either a subdir name, or for the outputfile directly.