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