responsive d
This commit is contained in:
parent
0f358e8dc5
commit
352f058175
@ -24,11 +24,11 @@ nav.pagination {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.userinfo > dd.registered {
|
||||
.userinfo .registered {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.userinfo > dd.title {
|
||||
.userinfo avatar-.title {
|
||||
margin-top: 1rem;
|
||||
font-size: inherit;
|
||||
font-weight: inherit;
|
||||
|
@ -1,5 +1,6 @@
|
||||
(ns clojsa.saparser
|
||||
(:require [clojure.string :as string]
|
||||
[clojure.pprint :refer [pprint]]
|
||||
[hickory.core :refer :all]
|
||||
[hickory.select :as s]
|
||||
[hickory.convert :refer [hickory-to-hiccup]]))
|
||||
@ -7,6 +8,12 @@
|
||||
(defn hickory-doc [doc]
|
||||
(-> doc parse as-hickory))
|
||||
|
||||
(defn hickory-div [content class]
|
||||
{:type :element
|
||||
:attrs {:class class}
|
||||
:tag :div
|
||||
:content content})
|
||||
|
||||
(defn parse-title [htree]
|
||||
(-> (s/select (s/child (s/tag :title)) htree)
|
||||
first :content first
|
||||
@ -28,21 +35,25 @@
|
||||
(s/and (s/tag :td) (s/class class-key))) htree))
|
||||
|
||||
(defn parse-ui [ui]
|
||||
(let [ui (first (s/select (s/descendant (s/tag :dl)) ui))]
|
||||
(hickory-to-hiccup ui)))
|
||||
(let [ui (first (s/select (s/descendant (s/tag :dl)) ui))
|
||||
author (-> (s/select (s/descendant (s/class :author)) ui)
|
||||
first :content first)
|
||||
regdate (-> (s/select (s/descendant (s/class :registered)) ui)
|
||||
first :content first)
|
||||
title (-> (s/select (s/descendant (s/class :title)) ui) first)
|
||||
avatar (-> (s/select (s/descendant (s/tag :img)) title) first)]
|
||||
{:author author
|
||||
:regdate regdate
|
||||
:avatar-title (hickory-to-hiccup
|
||||
(hickory-div (:content title) "avatar-title"))
|
||||
:avatar (hickory-to-hiccup avatar)}))
|
||||
|
||||
(defn parse-pd [pd]
|
||||
(string/trim (last (hickory-to-hiccup pd))))
|
||||
|
||||
(defn hickory-div [class content]
|
||||
{:type :element
|
||||
:attrs {:class class}
|
||||
:tag :div
|
||||
:content content})
|
||||
|
||||
(defn parse-pb [pb]
|
||||
(let [pb (-> pb :content)]
|
||||
(hickory-to-hiccup (hickory-div "postbody" pb))))
|
||||
(hickory-to-hiccup (hickory-div pb "postbody"))))
|
||||
|
||||
(defn thread-map [id page doc]
|
||||
(let [htree (hickory-doc doc)
|
||||
|
@ -105,12 +105,22 @@
|
||||
(for [post content]
|
||||
[:article.container.box
|
||||
[:div.tile.is-ancestor
|
||||
[:aside.userinfo.tile.is-3.is-parent
|
||||
(:ui post)]
|
||||
[:main.postbody.content.tile.is-9.is-parent.is-vertical
|
||||
[:div.tile.is-child
|
||||
[:aside.userinfo.card.is-shadowless.tile.is-3.is-parent
|
||||
[:div.card-content.px-0.py-0
|
||||
(let [{:keys [author regdate avatar avatar-title]} (:ui post)]
|
||||
(list
|
||||
[:div.media
|
||||
[:div.media-left.is-hidden-tablet
|
||||
[:figure.image.is-64x64 avatar]]
|
||||
[:div.media-content
|
||||
[:p.author.title.is-4 author]
|
||||
[:p.regdate.subtitle.is-6 regdate]]]
|
||||
[:div.is-hidden-mobile
|
||||
avatar-title]))]]
|
||||
[:main.postbody.tile.is-9.is-parent.is-vertical
|
||||
[:div.content.is-size-6.tile.is-child
|
||||
(:pb post)]
|
||||
[:div.level.tile.is-child.is-12
|
||||
[:div.level.is-mobile.tile.is-child.is-12
|
||||
[:div.level-right
|
||||
[:span.postdate.level-item
|
||||
(:pd post)]]]]]])]))
|
||||
|
Loading…
Reference in New Issue
Block a user