Add editorial page
Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
parent
fa272fa169
commit
50a28994c9
|
@ -18,7 +18,6 @@ This program is written in Guile Scheme. As such, you need `guile` and `guile-gn
|
|||
5. Profit
|
||||
|
||||
# Todo
|
||||
* Editorial article page
|
||||
* Video list page
|
||||
* Video page
|
||||
|
||||
|
|
3
meme.scm
3
meme.scm
|
@ -137,7 +137,8 @@
|
|||
(pages? path-components "deadpool")
|
||||
(pages? path-components "all")))
|
||||
(meme-list-page path))
|
||||
((equal? (car path-components) "memes")
|
||||
((or (equal? (car path-components) "memes")
|
||||
(equal? (car path-components) "editorials"))
|
||||
(meme-page path))
|
||||
((and (equal? (car path-components) "categories")
|
||||
(equal? (length path-components) 1))
|
||||
|
|
|
@ -144,6 +144,7 @@
|
|||
(define chld2 %null-pointer)
|
||||
(define lst (list ""))
|
||||
(define lst1 (list ""))
|
||||
(define lst2 (list ""))
|
||||
(define skip #f)
|
||||
(while (not (null-pointer? chld))
|
||||
(name chld)
|
||||
|
@ -179,7 +180,21 @@
|
|||
(equal? (name (child1 chld 0)) "p"))
|
||||
(append!
|
||||
lst
|
||||
(list (dump-xml chld)))))
|
||||
(list (dump-xml chld))))
|
||||
(cond
|
||||
((and (equal? (name (attrs chld)) "class")
|
||||
(equal? (text (attrs chld)) "collection-item"))
|
||||
(append!
|
||||
lst2
|
||||
(list
|
||||
(list
|
||||
(dump-xml (child1 chld 0))
|
||||
(text (attrs (child (next (child1 chld 0) 1))))
|
||||
(text
|
||||
(next
|
||||
(attrs (child (child (next (child1 chld 0) 1))))
|
||||
6))
|
||||
(text (attrs (child1 (next (child1 chld 0) 3) 0)))))))))
|
||||
((equal? (name chld) "center")
|
||||
(set! chld1 (child1 chld 0))
|
||||
(set! lst1 (list ""))
|
||||
|
@ -203,22 +218,31 @@
|
|||
(set! chld1 (next chld1 0)))
|
||||
(append! lst (cdr lst1))))
|
||||
(set! chld (next chld 0)))
|
||||
(define final-xpath-null?
|
||||
(xpath-null?
|
||||
"/html/body/div[3]/div/article/header/section/div/footer/p[2]" d))
|
||||
(append
|
||||
(list
|
||||
(get-xpath-string
|
||||
"/html/body/div[3]/div/article/header/section/h1/text()" d #f)
|
||||
(get-xpath-string
|
||||
"/html/body/div[3]/div/article/header/a/img/@src" d #t)
|
||||
(if (xpath-null? "/html/body/div[3]/div/article/header/section/div/h5" d)
|
||||
""
|
||||
(dump-xpath-xml
|
||||
"/html/body/div[3]/div/article/header/section/div/h5" d))
|
||||
(dump-xpath-xml
|
||||
"/html/body/div[3]/div/article/header/section/div/footer/p[1]" d)
|
||||
(dump-xpath-xml
|
||||
"/html/body/div[3]/div/article/header/section/div/footer/p[2]"
|
||||
d))
|
||||
(cdr lst)))
|
||||
(append
|
||||
(list
|
||||
(get-xpath-string
|
||||
"/html/body/div[3]/div/article/header/section/h1/text()" d #f)
|
||||
(get-xpath-string
|
||||
"/html/body/div[3]/div/article/header//img/@src" d #t)
|
||||
(if (xpath-null?
|
||||
"/html/body/div[3]/div/article/header/section/div/h5" d)
|
||||
""
|
||||
(dump-xpath-xml
|
||||
"/html/body/div[3]/div/article/header/section/div/h5" d))
|
||||
(if final-xpath-null? ""
|
||||
(dump-xpath-xml
|
||||
"/html/body/div[3]/div/article/header/section/div/footer/p[1]" d))
|
||||
(if final-xpath-null?
|
||||
(dump-xpath-xml
|
||||
"/html/body/div[3]/div/article/header/section/div/footer/p" d)
|
||||
(dump-xpath-xml
|
||||
"/html/body/div[3]/div/article/header/section/div/footer/p[2]" d)))
|
||||
(cdr lst))
|
||||
(list lst2)))
|
||||
|
||||
(define (get-meme-list d)
|
||||
(define table
|
||||
|
|
|
@ -185,7 +185,19 @@
|
|||
(html->shtml
|
||||
(string-replace-substring
|
||||
s "https://knowyourmeme.com" "")))
|
||||
(list-tail meme 5)))))
|
||||
(list-head (list-tail meme 5) (- (length meme) 6))))
|
||||
,(if (not (equal? (car (last-pair meme)) ""))
|
||||
`(div (@ (class "collection-wrapper"))
|
||||
,(map (lambda (l)
|
||||
`(div (@ (class "box collection-item"))
|
||||
,(html->shtml (car l))
|
||||
(p (a (@ (href ,(cadddr l))) "Source"))
|
||||
(a (@ (href
|
||||
,(string-replace-substring
|
||||
(cadr l) "https://knowyourmeme.com" "")))
|
||||
(img (@ (src ,(proxy (caddr l))))))))
|
||||
(cdar (last-pair meme))))
|
||||
`())))
|
||||
|
||||
(define (meme-list->sxml meme-list)
|
||||
`(div
|
||||
|
|
|
@ -217,6 +217,7 @@ table.trending-images img {
|
|||
.meme.box h1 {
|
||||
margin-bottom: 0.5em;
|
||||
margin-top: 0.3em;
|
||||
font-size: 1.7em;
|
||||
max-width: 65%;
|
||||
}
|
||||
|
||||
|
@ -343,3 +344,25 @@ ul.meme-list-list a:hover p.tooltip {
|
|||
.photo-body.box img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.collection-wrapper {
|
||||
column-count: 2;
|
||||
column-gap: 0;
|
||||
margin: 0 2%;
|
||||
margin-left: 0.5%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.collection-item.box {
|
||||
padding: 0 2% 2% 2%;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.collection-item.box img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.collection-item.box p {
|
||||
float: right;
|
||||
margin-top: -2.7em;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue