Have been having a blogging "crisis". I do enjoy blogging (infrequent tho it is), but i hate how everything here is sucked up into a gaping maw of raw capitalism and exploited and used in ways that have nothing to do with my desires or intents. But is the possibility that this blogging is better, for me, for the few people that read the site, is better than the alternative of not blogging? I mean, probably? So maybe it is time to get back to blogging again.
Added markdown parsing to the titles for posts, so a title can have a link... That is not so good for the RSS feed, however, now that i think about it. I will modify the input format to make "link" style titles work for both HTML and RSS. Maybe the last "word" will be regexed to see if it is a valid URL, and if so, put into a specific postUrl value, which can be read by the template... This would mean that URLs could not be titles on their own? or would be linked to themselves? hurm....
% 2023-02-13T14:22:17 My Title http://the.url/that-would/be-regexed/
Oh, turns out, don't use regex for confirming URL-ness. C-Sharp has the nice Uri construct, where i can use:
if(System.Uri.TryCreate(inputText, UriKind.Absolute, out var uriResult))
{
if(uriResult.Scheme == "http" || uriResult.Scheme == "https")
{
// Yep, is a URI
return true;
}
}
Removes the need to markdown-ify the title text, keeps it more flexible, when running the data through the templates.
It occurs to me, with this setup, the RSS feed/view will miss the links in titles, when i have them. Not sure of a way to "fix" that, if it even needs fixing? Ah here is something... I am using the <guid isPermaLink="true"> so that it is the link back to the post, and the <link> item for posts which have a link in the title. Seems to work correctly in NetNewsWire, but with other feed-readers, who knows!! Probably an abuse of the <link> semantics/representation... I'll risk it.
I started blogging again this year because i wrote my own blog site generator. Or did i write my own blog site generator so i could start blogging again? I am not actually sure which it is...
I had been using Tumblelog, and there were a couple things that were just not quite right. What does a programmer do when things are not quite right? They scratch their own itch.
The major changes, other then rewriting in c# and Unity3d (ahahaha), were tweaks to the input format itself. Each post can now have its own date/time stamps and an optional title. I also changed how tagging works.
I wrote the tool in c# and Unity3d. Yes, when all you have is a game creation tool, every problem is a game. Mostly because using familiar tools would get it done quickly, even if they are not an exact a fit. Whatever, it works. I was surprised by how little code it took, actually. Used Linq, hand written simple recursive decent parser, a Markdown library and Mustache (via the Nustache library) for the templates.
I keep telling myself that once i've cleaned up the code, and finished a "couple last features", i'll put it up on github or some other place. We will see. Not that i am precious about it, more that i'm not sure anyone else would be interested or get anything from it. Other than maybe a laugh.
Couple Last Features
further tweaks and improvements to the input format
adding an "work in progress" marker so that a post is ignored during publishing
adding an explicit "this is a page" token to PAGE types, so there can be explicit error reporting for badly formatted post & page markers
getting all the variables into an ini file, so i don't have to keep recompiling the app
Was trying to figure out the difference between the <img> tags alt vs title attributes. Luckily i found How to correctly use alt and title in HTML image tags which answers the real question, "What kind of content should I write for each?"...
Posted to mastodon about the work i have done to reduce image sizes and got the most feedback ever. Which was enheartening. Next steps are going to be looking at the HTML and CSS and all that, trying to simplify it. Ideally to make it "readable" just as text. I'm not sure that is a realistic goal, considering how many links i use. Even in my markdown "raw" file the links are kind of horrible to read. I could do the reference thing, rather then in-line, which would help, i guess. But only with the raw file, the HTML will still have all those anchor tags and their hrefs in-line.
I do like looking at the server logs, and seeing what all the bots are requesting. Most are, i assume, looking for easy server exploits, of commonly run scripts or packages. Amazing that there is so much action going on that you just never see.
In a bit of coincidental timing, Plurrrr points to an article about the mythical "fast" web page, which is kinda what i was thinking about yesterday with the 250kb Club stuff. I want to be showing photos here. I could do more to optimize those photos, make them more space efficient. And i guess i'm less worried about size and weight then i am about bigger costs? The cost of electricity to move all those bytes. For folks on low-bandwidth devices or just less access to data... I didn't use to care about any of this stuff, but from hundred rabbits, SolarPunk and LowTech Magazine i've been thinking about it more. I am the one with free time and resources to make my shit better, i should not be pushing that off onto others to deal with. For instance, could have low res or highly optimized versions of the images for the posts, but then high res versions behind a link. Simple.
So, wired up the use of sips to resample the width of all incoming images down to 800 pixels, and then used ImageMagick and Mogrify to bake in rotation and strip out all metadata.
Also now looking at the Web Bloat Score Calculator and seeing what i can do to improve the site. The biggest things are, of course, the photos. I have 1 javascript library, and it is like 9k, for the source-code highlighting. So, photos are it. I'm not sure i want to reduce the photo size, i like having the high quality images there... I guess i will never be part of the 250kb Club. sigh
Oh, the excitement when first setting up a new blog! Getting all the fancy tech working, solving problems! Then the reality of what blogging means, you have to actually write something! And there is a (self inflicted) pressure to "expand" your audience, which means new content every day. And if you don't do that, then maybe it is a failure. Now, i have allowed myself to feel that way, and i am here, now, to say, no more. I will be content with whatever small and occasional updates i do. In what ever esoteric or boring topics i choose to expound upon. Because there is already too much to be anxious and stressed about, and a blog is not, and should not, be one of them.
Ok, have working output for items, converting the Tumblelog python version over to javascript. With some changes to the formatting of the blog. But the rendering is still the same..ish. Also i was dumb and tried to force too much into a single regex, am rethinking how to extract tags out of the item separator. Anyway, a couple functions and blocks a day, in a week i should have it done. The most notable thing that i don't think i can get working is the html figure tag stuff working for images. In the python code it edits the AST for the html/markdown directly. The markdown lib i am using does allow for something like it, but not exactly? Again, i could make it work by messing with how the markdown renders the title element, making that the <figcaption> value, but that does not work how the existing code works, with a line directly after the markdown image line becoming the caption. This is something that i should not be worrying about right now, as there is still lots of other stuff to get working first!
Might be able to do something much less extreme and more inline with the current formatting, actually. Which would be much better, from my POV -- would like to work within the format already designed. Not enough brain power to try it out tonight...
Working on a ... branch of Tumblelog in javascript and using Deno as the execution environment. I was never a big fan of Node.js, and so Deno has been a breath of fresh air. Trying out a different meaning of % right now, inline with some of the proposed changes I outlined the other day, and fighting with the different required regular expressions to make it work. Progress is ok so far, but that is because i'm doing the easy stuff.
Here is where i got with a couple hours hacking, mostly spent figuring out how to setup the regular expressions. Thank goodness for regexr to help with experimentation! It would have taken a lot longer with out it. And, of course, the original project to crib from.
import {Marked} from "https://deno.land/x/markdown@v2.0.0/mod.ts";
import { parse } from 'https://deno.land/std@0.69.0/datetime/mod.ts'
const decoder = new TextDecoder("utf-8");
const filename = Deno.args[0];
const raw = decoder.decode(await Deno.readFile(filename));
// "% @pagename(a page title)"
// found[1] == "pagename"
// found[2] == "a page title"
const pageRegex = /% @(.*)\((.*)\)/;
// "% 2020-10-21 A Title #TagOne #TagTwo"
// found[1] = "2020-10-21"
// found[2] = "A Title"
// found[3] = "#TagOne #TagTwo"
const itemRegex = /^% (\d{4}-\d{2}-\d{2})?\s?([^#]*)?\s(#.*\b)?/;
const rawItems = raw.split(/(^% .*)/gm);
const pages = [];
const items = [];
// 'id' is used to keep items in the order they are found in the
// source data file, incase we are doing other sorting operations.
const pageData = { name:'', title:'', rawContent:'', id:0};
const itemData = { date:new Date(), title:'', tags:[], rawContent:'', id:0};
let counter = 0;
for(let index = 0; index < rawItems.length; ++index) {
let value = rawItems[index];
let found = value.match(pageRegex);
if(found)
{
console.log("Page: " + found);
let page = Object.assign({}, pageData);
page.id = counter++;
page.name = found[1];
page.title = found[2];
page.rawContent = rawItems[index+1];
pages.push(page);
index++;
continue;
}
found = value.match(itemRegex);
if(found)
{
console.log("Item: " + found);
let item = Object.assign({}, itemData);
item.id = counter++;
item.title = found[2];
if(found[3]) item.tags = found[3].split(" ");
if(found[1]) item.date = parse(found[1], "yyyy-MM-dd");
item.rawContent = rawItems[index+1];
items.push(item);
index++;
continue;
}
}
// Test html output for a "post" item.
for(let index = 0; index < items.length; ++index)
{
let item = items[index];
console.log('<article>\n' + Marked.parse(item.rawContent).content + '</article>\n');
}
Also downloaded Visual Studio Code in order to be able to use the Deno code-formatting helper thingie. Anyway, VS Code is much better then when i last used it, might move over to using it for my Unity3d/C# day-job-dev.
Deno is super easy to use, and program with. I am just writing js code, and executing it via deno: deno run --allow-read=./ neo.js text.md
Will see if i keep at it.
... Oh, i just figure out the format i should be using for the transclusion/including of tagged items -- [% include <tag name> %] -- this follows the format used in the html template file.
Tags and Transclusion for Tumblelog, a WIP proposal.
The start of a discussion about new features for tumblelog. This may be a bit ramblely, sorry!
Tags
Right now "posts" in tumblelog are separated by DATES, and all the items posted within a date are, sort of, considered a single post. Items inside a single day can be separated by using the % character.
My suggestion is to extend the % separator, so it can include more meta-data about each item, and promote this separator to define individual "posts". For example:
% <date> <title> <tags>
"% 2020-10-19 This new meta-data idea is dope! #blog-tech #idea #so-good"
All <date>, <title> and <tags> are optional, allowing the format to be very similar to the existing one. A change would be that every % item "inherits" the previously used date from %.
Tag collection pages would be created in the same general way that the archive is created.
Rendering of "dates" at the top of a group of similarly dated posts, like how the current parser works, would require a bit more logic and state.
Transclusion
Transcluding is more complicated, and i don't have a clear understanding myself about what the common use case for this would be, other than my own desire for how it would work. This Markdown-Content-Blocks proposal is interesting, although in this case it isn't the markdown compiler that would be dealing with the transclusion but the blog-engine itself.
My usecase is that i have pages setup for a bunch of different projects, and i want to tags posts with a project name, and then have those posts included in the project pages. Which is another reason for more fine-grained "post" definition.
Next steps
Is this even something that could be ported into the existing system? it would be a breaking change to the blog format, which is no small deal. A "half" step could be adding just the tags and titles to the %, maybe? I guess some feedback on this idea is the first step.
High level, another move to make the small web available to people again. Me blogging is an attempt to have a voice on the web which isn't filtered or owned by twitter or facebook.
Just spent way too much time trying to figure out how to implement both a tagging system and some way to transclude a group of tagged articles into an arbitrary location in the blog. I got basic tagging done, the code would pull out all articles which had something like #myTagString in them. Then i could also use something like transclude:<tagname>, and it partially works. It works for the "main" blog, but trying to get that to work on pages was a no go. Also, trying to auto-link the tag and make individual "tag" pages, was something that i didn't even try to do.
Unsurprisingly, it is a harder feature to implement than i first thought.
Got the syntax highlighting working via Prism, very easy. Nice! Here is an example of some code from the Flow project.
namespace Flow
{
// Only for other, non flow classes, that would like to supply custom name info for display on the flow Game Objects.
public interface IFlowName
{
string flowName { get; }
}
public abstract class FlowBase : Flow
{
public void BaseComplete()
{
base.Complete();
}
}
public abstract class Flow : MonoBehaviour
{
[Tooltip("Because the Game Object name is dynamically set, this is where you can customize it.")]
public string _name;
[Tooltip("This is triggered when the item's Complete() method is called. For example, after a delay, or when all child objects have themselves completed.")]
public UnityEvent OnComplete;