Generalize meme-children to all meme lists
Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
parent
ff6aa93d3f
commit
6507dff0a0
70
meme.scm
70
meme.scm
|
@ -105,17 +105,65 @@
|
|||
; 0))))
|
||||
; (videos-page path))
|
||||
((and (equal? (car path-components) "memes")
|
||||
(or (equal? (car (last-pair path-components)) "children")
|
||||
(and
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 2))
|
||||
"page")
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 3))
|
||||
"children"))))
|
||||
(meme-children-page path))
|
||||
((and (equal? (car path-components) "memes")
|
||||
(not (equal? (car (last-pair path-components)) "children")))
|
||||
(or
|
||||
(or (equal? (car (last-pair path-components)) "children")
|
||||
(and
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 2))
|
||||
"page")
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 3))
|
||||
"children")))
|
||||
(or (equal? (car (last-pair path-components)) "submissions")
|
||||
(and
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 2))
|
||||
"page")
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 3))
|
||||
"submissions")))
|
||||
(or (equal? (car (last-pair path-components)) "researching")
|
||||
(and
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 2))
|
||||
"page")
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 3))
|
||||
"researching")))
|
||||
(or (equal? (car (last-pair path-components)) "newsworthy")
|
||||
(and
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 2))
|
||||
"page")
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 3))
|
||||
"newsworthy")))
|
||||
(or (equal? (car (last-pair path-components)) "popular")
|
||||
(and
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 2))
|
||||
"page")
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 3))
|
||||
"popular")))
|
||||
(or (equal? (car (last-pair path-components)) "deadpool")
|
||||
(and
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 2))
|
||||
"page")
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 3))
|
||||
"deadpool")))
|
||||
(or (equal? (car (last-pair path-components)) "all")
|
||||
(and
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 2))
|
||||
"page")
|
||||
(equal? (list-ref path-components
|
||||
(- (length path-components) 3))
|
||||
"all")))))
|
||||
(meme-list-page path))
|
||||
((equal? (car path-components) "memes")
|
||||
(meme-page path))
|
||||
(else (error-page 404)))))
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#:export (error-page
|
||||
newsfeed-page
|
||||
meme-page
|
||||
meme-children-page
|
||||
meme-list-page
|
||||
photos-page
|
||||
photo-page
|
||||
videos-page
|
||||
|
@ -81,9 +81,9 @@
|
|||
(display ";\tHandler: meme-page")
|
||||
(generic-page meme-template path))
|
||||
|
||||
(define (meme-children-page path)
|
||||
(display ";\tHandler: meme-children-page")
|
||||
(generic-page meme-children-template path))
|
||||
(define (meme-list-page path)
|
||||
(display ";\tHandler: meme-list-page")
|
||||
(generic-page meme-list-template path))
|
||||
|
||||
(define (photos-page path)
|
||||
(display ";\tHandler: photos-page")
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
get-trending
|
||||
get-newsfeed
|
||||
get-meme
|
||||
get-meme-children
|
||||
get-meme-list
|
||||
get-photos
|
||||
get-photo
|
||||
get-videos
|
||||
|
@ -249,10 +249,10 @@
|
|||
d))
|
||||
(cdr lst)))
|
||||
|
||||
(define (get-meme-children d)
|
||||
(define (get-meme-list d)
|
||||
(define table
|
||||
(get-xpath-node
|
||||
"/html/body/div[3]/div/div[3]/section/div[2]/table/tbody"
|
||||
"//div[@id=\"entries_list\"]/table/tbody"
|
||||
d))
|
||||
(define lst (list ""))
|
||||
(define lst1 (list ""))
|
||||
|
@ -322,7 +322,14 @@
|
|||
"/html/body/div[3]/div/div[1]/header/hgroup/p/text()"
|
||||
d #f))
|
||||
(dump-xpath-xml "/html/body/div[3]/div/nav/ul" d)
|
||||
(dump-xpath-xml "/html/body/div[3]/div/div[3]/section/div/p" d))
|
||||
(if (null-pointer?
|
||||
(caddr (parse-c-struct
|
||||
(get-xpath-nodeset
|
||||
"/html/body/div[3]/div/div[3]/section/div/p"
|
||||
d)
|
||||
xml-nodeset)))
|
||||
""
|
||||
(dump-xpath-xml "/html/body/div[3]/div/div[3]/section/div/p" d)))
|
||||
(cdr lst)))
|
||||
|
||||
(define (get-photos d)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#:export (error-template
|
||||
newsfeed-template
|
||||
meme-template
|
||||
meme-children-template
|
||||
meme-list-template
|
||||
photos-template
|
||||
photo-template
|
||||
videos-template
|
||||
|
@ -33,7 +33,7 @@
|
|||
leaderboard->sxml
|
||||
trending->sxml
|
||||
meme->sxml
|
||||
meme-children->sxml
|
||||
meme-list->sxml
|
||||
photos->sxml
|
||||
photo->sxml
|
||||
videos->sxml))
|
||||
|
@ -185,18 +185,18 @@
|
|||
s "https://knowyourmeme.com" "")))
|
||||
(list-tail meme 5)))))
|
||||
|
||||
(define (meme-children->sxml meme-children)
|
||||
(define (meme-list->sxml meme-list)
|
||||
`(div
|
||||
(div (@ (class "box meme-children"))
|
||||
,(html->shtml (car meme-children))
|
||||
(p ,(cadr meme-children))
|
||||
,(html->shtml (caddr meme-children))
|
||||
(div (@ (class "box meme-list"))
|
||||
,(html->shtml (car meme-list))
|
||||
(p ,(cadr meme-list))
|
||||
,(html->shtml (caddr meme-list))
|
||||
,(html->shtml (string-replace-substring
|
||||
(cadddr meme-children)
|
||||
(cadddr meme-list)
|
||||
"https://knowyourmeme.com"
|
||||
"")))
|
||||
(div (@ (class "box meme-children-body"))
|
||||
(ul (@ (class "meme-children-list"))
|
||||
(div (@ (class "box meme-list-body"))
|
||||
(ul (@ (class "meme-list-list"))
|
||||
,(map (lambda (l)
|
||||
`(li
|
||||
(a (@ (href ,(string-replace-substring
|
||||
|
@ -205,7 +205,7 @@
|
|||
"")))
|
||||
(img (@ (src ,(proxy (cadr l)))))
|
||||
(p (@ (class "tooltip box")) ,(caddr l)))))
|
||||
(cddddr meme-children))))))
|
||||
(cddddr meme-list))))))
|
||||
|
||||
(define (photos->sxml photos)
|
||||
`(div
|
||||
|
@ -373,14 +373,14 @@
|
|||
,(meme->sxml (get-meme body))
|
||||
,footer))))
|
||||
|
||||
(define (meme-children-template body)
|
||||
(define (meme-list-template body)
|
||||
(shtml->html
|
||||
`(html ,(html-head "MeMe")
|
||||
(body
|
||||
,heading
|
||||
,(leaderboard->sxml (get-leaderboard body))
|
||||
,(trending->sxml (get-trending body))
|
||||
,(meme-children->sxml (get-meme-children body))
|
||||
,(meme-list->sxml (get-meme-list body))
|
||||
,(if (not (equal? (get-pagination body) ""))
|
||||
`(div (@ (class "wide-pagination"))
|
||||
,(pagination->sxml (get-pagination body)))
|
||||
|
|
|
@ -256,7 +256,7 @@ div.references p {
|
|||
float: left;
|
||||
}
|
||||
|
||||
ul.meme-children-list {
|
||||
ul.meme-list-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
list-style-type: none;
|
||||
|
@ -266,28 +266,28 @@ ul.meme-children-list {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
ul.meme-children-list a:hover p.tooltip {
|
||||
ul.meme-list-list a:hover p.tooltip {
|
||||
display: block;
|
||||
margin-top: -5em;
|
||||
}
|
||||
|
||||
.photos.box,
|
||||
.videos.box,
|
||||
.meme-children.box {
|
||||
.meme-list.box {
|
||||
width: 93%;
|
||||
padding: 0 2%;
|
||||
}
|
||||
|
||||
.photos.box ul li,
|
||||
.videos.box ul li,
|
||||
.meme-children.box ul li {
|
||||
.meme-list.box ul li {
|
||||
display: inline;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.photos.box ul li ul,
|
||||
.videos.box ul li ul,
|
||||
.meme-children.box ul li ul {
|
||||
.meme-list.box ul li ul {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -297,14 +297,14 @@ ul.meme-children-list a:hover p.tooltip {
|
|||
|
||||
.photos-gallery.box,
|
||||
.videos-table.box,
|
||||
.meme-children-body.box {
|
||||
.meme-list-body.box {
|
||||
width: 87%;
|
||||
padding: 1% 5%;
|
||||
}
|
||||
|
||||
.photos-gallery.box img,
|
||||
.videos-table.box img,
|
||||
.meme-children-body.box img {
|
||||
.meme-list-body.box img {
|
||||
margin: 0.5em;
|
||||
max-height: 15em;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue