d9ae1a68cda2 default tip

Downcase titles in lookup table

I know this isn't i18n friendly, but this thing is only for
me and it will make my life significantly easier, so too bad.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 09 May 2024 16:06:08 -0400
parents 90717aee8905
children (none)
branches/tags default tip
files mw.lisp

Changes

--- a/mw.lisp	Tue Mar 12 10:24:34 2024 -0400
+++ b/mw.lisp	Thu May 09 16:06:08 2024 -0400
@@ -233,7 +233,7 @@
 (defun build-title-table (pages)
   (iterate
     (for page :in pages)
-    (for keys = (cons (title page) (extra-titles page)))
+    (for keys = (mapcar #'string-downcase (cons (title page) (extra-titles page))))
     (dolist (key keys)
       (when-let ((dupe (gethash key result)))
         (err "Duplicate link title ~S:~%  ~A~%  ~A~%"
@@ -266,7 +266,7 @@
   (let* ((text (str:trim (plump:text node)))
          (href (plump:attribute node "href"))
          (page (if (str:emptyp href)
-                 (gethash text *title-table*)
+                 (gethash (string-downcase text) *title-table*)
                  (gethash href *slug-table*))))
     (if (null page)
       (progn (err "Can't resolve link in ~A: ~A~%"