From 57cb9a24716d1094c4fc3cb491eec296d7a1dc0d Mon Sep 17 00:00:00 2001 From: Cat Flynn Date: Sat, 26 Oct 2024 01:03:20 +0100 Subject: [PATCH] isaac fix url --- blogs/isaac.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ build/index.py | 40 ++++++++++++++++++------------- build/rss.py | 17 ++++++++++---- makefile | 6 ++--- 4 files changed, 102 insertions(+), 25 deletions(-) create mode 100644 blogs/isaac.md diff --git a/blogs/isaac.md b/blogs/isaac.md new file mode 100644 index 0000000..8210cbd --- /dev/null +++ b/blogs/isaac.md @@ -0,0 +1,64 @@ +--- +created: 2024-08-22T17:43:52+01:00 +modified: 2024-08-22T17:45:52+01:00 +--- + +# Isaac + +"Thank you, and if I could just confirm your type?" + +"O negative." + +"And lastly, how much were you looking to provide this evening, sir?" + +"One-point-two litres." + +"Very good. if you'll just wait a moment..." + +Isaac let his eyes wander as the clerk busied herself with the terminal. It wasn't the worst waiting lounge he'd seen, all of the lights were working and the chairs seemed unsoiled. Donors sat dotted around, largely occupying themselves with their personal devices or reading material. Mostly younger than himself, he noted idly. One or two of the older folk weren't reading but gazing, glassy-eyed ahead of them. There was no conversation. + +"Thank you for your patience, sir," he focused again on the clerk, "we can exchange 17,205 credits for that volume." + +"Seventeen thousand? It was twenty just last month!" + +"I'm afraid I can't control the price, sir. If you'd like, I can increase the volume to twenty thousand credits." + +"I-", Isaac closed his eyes and bowed his head a little. He breathed out. "No. No thank you, 17 thousand is fine." + +"Excellent. That's all gone through, your number is four-thirteen. If you'd like to take a seat a technician will call you when they're ready." + +"Thank you." + +It was still be enough. Annoying, but not disastrous. He took a seat against the wall, and looked down at the magazines on the low table in front of him. He picked up one with a smiling cocktail-wielding woman in a swimsuit on the front, and started idly leafing through pictures and descriptions of exotic package holidays, each more breathlessly unique and enticing than the last. No prices, he noted. They each implored the reader to book a consultation call. + +He'd dozed off by the time his number was called, and came to with a start. Waving to acknowledge his technician at the front of the room, he got to his feet. His momentarily forgotten magazine slipped off his legs and fell onto the floor in a clumsy heap as he stood. He let out a little grunt of exertion as he bent to pick up and replace it upon the table, and started to make his way over to the tech. As he neared, they turned on a heel and started down the corridor behind them. Isaac didn't mind the efficiency; time spent on pleasantries would only eat into the price more. + +Turning to follow the tech into a room some distance down the corridor, he found another tech adjusting the chair in the middle. + +"You can hang your coat by the door", she said tersely, gesturing over his shoulder. + +"Thanks," he did so and she turned away wordlessly, busying herself with some equipment on the bench at the side of the room. The tech he'd followed from the lounge was replacing their gloves. Not needing more instructions, he set himself down in the central chair and rolled up his right sleeve. His left was still bruised from the week before. The freshly-gloved tech turned back round to him, now clutching a needle. + +"Are you comfortable?" they asked, and started to swab his arm without waiting for an answer. He didn't give one, and they continued in silence. "You'll feel a sharp prick," and he did, though he saw nothing as he'd already averted his gaze. + +He bit thoughtfully into the recovery cookie as he stepped out of the clinic and onto the street. He'd usually not have bothered, but the clerk had explained they were complementary at this clinic as she transferred his funds. It hardly made up for the poor take, but silver linings he supposed. He stood and ate the whole thing before starting on his way, wary that walking would drive his heart rate up. Nonetheless, so would standing, and they charged extra for recovery chairs. He tried not to look at the figure slumped against the clinic's façade and set off, slowly, for the metro. + +He leaned against a pillar on the platform when he arrived and closed his eyes, breathing deeply and slowly. He wished they hadn't removed the benches the previous year, but dared not seat himself on the platform floor. He couldn't afford a loitering charge, and so steeled himself against the pillar with gritted teeth, listening for the sounds of an approaching train. He hoped it wouldn't be full. + +What must have been minutes felt like hours, but eventually the rails began to sing and he opened his eyes to the welcoming illumination of the front car's headlights on the slick tunnel walls. He watched it pull in, with its mercifully off-peak complement of passengers, and waited for the last moment to push himself from his pillar and made his way to the nearest door. It opened before him - he'd timed it perfectly not to break step - he collapsed into a chair just as the doors closed. He let out a sigh of relief and the train began to move. + +Lights on the inside of the tunnel wall flicked by hypnotically as the train rattled onwards. Isaac looked instead at the adverts above and below the windows, trying to keep his focus engaged and his mind off his light-headedness. A pair of smiling pensioners gleamed down at him from a particularly colourful spread. "Try plasma today," read the tagline "after all, age is just a number!". Annie and Joe, read the advert, gave a testimonial of celebrating their fifteenth decade together. He imagined them speaking animatedly to an agent about one of the holidays in the magazine. "Why, of course!" Annie would exclaim, "we wouldn't dream of missing Istanbul!". Joe is quieter, Isaac imagined, but smiles and nods along with his partner. They hold hands under the table as the agent successfully upsells them city tour after city tour. Age is just a number, Isaac thought, much like a bank balance. With that, he promptly passed out. + +The train was stopped when he was prodded awake by the guard. + +"End of the line, sir," he said unhelpfully, "train's going out of service." + +"Eugh..." groaned Isaac as he righted himself. He felt a bit better for having slept, but his neck was stiff and his mouth dry. "Thanks," he rasped to the guard, who took a step away but remained watching him, clearly awaiting Isaac's departure. Isaac pulled himself up with the help of a pole, and noticed only then the breeze on his feet. He looked down, and saw his own socked feet. His boots were nowhere to be seen. "Aw, fuck. My shoes..." The guard remained stalwart and unmoved, volunteering nothing in the way of aid. Isaac looked both ways along the train, but there was no one else. He looked back at the guard, hoping for a sign of compassion, perhaps, but received only a nod towards the open door. The platform outside was wet. + +He made his way out of the station and looked over at the bus stop, which held neither buses nor awaiting passengers. He fished for his phone in his coat pocket. What had been idle frustration at losing his shoes rapidly escalated into blind panic; his phone wasn't there either. He tried his other pockets, but quickly gave up, it was gone. He swore, with feeling this time, and stamped his sodden socked feet in a puddle. A teller in the station looked up momentarily to raise an eyebrow in Isaac's direction, but went back to closing up almost immediately. Isaac calmed down, defeated, and studied the map out the front of the station. It was a long way home from here. + +He'd all but fallen asleep on his feet as he dragged himself up the stairs to his unit. The lock was biometric, thankfully - too far from the city centre to be integrated into the phone network - and he let himself in, closing the curtains against the rising sun. He had a shower, grateful to be free of his now ruined socks, and fell, finally, comfortably asleep. + +He allowed himself a lie-in the following morning. It was his weekend, and it was past noon when he finally rose. After breakfast he poured himself a cup of coffee and turned his attention back to the papers scattered over the kitchen, where they'd been before he'd left the previous morning. He sighed, and scribbled a few new numbers into a notepad. He dug out his spare phone - a horrid, ancient thing - and went through the online process of activating it with his details. At least the stolen phone wouldn't compromise him - these things were pretty secure now, and it would have wiped itself as soon as someone failed the biometric checks. The spare came to life with a sickly chime, which he made a note to disable later. First, though, he punched what had become a familiar number. + +"Hi, good afternoon... yes... yes.. next weekend would be fine... One-point-three litres, please..." diff --git a/build/index.py b/build/index.py index 8003ad8..bca84b4 100644 --- a/build/index.py +++ b/build/index.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# should this operate on the same basic files as the rss script? + import sys import re @@ -22,33 +24,39 @@ dir_pattern = re.compile("(.+)\/(\d{4}\/\d+\/\d+\/.+\.html)") path_pattern = re.compile("(.+)\/(\d{4})\/(\d{1,2})\/(\d{1,2})\/(.+).html") title_pattern = re.compile("

