Add JSONP support on other endpoints

Refactored the code to define and process endpoints rather than doing
it imperatively, which avoided a lot of duplicated code.
This commit is contained in:
Cadence Ember
2025-11-17 15:18:54 +13:00
parent 7b2f96eb03
commit b7fe180790
12 changed files with 518 additions and 282 deletions

View File

@@ -12,7 +12,7 @@
update-tree-wiki)
(define (preprocess-html-wiki html)
(regexp-replace* #rx"(<(?:td|figcaption)[^>]*?>\n?)(?:<li>|[ \t]*?<p class=\"caption\">(.*?)</p>)"
(regexp-replace* #rx"(<(?:td|figcaption)[^>]*?>\n?)(?:[ \t]*<a href=\"[^\"]*\" class=\"info-icon\"><svg><use xlink:href=\"#wds-icons-info-small\"></use></svg></a>)?(?:<li>|[ \t]*?<p class=\"caption\">(.*?)</p>)"
html (λ (whole first-tag [contents #f])
(if (eq? (string-ref whole 1) #\f) ;; figcaption
(string-append first-tag "<span class=\"caption\">" contents "</span>")