Compare commits
3 commits
2e6fa6088b
...
71705d6e74
Author | SHA1 | Date | |
---|---|---|---|
71705d6e74 | |||
722b0589cb | |||
9c05e95f07 |
3 changed files with 10 additions and 6 deletions
|
@ -31,8 +31,7 @@
|
||||||
(rawImageUrl . "https://static.wikia.nocookie.net/examplefile")
|
(rawImageUrl . "https://static.wikia.nocookie.net/examplefile")
|
||||||
(userName . "blankie")
|
(userName . "blankie")
|
||||||
(isPostedIn . #t)
|
(isPostedIn . #t)
|
||||||
(smallerArticleList . (#hasheq((title . "Example_article")
|
(smallerArticleList . (#hasheq((titleText . "Test:Example article"))))
|
||||||
(titleText . "Example article"))))
|
|
||||||
(articleListIsSmaller . 0)
|
(articleListIsSmaller . 0)
|
||||||
(exists . #t)
|
(exists . #t)
|
||||||
(imageDescription . #f))))
|
(imageDescription . #f))))
|
||||||
|
@ -89,8 +88,8 @@
|
||||||
,(if is-posted-in
|
,(if is-posted-in
|
||||||
`(p "This file is used in "
|
`(p "This file is used in "
|
||||||
,@(map (λ (article)
|
,@(map (λ (article)
|
||||||
(define page-path (jp "/title" article))
|
(define title (jp "/titleText" article))
|
||||||
(define title (jp "/titleText" article page-path))
|
(define page-path (regexp-replace* #rx" " title "_"))
|
||||||
`(span ,(if (eq? (car smaller-article-list) article) "" ", ")
|
`(span ,(if (eq? (car smaller-article-list) article) "" ", ")
|
||||||
(a (@ (href ,(format "/~a/wiki/~a" wikiname page-path)))
|
(a (@ (href ,(format "/~a/wiki/~a" wikiname page-path)))
|
||||||
,title)))
|
,title)))
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
(a (@ (data-test-wikilink) (href "https://test.fandom.com/wiki/Another_Page") (title "Another Page"))
|
(a (@ (data-test-wikilink) (href "https://test.fandom.com/wiki/Another_Page") (title "Another Page"))
|
||||||
"Another Page"))))
|
"Another Page"))))
|
||||||
(figure (@ (class "thumb tnone"))
|
(figure (@ (class "thumb tnone"))
|
||||||
(a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image"))
|
(a (@ (href "https://static.wikia.nocookie.net/nice-image.png") (class "image") (data-test-figure-a))
|
||||||
(img (@ (src "data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D")
|
(img (@ (src "data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D")
|
||||||
(data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
|
(data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png")
|
||||||
(class "thumbimage lazyload"))))
|
(class "thumbimage lazyload"))))
|
||||||
|
@ -255,6 +255,11 @@
|
||||||
(λ (t a c) (and (eq? t 'a) (has-class? "image-thumbnail" a)))
|
(λ (t a c) (and (eq? t 'a) (has-class? "image-thumbnail" a)))
|
||||||
transformed))))
|
transformed))))
|
||||||
"/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png")
|
"/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png")
|
||||||
|
(check-equal? (get-attribute 'href (bits->attributes
|
||||||
|
((query-selector
|
||||||
|
(λ (t a c) (member '(data-test-figure-a) a))
|
||||||
|
transformed))))
|
||||||
|
"/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png")
|
||||||
; check that noscript images are removed
|
; check that noscript images are removed
|
||||||
(check-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f))
|
(check-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f))
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
(module+ test
|
(module+ test
|
||||||
(require "typed-rackunit.rkt"))
|
(require "typed-rackunit.rkt"))
|
||||||
|
|
||||||
(define px-wikiname "[a-zA-Z0-9-]{3,50}")
|
(define px-wikiname "[a-zA-Z0-9-]{1,50}")
|
||||||
|
|
||||||
;; https://url.spec.whatwg.org/#urlencoded-serializing
|
;; https://url.spec.whatwg.org/#urlencoded-serializing
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue