From c41288c7056752f2b25afa5790ae68abf2b3bc88 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Thu, 24 Mar 2022 18:13:06 -0400 Subject: Skip matches with ident chars on either side This fixes, for example, where the link gets placed on static regex_t regex(const char *pattern, int flags) in title.c. --- bin/htagml.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/htagml.c b/bin/htagml.c index 033f717a..1f547be6 100644 --- a/bin/htagml.c +++ b/bin/htagml.c @@ -77,6 +77,10 @@ static char *hstrstr(const char *haystack, const char *needle) { return NULL; } +static int isident(int c) { + return isalnum(c) || c == '_'; +} + int main(int argc, char *argv[]) { bool pre = false; bool pipe = false; @@ -190,7 +194,10 @@ int main(int argc, char *argv[]) { size_t mlen = strlen(tag); char *match = (pipe ? hstrstr : strstr)(buf, tag); - while (match > buf && isalnum(match[-1])) { + while ( + match && + ((match > buf && isident(match[-1])) || isident(match[mlen])) + ) { match = (pipe ? hstrstr : strstr)(&match[mlen], tag); } if (!match && tag[0] == 'M') { -- cgit 1.4.1 ;follow=1'>log tree commit diff
path: root/home/.profile (unfollow)
Commit message (Collapse)Author
2024-09-23Automatically select the last used lens for a bodyJune McEnroe
2024-09-19Add photos from September 5June McEnroe
Had to prefix the folder number onto these file names manually because they must have come out of a different scanner or something.
2024-09-15Add some more film stocks to the listJune McEnroe
2024-09-13Add photos from September 2June McEnroe
2024-09-13Add Fomapan 200 to films listJune McEnroe
2024-09-10Add August 29 picnic photosJune McEnroe
2024-09-08Apply some bold to trips renderingJune McEnroe
This seems easier to visually scan. The only other thing I'd like is a nicer date rendering but JavaScript is useless for that.
2024-09-08Render trips hopefully more efficientlyJune McEnroe
2024-09-08Allow removing bodies and lensesJune McEnroe
2024-09-08Limit body width so it looks less silly on desktopJune McEnroe
2024-09-07Handle no film being loadedJune McEnroe
2024-09-07Fancy up the text a littleJune McEnroe