(.+)

") -# filter posts to just those with a date in them -posts = [p for p in posts if path_pattern.match(p)] posts.reverse() links = [] # for each file we want to output an tag with a relative href to the site root for path in posts: + m = re.match(path_pattern, path) - year = m.group(2) - month = m.group(3).rjust(2, '0') - day = m.group(4).rjust(2, '0') + if not m: + # path/to/file.ext -> file + title = path.split('/')[-1].split(".")[0] - date = f'' + date = f'' + url = path.split("/")[-1] - title = "" - with open(path) as f: - for line in f: - if title_pattern.match(line): - title = re.sub(title_pattern, r'\1', line).strip() - break + else: + year = m.group(2) + month = m.group(3).rjust(2, '0') + day = m.group(4).rjust(2, '0') - # clean leading directories to get the relative path we'll use for the link - url = re.sub(dir_pattern, r"\2", path) - url = f"blog/{url}" + date = f'' - item = (date, f'
  • {date}{title}
  • ') + title = "" + with open(path) as f: + for line in f: + if title_pattern.match(line): + title = re.sub(title_pattern, r'\1', line).strip() + break + + # clean leading directories to get the relative path we'll use for the link + url = re.sub(dir_pattern, r"\2", path) + + item = (date, f'
  • {date}{title}
  • ') links.append(item) # make sure we're properly ordered in reverse date order lol diff --git a/build/rss.py b/build/rss.py index 1405fa1..92d8a6a 100644 --- a/build/rss.py +++ b/build/rss.py @@ -4,6 +4,7 @@ import markdown import pathlib import sys import re +from datetime import datetime def print_usage(): print("\nusage: python mkblogrss.py POSTS\n") @@ -43,9 +44,12 @@ def make_item(path): html = markdown.markdown(text, extensions=["fenced_code"]) # title - title = "" + title = None m = title_pattern.match(html) - title = m.group(1) + if m is None: + title = path.split('/')[-1] + else: + title = m.group(1) str += f"{title}\n" # link @@ -60,10 +64,13 @@ def make_item(path): description = re.sub('>', '>', description) str += f"{description}\n" - # pub date - date = re.sub(path_pattern, r'\2-\3-\4', path) - str += f"{date}\n" + # does the path have a date in it + if (path_pattern.match(path)): + date = re.sub(path_pattern, r'\2-\3-\4', path) + else: + date = datetime.now() + str += f"{date}\n" str += "" return str diff --git a/makefile b/makefile index 0764d9c..cd27561 100644 --- a/makefile +++ b/makefile @@ -4,9 +4,7 @@ HTML_DIR = $(OUT_DIR)html GEMINI_DIR = $(OUT_DIR)gemini MAKE_GEMINI = build/markdown2gemini.py -MAKE_HTML = build/page.py MAKE_RSS = build/rss.py -MAKE_HTML_INDEX = build/index.py PAGES = $(shell find $(SRC_DIR) -wholename "$(BLOG_SRC_DIR)*.md") @@ -24,13 +22,13 @@ IMAGE_TARGETS = $(PNG_TARGETS) $(JPG_TARGETS) _dummy := $(shell mkdir -p $(HTML_DIR) $(GEMINI_DIR)) $(HTML_DIR)/%.html: $(SRC_DIR)/%.md - pipenv run python $(MAKE_HTML) $< $@ + pipenv run python build/page.py $< $@ $(HTML_RSS): $(PAGES) pipenv run python $(MAKE_RSS) $(PAGES) > $@ $(HTML_INDEX): $(HTML_TARGETS) - pipenv run python $(MAKE_HTML_INDEX) $(HTML_TARGETS) > $@ + pipenv run python build/index.py $(HTML_TARGETS) > $@ $(HTML_DIR)/%.png: $(SRC_DIR)/%.png mkdir -p $(shell dirname $@)