Fix wikis with numbers in the name #3

Merged
cadence merged 1 commit from blankie/breezewiki:number-title into main 2022-10-02 08:23:22 +00:00
3 changed files with 6 additions and 6 deletions
Showing only changes of commit 2a56107e97 - Show all commits

View file

@ -43,9 +43,9 @@
(pathprocedure:make "/" (hash-ref ds 'page-home)) (pathprocedure:make "/" (hash-ref ds 'page-home))
(pathprocedure:make "/proxy" (hash-ref ds 'page-proxy)) (pathprocedure:make "/proxy" (hash-ref ds 'page-proxy))
(pathprocedure:make "/search" (hash-ref ds 'page-global-search)) (pathprocedure:make "/search" (hash-ref ds 'page-global-search))
(filter:make #rx"^/[a-z-]+/wiki/Category:.+$" (lift:make (hash-ref ds 'page-category))) (filter:make #px"^/[a-zA-Z0-9-]{3,50}/wiki/Category:.+$" (lift:make (hash-ref ds 'page-category)))
(filter:make #rx"^/[a-z-]+/wiki/.+$" (lift:make (hash-ref ds 'page-wiki))) (filter:make #px"^/[a-zA-Z0-9-]{3,50}/wiki/.+$" (lift:make (hash-ref ds 'page-wiki)))
(filter:make #rx"^/[a-z-]+/search$" (lift:make (hash-ref ds 'page-search))) (filter:make #px"^/[a-zA-Z0-9-]{3,50}/search$" (lift:make (hash-ref ds 'page-search)))
(filter:make #rx"^/[a-z-]+(/(wiki(/)?)?)?$" (lift:make (hash-ref ds 'redirect-wiki-home))) (filter:make #px"^/[a-zA-Z0-9-]{3,50}(/(wiki(/)?)?)?$" (lift:make (hash-ref ds 'redirect-wiki-home)))
(hash-ref ds 'static-dispatcher) (hash-ref ds 'static-dispatcher)
(lift:make (hash-ref ds 'page-not-found))))))) (lift:make (hash-ref ds 'page-not-found)))))))

View file

@ -143,7 +143,7 @@
(λ (href) (λ (href)
((compose1 ((compose1
(λ (href) (regexp-replace #rx"^(/wiki/.*)" href (format "/~a\\1" wikiname))) (λ (href) (regexp-replace #rx"^(/wiki/.*)" href (format "/~a\\1" wikiname)))
(λ (href) (regexp-replace #rx"^https://([a-z-]+).fandom.com(/wiki/.*)" href "/\\1\\2"))) (λ (href) (regexp-replace #px"^https://([a-zA-Z0-9-]{3,50}).fandom.com(/wiki/.*)" href "/\\1\\2")))
href))) href)))
; add noreferrer to a.image ; add noreferrer to a.image
(curry u (curry u

View file

@ -57,7 +57,7 @@
(: is-fandom-url? (String -> Boolean)) (: is-fandom-url? (String -> Boolean))
(define (is-fandom-url? url) (define (is-fandom-url? url)
(regexp-match? #rx"^https://static.wikia.nocookie.net/|^https://[a-z-]*.fandom.com/" url)) (regexp-match? #px"^https://static.wikia.nocookie.net/|^https://[a-zA-Z0-9-]{3,50}.fandom.com/" url))
(module+ test (module+ test
(check-true (is-fandom-url? "https://static.wikia.nocookie.net/wikiname/images/2/2f/SomeImage.jpg/revision/latest?cb=20110210094136")) (check-true (is-fandom-url? "https://static.wikia.nocookie.net/wikiname/images/2/2f/SomeImage.jpg/revision/latest?cb=20110210094136"))
(check-true (is-fandom-url? "https://test.fandom.com/wiki/Some_Page")) (check-true (is-fandom-url? "https://test.fandom.com/wiki/Some_Page"))