Blog2023 ≫ Nice little coding fix

This has been bugging me for ages and I just sorted it. See sometimes there are links in these posts and sometimes there are not. I do some replacing of keywords if I think I have a good link for it, like the word javascript say. Now if I have the word javascript and it's part of a url or an image or something like that I don't want to replace that, only if it's in plain text. It's hard to detect this before replacing, but can do it after replacing. So I was saying "if I replace this, and it makes something broken, then don't replace it". This means the word javascript doesn't become a link in this post and we move on. But I just realised I can do this after each replacement, I don't have to do it at the end. So just moving a line of code means I now get all the links.

This just happened in that piece about Fareham (and in fact now it will happen withe the word Fareham here too). The word "Fareham" used in just plain text now becomes a link, but if it was already in a link then it doesn't.

This is fairly meaningless to everybody but I'm pleased.

I'm so inspired I might go back to a thing I was doing at work yesterday!

js: Programming language of the internets, mostly how I make my living.

🕵️

⬅️ :: ➡️

Paul Clarke's weblog - I live in A small town. Wed and dad to two, I am a full-stack web developr, + I do mostly javascript / Node, some ruby, python, php ect ect. I like pubs, parkrun, eating, home-automation + other diy jiggery-pokery, history, genealogy, TV, squirrels, pirates, lego, + time travel.