Compare commits
8 commits
1fe7b2ed78
...
daf9149b04
Author | SHA1 | Date | |
---|---|---|---|
daf9149b04 | |||
142b74cd9b | |||
6a7e7deac6 | |||
73943a9af9 | |||
9ef30bd5a2 | |||
bc604143b1 | |||
6bcbfa4da6 | |||
b16e3ea61f |
14 changed files with 455 additions and 771 deletions
|
@ -17,7 +17,7 @@
|
|||
(:require
|
||||
[dda.masto-embed.browser :as b]
|
||||
[dda.masto-embed.reply-mode :as rm]
|
||||
[dda.masto-embed.account-mode :as am]))
|
||||
[dda.masto-embed.to-html :as am]))
|
||||
|
||||
(defn init []
|
||||
(let [host-url (b/host-url-from-document)
|
||||
|
@ -25,5 +25,5 @@
|
|||
replies-to (b/replies-to-from-document)
|
||||
filter-favorited (b/filter-favorited-from-document)]
|
||||
(if (nil? replies-to)
|
||||
(am/account-mode host-url account-name)
|
||||
(am/to-html host-url account-name)
|
||||
(rm/replies-mode host-url account-name replies-to filter-favorited))))
|
|
@ -25,7 +25,6 @@
|
|||
(defn post-html-hiccup []
|
||||
(h/as-hiccup (h/parse post-html)))
|
||||
|
||||
(defn remove-image-elem [])
|
||||
|
||||
(defn element-from-document-by-name [name]
|
||||
(-> js/document
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
[dda.masto-embed.api :as api]
|
||||
[dda.masto-embed.infra :as infra]
|
||||
[dda.masto-embed.browser :as b]
|
||||
[dda.masto-embed.account-mode :as am]
|
||||
[dda.masto-embed.to-html :as th]
|
||||
))
|
||||
; ToDo: Possibility to present replies to more than one post
|
||||
(defn mastocard->html [card media]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<section class="section post-container"><article class="mastodon-post"><header class="mastodon-post-header"><img class="mastodon-post-avatar" src="AVATAR_URL"></img><div class="mastodon-post-names"><a class="display-name" href="POST_URL">DISPLAY_NAME</a><a class="account-name" href="POST_URL">ACCOUNT_NAME</a></div><time class="mastodon-post-date" datetime="DATETIME">TIME</time></header><section class="mastodon-post-content"><p class="mastodon-post-text">POST_TEXT</p><img class="mastodon-post-image" src="POST_IMG_URL"></img></section><a href="LINK_PREVIEW_URL" class="mastodon-post-link-preview" target="_blank"><img class="mastodon-post-link-image" src="LINK_PREVIEW_IMG_URL"></img><div class="mastodon-post-link-info"><h4 class="mastodon-post-link-title">LINK_PREVIEW_TITLE</h4><div class="mastodon-post-link-description">LINK_PREVIEW_DESC</div><div class="mastodon-post-link-url">LINK_PREVIEW_URL</div></div></a><footer class="mastodon-post-footer"><button class="footer-button replies"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor"><path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "/></svg><span class="count reply-count">REPLIES_COUNT</span></button><button class="footer-button retoots"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor"><path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"/></svg><span class="count retoot-count">REBLOGS_COUNT</span></button><button class="footer-button likes"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor"><path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"/></svg><span class="count like-count">FAVOURITES_COUNT</span></button></footer></article></section>
|
|
@ -11,26 +11,19 @@
|
|||
<section class="mastodon-post-content">
|
||||
<p class="mastodon-post-text">POST_TEXT</p>
|
||||
</section>
|
||||
<a href="LINK_PREVIEW_URL" class="mastodon-post-link-preview" target="_blank"></a>
|
||||
<footer class="mastodon-post-footer">
|
||||
<button class="footer-button replies">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor">
|
||||
<path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "/>
|
||||
</svg>
|
||||
<span class="count reply-count">REPLIES_COUNT</span>
|
||||
</button>
|
||||
<button class="footer-button retoots">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor">
|
||||
<path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"/>
|
||||
</svg>
|
||||
<span class="count retoot-count">REBLOGS_COUNT</span>
|
||||
</button>
|
||||
<button class="footer-button likes">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor">
|
||||
<path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"/>
|
||||
</svg>
|
||||
<span class="count like-count">FAVOURITES_COUNT</span>
|
||||
</button>
|
||||
</footer>
|
||||
<footer class="mastodon-post-footer"><button class="footer-button replies"><svg xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 23.999989 18.905102" fill="currentColor">
|
||||
<path
|
||||
d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z " />
|
||||
</svg><span class="count reply-count">REPLIES_COUNT</span></button><button
|
||||
class="footer-button retoots">src/main/dda/masto_embed/resources/post.html<svg
|
||||
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor">
|
||||
<path
|
||||
d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z" />
|
||||
</svg><span class="count retoot-count">REBLOGS_COUNT</span></button><button class="footer-button likes"><svg
|
||||
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor">
|
||||
<path
|
||||
d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z" />
|
||||
</svg><span class="count like-count">FAVOURITES_COUNT</span></button></footer>
|
||||
</article>
|
||||
</section>
|
|
@ -13,7 +13,7 @@
|
|||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
; See the License for the specific language governing permissions and
|
||||
; limitations under the License.
|
||||
(ns dda.masto-embed.account-mode
|
||||
(ns dda.masto-embed.to-html
|
||||
(:require
|
||||
[cljs.core.async :refer [go chan <! >!]]
|
||||
[cljs.core.async.interop :refer-macros [<p!]]
|
||||
|
@ -26,17 +26,16 @@
|
|||
[clojure.walk :refer [postwalk]]))
|
||||
|
||||
(def link_preview
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post-link-image", :src "LINK_PREVIEW_IMG_URL"},
|
||||
:tag :img,
|
||||
:content nil}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-link-info"},
|
||||
:tag :div,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-link-title"}, :tag :h4, :content ["LINK_PREVIEW_TITLE"]}
|
||||
{:type :element, :attrs {:class "mastodon-post-link-description"}, :tag :div, :content ["LINK_PREVIEW_DESC"]}
|
||||
{:type :element, :attrs {:class "mastodon-post-link-url"}, :tag :div, :content ["LINK_PREVIEW_URL"]}]}])
|
||||
[:a
|
||||
{:href "LINK_PREVIEW_URL", :class "mastodon-post-link-preview", :target "_blank"}
|
||||
[:img {:class "mastodon-post-link-image", :src "LINK_PREVIEW_IMG_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-link-info"}
|
||||
[:h4 {:class "mastodon-post-link-title"} "LINK_PREVIEW_TITLE"]
|
||||
[:div {:class "mastodon-post-link-description"} "LINK_PREVIEW_DESC"]
|
||||
[:div {:class "mastodon-post-link-url"} "LINK_PREVIEW_URL"]]])
|
||||
|
||||
(defn insert [v i e] (vec (concat (subvec v 0 i) [e] (subvec v i))))
|
||||
|
||||
(defn masto-header->html [html account created_at url]
|
||||
(let [{:keys [username display_name avatar_static]} account
|
||||
|
@ -55,37 +54,37 @@
|
|||
(cm/replace-all-matching-values-by-new-value "POST_TEXT" content)))
|
||||
|
||||
; Meant to be used in postwalk on hiccup/hickory html-representation
|
||||
(defn insert-into-class [item class insertion-element]
|
||||
(let [condition (every? true? [(map? item)
|
||||
(= (:type item) :element)
|
||||
(= class (:class (:attrs item)))])]
|
||||
(if condition
|
||||
(let [content (:content item)]
|
||||
(assoc-in item [:content] (conj content insertion-element)))
|
||||
(defn insert-into-content [item insertion-element]
|
||||
(let [condition (if (vector? item)
|
||||
(every? true? [(= (first item) :section)
|
||||
(= (:class (second item)) "mastodon-post-content")])
|
||||
false)]
|
||||
(if condition
|
||||
(conj item insertion-element)
|
||||
item)))
|
||||
|
||||
(defn assoc-to-content [item class insertion-element]
|
||||
(let [condition (every? true? [(map? item)
|
||||
(= (:type item) :element)
|
||||
(= class (:class (:attrs item)))])]
|
||||
(defn insert-into-post [item index insertion-element]
|
||||
(let [condition (if (vector? item)
|
||||
(every? true? [(= (first item) :section)
|
||||
(= (:class (second item)) "mastodon-post-content")])
|
||||
false)]
|
||||
(if condition
|
||||
(assoc-in item [:content] insertion-element)
|
||||
(insert item index insertion-element)
|
||||
item)))
|
||||
|
||||
(defn masto-media->html [html media_attachments]
|
||||
(if-let [preview-image-url (get-in media_attachments [0 :preview_url])]
|
||||
(let [class-name "mastodon-post-content"
|
||||
image-element {:type :element, :attrs {:class "mastodon-post-image", :src preview-image-url}, :tag :img, :content nil}]
|
||||
(postwalk #(insert-into-class % class-name image-element) html))
|
||||
(let [image-element [:img {:class "mastodon-post-image", :src preview-image-url}]]
|
||||
(postwalk #(insert-into-content % image-element) html))
|
||||
html))
|
||||
|
||||
(defn insert-link-prev [html]
|
||||
(let [class-name "mastodon-post-link-preview"]
|
||||
(postwalk #(assoc-to-content % class-name link_preview) html)))
|
||||
(postwalk #(insert-into-post % 3 link_preview) html))
|
||||
|
||||
(defn masto-link-prev->html [html card]
|
||||
(let [{:keys [url image title description]} card]
|
||||
(-> (insert-link-prev html)
|
||||
(-> html
|
||||
(insert-link-prev)
|
||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_URL" url)
|
||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_IMG_URL" image)
|
||||
(cm/replace-all-matching-values-by-new-value "LINK_PREVIEW_TITLE" title)
|
||||
|
@ -121,7 +120,7 @@
|
|||
first)))
|
||||
out))
|
||||
|
||||
(defn account-mode [host-url account-name]
|
||||
(defn to-html [host-url account-name]
|
||||
(go
|
||||
(let [account-id (<! (find-account-id host-url account-name))
|
||||
status (->
|
|
@ -1,225 +0,0 @@
|
|||
; Licensed to the Apache Software Foundation (ASF) under one
|
||||
; or more contributor license agreements. See the NOTICE file
|
||||
; distributed with this work for additional information
|
||||
; regarding copyright ownership. The ASF licenses this file
|
||||
; to you under the Apache License, Version 2.0 (the
|
||||
; "License"); you may not use this file except in compliance
|
||||
; with the License. You may obtain a copy of the License at
|
||||
;
|
||||
; http://www.apache.org/licenses/LICENSE-2.0
|
||||
;
|
||||
; Unless required by applicable law or agreed to in writing, software
|
||||
; distributed under the License is distributed on an "AS IS" BASIS,
|
||||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
; See the License for the specific language governing permissions and
|
||||
; limitations under the License.
|
||||
|
||||
(ns dda.masto-embed.account-mode-test
|
||||
(:require
|
||||
[cljs.test :refer (deftest is)]
|
||||
[dda.masto-embed.account-mode :as sut]
|
||||
[dda.masto-embed.hiccs :as hic]
|
||||
[hickory.core :as h]
|
||||
[hickory.convert :as hc]
|
||||
[shadow.resource :as rc]))
|
||||
|
||||
(def media_attachments
|
||||
[{:description "Plastikmüll gesammelt",
|
||||
:meta
|
||||
{:original
|
||||
{:width 1500, :height 2000, :size "1500x2000", :aspect 0.75},
|
||||
:small
|
||||
{:width 416,
|
||||
:height 554,
|
||||
:size "416x554",
|
||||
:aspect 0.7509025270758123}},
|
||||
:type "image",
|
||||
:blurhash "UAFiMmx^9aE1yEjEM|%N0eD%w]t7D$%NR4tR",
|
||||
:preview_url
|
||||
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/small/0d01ddb07440328e.jpg",
|
||||
:preview_remote_url nil,
|
||||
:id "112432505467393505",
|
||||
:url
|
||||
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/original/0d01ddb07440328e.jpg",
|
||||
:remote_url nil,
|
||||
:text_url nil}])
|
||||
|
||||
(def link_prev
|
||||
{:description "forgejo - Beyond coding. We forge.",
|
||||
:author_url "",
|
||||
:image_description "",
|
||||
:width 290,
|
||||
:type "link",
|
||||
:embed_url "",
|
||||
:blurhash "URC3:FsU1xJS-8NvJ9$OFIS3wexEJ9n*xEbG",
|
||||
:title
|
||||
"forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e",
|
||||
:published_at nil,
|
||||
:provider_name "Codeberg.org",
|
||||
:language "en",
|
||||
:url
|
||||
"https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go",
|
||||
:author_name "",
|
||||
:image
|
||||
"https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png",
|
||||
:provider_url "",
|
||||
:height 290,
|
||||
:html ""})
|
||||
|
||||
(def statuses
|
||||
[{:mentions []
|
||||
:emojis []
|
||||
:tags []
|
||||
:reblog
|
||||
{:mentions []
|
||||
:emojis []
|
||||
:tags
|
||||
[{:name "hetzner"
|
||||
:url "https://social.meissa-gmbh.de/tags/hetzner"}
|
||||
{:name "devops", :url "https://social.meissa-gmbh.de/tags/devops"}
|
||||
{:name "k8s", :url "https://social.meissa-gmbh.de/tags/k8s"}
|
||||
{:name "cheap", :url "https://social.meissa-gmbh.de/tags/cheap"}]
|
||||
:reblog nil
|
||||
:replies_count 0
|
||||
:in_reply_to_account_id nil
|
||||
:reblogs_count 1
|
||||
:application nil
|
||||
:content
|
||||
"mentioned: <p>We've a new asciicast ... </p>"
|
||||
:sensitive false
|
||||
:favourites_count 2
|
||||
:in_reply_to_id nil
|
||||
:poll nil
|
||||
:account
|
||||
{:acct "jerger"
|
||||
:last_status_at "2020-06-14"
|
||||
:emojis []
|
||||
:bot false
|
||||
:group false
|
||||
:following_count 64
|
||||
:avatar_static
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/001/original/794ca61bfd71bbe1.jpg"
|
||||
:fields
|
||||
[{:name "blog"
|
||||
:value
|
||||
"<a href=\"https://domaindrivenarchitecture.org/\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">domaindrivenarchitecture.org/</span><span class=\"invisible\"></span></a>"
|
||||
:verified_at nil}
|
||||
{:name "interests"
|
||||
:value "Clojure, sci-fi, tech, DevOps, public weal"
|
||||
:verified_at nil}
|
||||
{:name "location"
|
||||
:value "Reutlingen, de, eu"
|
||||
:verified_at nil}]
|
||||
:username "jerger"
|
||||
:header_static
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/001/original/2a45f78fa1af0815.jpg"
|
||||
:discoverable true
|
||||
:statuses_count 135
|
||||
:header
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/001/original/2a45f78fa1af0815.jpg"
|
||||
:note
|
||||
"<p>meissa GmbH, Maintainer, dda-pallet, Clojure, OpenSource, DevOps, DomainDrivenDesign, Demokratie, Bürgerbeteiligung, Europa, Klettern, Wandern</p>"
|
||||
:locked false
|
||||
:id "1"
|
||||
:avatar
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/001/original/794ca61bfd71bbe1.jpg"
|
||||
:url "https://social.meissa-gmbh.de/@jerger"
|
||||
:display_name "jerger"
|
||||
:followers_count 24
|
||||
:created_at "2019-06-02T10:41:41.919Z"}
|
||||
:card
|
||||
{:description
|
||||
"We use our dda-k8s-crate to install kubernetes automatically with a nexux repository manager. See our GitHub page for more details :) https://github.com/DomainDrivenArchitecture/dda-k8s-crate"
|
||||
:author_url ""
|
||||
:width 400
|
||||
:type "link"
|
||||
:embed_url ""
|
||||
:title "Automatic kubernetes installation"
|
||||
:provider_name ""
|
||||
:url "https://asciinema.org/a/329800"
|
||||
:author_name ""
|
||||
:image
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/cache/preview_cards/images/000/024/180/original/8562ddca088c16e3.png"
|
||||
:provider_url ""
|
||||
:height 311
|
||||
:html ""}
|
||||
:language "en"
|
||||
:id "104172691066899431"
|
||||
:url "https://social.meissa-gmbh.de/@jerger/104172691066899431"
|
||||
:media_attachments []
|
||||
:uri
|
||||
"https://social.meissa-gmbh.de/users/jerger/statuses/104172691066899431"
|
||||
:visibility "public"
|
||||
:created_at "2020-05-15T13:25:19.190Z"
|
||||
:spoiler_text ""}
|
||||
:replies_count 0
|
||||
:in_reply_to_account_id nil
|
||||
:reblogs_count 0
|
||||
:application nil
|
||||
:content
|
||||
"<p>We've a new asciicast ... </p>"
|
||||
:sensitive false
|
||||
:favourites_count 0
|
||||
:in_reply_to_id nil
|
||||
:poll nil
|
||||
:account
|
||||
{:acct "team"
|
||||
:last_status_at "2020-05-17"
|
||||
:emojis []
|
||||
:bot false
|
||||
:group false
|
||||
:following_count 2
|
||||
:avatar_static
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/002/original/1aaff0c626a2ade3.png"
|
||||
:fields []
|
||||
:username "team"
|
||||
:header_static
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/002/original/2e6a592b61a2d505.jpg"
|
||||
:discoverable true
|
||||
:statuses_count 12
|
||||
:header
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/002/original/2e6a592b61a2d505.jpg"
|
||||
:note
|
||||
"<p>DevOps, Cloud, KI, Clojure, Java, Python, Reutlingen, Tübingen, Stuttgart, genossenschaftlich, OpenSource, TestDriven, Maintainer</p>"
|
||||
:locked false
|
||||
:id "2"
|
||||
:avatar
|
||||
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/002/original/1aaff0c626a2ade3.png"
|
||||
:url "https://social.meissa-gmbh.de/@team"
|
||||
:display_name "meissa-team"
|
||||
:followers_count 3
|
||||
:created_at "2019-06-02T10:50:28.976Z"}
|
||||
:card nil
|
||||
:language nil
|
||||
:id "104183256213204298"
|
||||
:url
|
||||
"https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"
|
||||
:media_attachments []
|
||||
:uri
|
||||
"https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"
|
||||
:visibility "public"
|
||||
:created_at "2020-05-17T10:12:10.403Z"
|
||||
:spoiler_text ""}])
|
||||
|
||||
; TODO: Replace this test
|
||||
;(deftest test-mastodon->html
|
||||
; (is (= [:ul {:class "list-group"}
|
||||
; '([:li {:class "list-group-item, card"}
|
||||
; [:div {:class "card-body"}
|
||||
; [:h2 {:class "card-title"} [:a {:href "https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"} "2020-05-17" " " "10:12:10"]]
|
||||
; [:p {:class "card-text"} "<p>We've a new asciicast ... </p>"
|
||||
; nil]]])]
|
||||
; (sut/masto->html statuses))))
|
||||
|
||||
(deftest test-masto-media->html
|
||||
(is (= hic/post-with-img
|
||||
(sut/masto-media->html hic/post-base-img media_attachments))))
|
||||
|
||||
(deftest test-insert-link-prev
|
||||
(is (= hic/post-with-prev
|
||||
(sut/insert-link-prev hic/post-base-prev))))
|
||||
|
||||
(deftest test-masto-link-prev->html
|
||||
(is (= hic/filled-post-with-prev
|
||||
(sut/masto-link-prev->html hic/post-base-prev link_prev))))
|
||||
|
317
src/test/dda/masto_embed/data_helpers.cljs
Normal file
317
src/test/dda/masto_embed/data_helpers.cljs
Normal file
|
@ -0,0 +1,317 @@
|
|||
(ns dda.masto-embed.data-helpers)
|
||||
|
||||
(def complete-template-post-hiccup
|
||||
[:html
|
||||
{}
|
||||
[:head {}]
|
||||
[:body
|
||||
{}
|
||||
[:section
|
||||
{:class "section post-container"}
|
||||
[:article
|
||||
{:class "mastodon-post"}
|
||||
[:header
|
||||
{:class "mastodon-post-header"}
|
||||
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-names"}
|
||||
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||
[:section
|
||||
{:class "mastodon-post-content"}
|
||||
[:p {:class "mastodon-post-text"} "POST_TEXT"]
|
||||
[:img {:class "mastodon-post-image", :src "POST_IMG_URL"}]]
|
||||
[:a
|
||||
{:href "LINK_PREVIEW_URL", :class "mastodon-post-link-preview", :target "_blank"}
|
||||
[:img {:class "mastodon-post-link-image", :src "LINK_PREVIEW_IMG_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-link-info"}
|
||||
[:h4 {:class "mastodon-post-link-title"} "LINK_PREVIEW_TITLE"]
|
||||
[:div {:class "mastodon-post-link-description"} "LINK_PREVIEW_DESC"]
|
||||
[:div {:class "mastodon-post-link-url"} "LINK_PREVIEW_URL"]]]
|
||||
[:footer
|
||||
{:class "mastodon-post-footer"}
|
||||
[:button
|
||||
{:class "footer-button replies"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button retoots"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button likes"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||
|
||||
; complete-template-post-hiccup without link prev and img
|
||||
(def post-base-img
|
||||
[:html
|
||||
{}
|
||||
[:head {}]
|
||||
[:body
|
||||
{}
|
||||
[:section
|
||||
{:class "section post-container"}
|
||||
[:article
|
||||
{:class "mastodon-post"}
|
||||
[:header
|
||||
{:class "mastodon-post-header"}
|
||||
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-names"}
|
||||
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||
[:section
|
||||
{:class "mastodon-post-content"}
|
||||
[:p {:class "mastodon-post-text"} "POST_TEXT"]]
|
||||
[:footer
|
||||
{:class "mastodon-post-footer"}
|
||||
[:button
|
||||
{:class "footer-button replies"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button retoots"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button likes"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||
|
||||
(def post-with-img
|
||||
[:html
|
||||
{}
|
||||
[:head {}]
|
||||
[:body
|
||||
{}
|
||||
[:section
|
||||
{:class "section post-container"}
|
||||
[:article
|
||||
{:class "mastodon-post"}
|
||||
[:header
|
||||
{:class "mastodon-post-header"}
|
||||
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-names"}
|
||||
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||
[:section
|
||||
{:class "mastodon-post-content"}
|
||||
[:p {:class "mastodon-post-text"} "POST_TEXT"]
|
||||
[:img {:class "mastodon-post-image", :src "POST_IMG_URL"}]]
|
||||
[:footer
|
||||
{:class "mastodon-post-footer"}
|
||||
[:button
|
||||
{:class "footer-button replies"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button retoots"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button likes"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||
|
||||
; complete-template-post-hiccup without link prev and img
|
||||
(def post-base-prev
|
||||
[:html
|
||||
{}
|
||||
[:head {}]
|
||||
[:body
|
||||
{}
|
||||
[:section
|
||||
{:class "section post-container"}
|
||||
[:article
|
||||
{:class "mastodon-post"}
|
||||
[:header
|
||||
{:class "mastodon-post-header"}
|
||||
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-names"}
|
||||
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||
[:section
|
||||
{:class "mastodon-post-content"}
|
||||
[:p {:class "mastodon-post-text"} "POST_TEXT"]]
|
||||
[:footer
|
||||
{:class "mastodon-post-footer"}
|
||||
[:button
|
||||
{:class "footer-button replies"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button retoots"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button likes"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||
|
||||
(def post-with-prev
|
||||
[:html
|
||||
{}
|
||||
[:head {}]
|
||||
[:body
|
||||
{}
|
||||
[:section
|
||||
{:class "section post-container"}
|
||||
[:article
|
||||
{:class "mastodon-post"}
|
||||
[:header
|
||||
{:class "mastodon-post-header"}
|
||||
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-names"}
|
||||
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||
[:section
|
||||
{:class "mastodon-post-content"}
|
||||
[:p {:class "mastodon-post-text"} "POST_TEXT"]]
|
||||
[:a
|
||||
{:href "LINK_PREVIEW_URL", :class "mastodon-post-link-preview", :target "_blank"}
|
||||
[:img {:class "mastodon-post-link-image", :src "LINK_PREVIEW_IMG_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-link-info"}
|
||||
[:h4 {:class "mastodon-post-link-title"} "LINK_PREVIEW_TITLE"]
|
||||
[:div {:class "mastodon-post-link-description"} "LINK_PREVIEW_DESC"]
|
||||
[:div {:class "mastodon-post-link-url"} "LINK_PREVIEW_URL"]]]
|
||||
[:footer
|
||||
{:class "mastodon-post-footer"}
|
||||
[:button
|
||||
{:class "footer-button replies"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button retoots"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button likes"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
||||
|
||||
(def filled-post-with-prev
|
||||
[:html
|
||||
{}
|
||||
[:head {}]
|
||||
[:body
|
||||
{}
|
||||
[:section
|
||||
{:class "section post-container"}
|
||||
[:article
|
||||
{:class "mastodon-post"}
|
||||
[:header
|
||||
{:class "mastodon-post-header"}
|
||||
[:img {:class "mastodon-post-avatar", :src "AVATAR_URL"}]
|
||||
[:div
|
||||
{:class "mastodon-post-names"}
|
||||
[:a {:class "display-name", :href "POST_URL"} "DISPLAY_NAME"]
|
||||
[:a {:class "account-name", :href "POST_URL"} "ACCOUNT_NAME"]]
|
||||
[:time {:class "mastodon-post-date", :datetime "DATETIME"} "TIME"]]
|
||||
[:section
|
||||
{:class "mastodon-post-content"}
|
||||
[:p {:class "mastodon-post-text"} "POST_TEXT"]]
|
||||
[:a
|
||||
{:href "https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go", :class "mastodon-post-link-preview", :target "_blank"}
|
||||
[:img {:class "mastodon-post-link-image", :src "https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png"}]
|
||||
[:div
|
||||
{:class "mastodon-post-link-info"}
|
||||
[:h4 {:class "mastodon-post-link-title"} "forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e"]
|
||||
[:div {:class "mastodon-post-link-description"} "forgejo - Beyond coding. We forge."]
|
||||
[:div {:class "mastodon-post-link-url"} "https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go"]]]
|
||||
[:footer
|
||||
{:class "mastodon-post-footer"}
|
||||
[:button
|
||||
{:class "footer-button replies"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "}]]
|
||||
[:span {:class "count reply-count"} "REPLIES_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button retoots"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"}]]
|
||||
[:span {:class "count retoot-count"} "REBLOGS_COUNT"]]
|
||||
[:button
|
||||
{:class "footer-button likes"}
|
||||
[:svg
|
||||
{:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"}
|
||||
[:path
|
||||
{:d
|
||||
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"}]]
|
||||
[:span {:class "count like-count"} "FAVOURITES_COUNT"]]]]]]])
|
|
@ -1,355 +0,0 @@
|
|||
(ns dda.masto-embed.hiccs)
|
||||
|
||||
(def post-base-img
|
||||
{:type :document,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs nil,
|
||||
:tag :html,
|
||||
:content
|
||||
[{:type :element, :attrs nil, :tag :head, :content nil}
|
||||
{:type :element,
|
||||
:attrs nil,
|
||||
:tag :body,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "section post-container"},
|
||||
:tag :section,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post"},
|
||||
:tag :article,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post-header"},
|
||||
:tag :header,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-avatar", :src "AVATAR_URL"}, :tag :img, :content nil}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-names"},
|
||||
:tag :div,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "display-name", :href "POST_URL"}, :tag :a, :content ["DISPLAY_NAME"]}
|
||||
{:type :element, :attrs {:class "account-name", :href "POST_URL"}, :tag :a, :content ["ACCOUNT_NAME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-date", :datetime "DATETIME"},
|
||||
:tag :time,
|
||||
:content ["TIME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-content"},
|
||||
:tag :section,
|
||||
:content [{:type :element, :attrs {:class "mastodon-post-text"}, :tag :p, :content ["POST_TEXT"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-footer"},
|
||||
:tag :footer,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "footer-button replies"},
|
||||
:tag :button,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"},
|
||||
:tag :svg,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs
|
||||
{:d
|
||||
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "},
|
||||
:tag :path,
|
||||
:content nil}]}
|
||||
{:type :element, :attrs {:class "count reply-count"}, :tag :span, :content ["REPLIES_COUNT"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "footer-button retoots"},
|
||||
:tag :button,
|
||||
:content
|
||||
["src/main/dda/masto_embed/resources/post.html"
|
||||
{:type :element,
|
||||
:attrs {:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"},
|
||||
:tag :svg,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs
|
||||
{:d
|
||||
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"},
|
||||
:tag :path,
|
||||
:content nil}]}
|
||||
{:type :element, :attrs {:class "count retoot-count"}, :tag :span, :content ["REBLOGS_COUNT"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "footer-button likes"},
|
||||
:tag :button,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"},
|
||||
:tag :svg,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs
|
||||
{:d
|
||||
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"},
|
||||
:tag :path,
|
||||
:content nil}]}
|
||||
{:type :element,
|
||||
:attrs {:class "count like-count"},
|
||||
:tag :span,
|
||||
:content ["FAVOURITES_COUNT"]}]}]}]}]}]}]}]})
|
||||
|
||||
(def post-with-img
|
||||
{:type :document,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs nil,
|
||||
:tag :html,
|
||||
:content
|
||||
[{:type :element, :attrs nil, :tag :head, :content nil}
|
||||
{:type :element,
|
||||
:attrs nil,
|
||||
:tag :body,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "section post-container"},
|
||||
:tag :section,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post"},
|
||||
:tag :article,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post-header"},
|
||||
:tag :header,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-avatar", :src "AVATAR_URL"}, :tag :img, :content nil}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-names"},
|
||||
:tag :div,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "display-name", :href "POST_URL"}, :tag :a, :content ["DISPLAY_NAME"]}
|
||||
{:type :element, :attrs {:class "account-name", :href "POST_URL"}, :tag :a, :content ["ACCOUNT_NAME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-date", :datetime "DATETIME"},
|
||||
:tag :time,
|
||||
:content ["TIME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-content"},
|
||||
:tag :section,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-text"}, :tag :p, :content ["POST_TEXT"]}
|
||||
{:type :element,
|
||||
:attrs
|
||||
{:class "mastodon-post-image",
|
||||
:src
|
||||
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/small/0d01ddb07440328e.jpg"},
|
||||
:tag :img,
|
||||
:content nil}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-footer"},
|
||||
:tag :footer,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "footer-button replies"},
|
||||
:tag :button,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 23.999989 18.905102", :fill "currentColor"},
|
||||
:tag :svg,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs
|
||||
{:d
|
||||
"M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "},
|
||||
:tag :path,
|
||||
:content nil}]}
|
||||
{:type :element, :attrs {:class "count reply-count"}, :tag :span, :content ["REPLIES_COUNT"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "footer-button retoots"},
|
||||
:tag :button,
|
||||
:content
|
||||
["src/main/dda/masto_embed/resources/post.html"
|
||||
{:type :element,
|
||||
:attrs {:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 15.292642", :fill "currentColor"},
|
||||
:tag :svg,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs
|
||||
{:d
|
||||
"M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"},
|
||||
:tag :path,
|
||||
:content nil}]}
|
||||
{:type :element, :attrs {:class "count retoot-count"}, :tag :span, :content ["REBLOGS_COUNT"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "footer-button likes"},
|
||||
:tag :button,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:xmlns "http://www.w3.org/2000/svg", :viewbox "0 0 24 22.799999", :fill "currentColor"},
|
||||
:tag :svg,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs
|
||||
{:d
|
||||
"M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"},
|
||||
:tag :path,
|
||||
:content nil}]}
|
||||
{:type :element,
|
||||
:attrs {:class "count like-count"},
|
||||
:tag :span,
|
||||
:content ["FAVOURITES_COUNT"]}]}]}]}]}]}]}]})
|
||||
|
||||
(def post-base-prev
|
||||
{:type :document,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs nil,
|
||||
:tag :html,
|
||||
:content
|
||||
[{:type :element, :attrs nil, :tag :head, :content nil}
|
||||
{:type :element,
|
||||
:attrs nil,
|
||||
:tag :body,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "section post-container"},
|
||||
:tag :section,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post"},
|
||||
:tag :article,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post-header"},
|
||||
:tag :header,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-avatar", :src "AVATAR_URL"}, :tag :img, :content nil}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-names"},
|
||||
:tag :div,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "display-name", :href "POST_URL"}, :tag :a, :content ["DISPLAY_NAME"]}
|
||||
{:type :element, :attrs {:class "account-name", :href "POST_URL"}, :tag :a, :content ["ACCOUNT_NAME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-date", :datetime "DATETIME"},
|
||||
:tag :time,
|
||||
:content ["TIME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-content"},
|
||||
:tag :section,
|
||||
:content [{:type :element, :attrs {:class "mastodon-post-text"}, :tag :p, :content ["POST_TEXT"]}]}
|
||||
{:type :element,
|
||||
:attrs {:href "LINK_PREVIEW_URL", :class "mastodon-post-link-preview", :target "_blank"},
|
||||
:tag :a,
|
||||
:content nil}]}]}]}]}]})
|
||||
|
||||
(def filled-post-with-prev
|
||||
{:type :document,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs nil,
|
||||
:tag :html,
|
||||
:content
|
||||
[{:type :element, :attrs nil, :tag :head, :content nil}
|
||||
{:type :element,
|
||||
:attrs nil,
|
||||
:tag :body,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "section post-container"},
|
||||
:tag :section,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post"},
|
||||
:tag :article,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post-header"},
|
||||
:tag :header,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-avatar", :src "AVATAR_URL"}, :tag :img, :content nil}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-names"},
|
||||
:tag :div,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "display-name", :href "POST_URL"}, :tag :a, :content ["DISPLAY_NAME"]}
|
||||
{:type :element, :attrs {:class "account-name", :href "POST_URL"}, :tag :a, :content ["ACCOUNT_NAME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-date", :datetime "DATETIME"},
|
||||
:tag :time,
|
||||
:content ["TIME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-content"},
|
||||
:tag :section,
|
||||
:content [{:type :element, :attrs {:class "mastodon-post-text"}, :tag :p, :content ["POST_TEXT"]}]}
|
||||
{:type :element,
|
||||
:attrs {:href "https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go", :class "mastodon-post-link-preview", :target "_blank"},
|
||||
:tag :a,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post-link-image", :src "https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png"},
|
||||
:tag :img,
|
||||
:content nil}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-link-info"},
|
||||
:tag :div,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-link-title"}, :tag :h4, :content ["forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e"]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-link-description"},
|
||||
:tag :div,
|
||||
:content ["forgejo - Beyond coding. We forge."]}
|
||||
{:type :element, :attrs {:class "mastodon-post-link-url"}, :tag :div, :content ["https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go"]}]}]}]}]}]}]}]})
|
||||
|
||||
(def post-with-prev
|
||||
{:type :document,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs nil,
|
||||
:tag :html,
|
||||
:content
|
||||
[{:type :element, :attrs nil, :tag :head, :content nil}
|
||||
{:type :element,
|
||||
:attrs nil,
|
||||
:tag :body,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "section post-container"},
|
||||
:tag :section,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post"},
|
||||
:tag :article,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post-header"},
|
||||
:tag :header,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-avatar", :src "AVATAR_URL"}, :tag :img, :content nil}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-names"},
|
||||
:tag :div,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "display-name", :href "POST_URL"}, :tag :a, :content ["DISPLAY_NAME"]}
|
||||
{:type :element, :attrs {:class "account-name", :href "POST_URL"}, :tag :a, :content ["ACCOUNT_NAME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-date", :datetime "DATETIME"},
|
||||
:tag :time,
|
||||
:content ["TIME"]}]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-content"},
|
||||
:tag :section,
|
||||
:content [{:type :element, :attrs {:class "mastodon-post-text"}, :tag :p, :content ["POST_TEXT"]}]}
|
||||
{:type :element,
|
||||
:attrs {:href "LINK_PREVIEW_URL", :class "mastodon-post-link-preview", :target "_blank"},
|
||||
:tag :a,
|
||||
:content
|
||||
[{:type :element,
|
||||
:attrs {:class "mastodon-post-link-image", :src "LINK_PREVIEW_IMG_URL"},
|
||||
:tag :img,
|
||||
:content nil}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-link-info"},
|
||||
:tag :div,
|
||||
:content
|
||||
[{:type :element, :attrs {:class "mastodon-post-link-title"}, :tag :h4, :content ["LINK_PREVIEW_TITLE"]}
|
||||
{:type :element,
|
||||
:attrs {:class "mastodon-post-link-description"},
|
||||
:tag :div,
|
||||
:content ["LINK_PREVIEW_DESC"]}
|
||||
{:type :element, :attrs {:class "mastodon-post-link-url"}, :tag :div, :content ["LINK_PREVIEW_URL"]}]}]}]}]}]}]}]})
|
|
@ -1,12 +0,0 @@
|
|||
<section class="section post-container">
|
||||
<article class="mastodon-post">
|
||||
<header class="mastodon-post-header">
|
||||
<img class="mastodon-post-avatar" src="AVATAR_URL"></img>
|
||||
<div class="mastodon-post-names">
|
||||
<a class="display-name" href="POST_URL">DISPLAY_NAME</a>
|
||||
<a class="account-name" href="POST_URL">ACCOUNT_NAME</a>
|
||||
</div>
|
||||
<time class="mastodon-post-date" datetime="DATETIME">TIME</time>
|
||||
</header>
|
||||
</article>
|
||||
</section>
|
|
@ -1,43 +0,0 @@
|
|||
<section class="section post-container">
|
||||
<article class="mastodon-post">
|
||||
<header class="mastodon-post-header">
|
||||
<img class="mastodon-post-avatar" src="AVATAR_URL"></img>
|
||||
<div class="mastodon-post-names">
|
||||
<a class="display-name" href="POST_URL">DISPLAY_NAME</a>
|
||||
<a class="account-name" href="POST_URL">ACCOUNT_NAME</a>
|
||||
</div>
|
||||
<time class="mastodon-post-date" datetime="DATETIME">TIME</time>
|
||||
</header>
|
||||
<section class="mastodon-post-content">
|
||||
<p class="mastodon-post-text">POST_TEXT</p>
|
||||
</section>
|
||||
<a href="LINK_PREVIEW_URL" class="mastodon-post-link-preview" target="_blank">
|
||||
<img class="mastodon-post-link-image" src="LINK_PREVIEW_IMG_URL"></img>
|
||||
<div class="mastodon-post-link-info">
|
||||
<h4 class="mastodon-post-link-title">LINK_PREVIEW_TITLE</h4>
|
||||
<div class="mastodon-post-link-description">LINK_PREVIEW_DESC</div>
|
||||
<div class="mastodon-post-link-url">LINK_PREVIEW_URL</div>
|
||||
</div>
|
||||
</a>
|
||||
<footer class="mastodon-post-footer">
|
||||
<button class="footer-button replies">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor">
|
||||
<path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "/>
|
||||
</svg>
|
||||
<span class="count reply-count">REPLIES_COUNT</span>
|
||||
</button>
|
||||
<button class="footer-button retoots">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor">
|
||||
<path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"/>
|
||||
</svg>
|
||||
<span class="count retoot-count">REBLOGS_COUNT</span>
|
||||
</button>
|
||||
<button class="footer-button likes">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor">
|
||||
<path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"/>
|
||||
</svg>
|
||||
<span class="count like-count">FAVOURITES_COUNT</span>
|
||||
</button>
|
||||
</footer>
|
||||
</article>
|
||||
</section>
|
|
@ -1,36 +0,0 @@
|
|||
<section class="section post-container">
|
||||
<article class="mastodon-post">
|
||||
<header class="mastodon-post-header">
|
||||
<img class="mastodon-post-avatar" src="AVATAR_URL"></img>
|
||||
<div class="mastodon-post-names">
|
||||
<a class="display-name" href="POST_URL">DISPLAY_NAME</a>
|
||||
<a class="account-name" href="POST_URL">ACCOUNT_NAME</a>
|
||||
</div>
|
||||
<time class="mastodon-post-date" datetime="DATETIME">TIME</time>
|
||||
</header>
|
||||
<section class="mastodon-post-content">
|
||||
<p class="mastodon-post-text">POST_TEXT</p>
|
||||
<img class="mastodon-post-image" src="https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/original/0d01ddb07440328e.jpg"></img>
|
||||
</section>
|
||||
<footer class="mastodon-post-footer">
|
||||
<button class="footer-button replies">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor">
|
||||
<path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "/>
|
||||
</svg>
|
||||
<span class="count reply-count">REPLIES_COUNT</span>
|
||||
</button>
|
||||
<button class="footer-button retoots">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor">
|
||||
<path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"/>
|
||||
</svg>
|
||||
<span class="count retoot-count">REBLOGS_COUNT</span>
|
||||
</button>
|
||||
<button class="footer-button likes">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor">
|
||||
<path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"/>
|
||||
</svg>
|
||||
<span class="count like-count">FAVOURITES_COUNT</span>
|
||||
</button>
|
||||
</footer>
|
||||
</article>
|
||||
</section>
|
|
@ -1,44 +0,0 @@
|
|||
<section class="section post-container">
|
||||
<article class="mastodon-post">
|
||||
<header class="mastodon-post-header">
|
||||
<img class="mastodon-post-avatar" src="AVATAR_URL"></img>
|
||||
<div class="mastodon-post-names">
|
||||
<a class="display-name" href="POST_URL">DISPLAY_NAME</a>
|
||||
<a class="account-name" href="POST_URL">ACCOUNT_NAME</a>
|
||||
</div>
|
||||
<time class="mastodon-post-date" datetime="DATETIME">TIME</time>
|
||||
</header>
|
||||
<section class="mastodon-post-content">
|
||||
<p class="mastodon-post-text">POST_TEXT</p>
|
||||
<img class="mastodon-post-image" src="https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/original/0d01ddb07440328e.jpg"></img>
|
||||
</section>
|
||||
<a href="LINK_PREVIEW_URL" class="mastodon-post-link-preview" target="_blank">
|
||||
<img class="mastodon-post-link-image" src="LINK_PREVIEW_IMG_URL"></img>
|
||||
<div class="mastodon-post-link-info">
|
||||
<h4 class="mastodon-post-link-title">LINK_PREVIEW_TITLE</h4>
|
||||
<div class="mastodon-post-link-description">LINK_PREVIEW_DESC</div>
|
||||
<div class="mastodon-post-link-url">LINK_PREVIEW_URL</div>
|
||||
</div>
|
||||
</a>
|
||||
<footer class="mastodon-post-footer">
|
||||
<button class="footer-button replies">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.999989 18.905102" fill="currentColor">
|
||||
<path d="M 12.605469 0 C 6.3127313 -3.016065e-07 1.2128906 3.6227598 1.2128906 8.0917969 C 1.2082806 9.3482967 1.6202949 10.587431 2.4179688 11.708984 C 2.4578657 11.764164 2.498768 11.811806 2.5390625 11.865234 C 3.3268045 11.641832 4.3869061 11.848285 5.3300781 12.486328 C 6.3288461 13.162012 6.9253832 14.138795 6.953125 14.988281 C 7.1369873 15.068801 7.3124925 15.149004 7.5117188 15.232422 C 9.0912976 15.798243 10.836341 16.090505 12.605469 16.087891 C 16.920323 16.086691 20.863977 14.35437 22.792969 11.613281 C 23.580255 10.506333 23.991872 9.2846052 23.998047 8.0449219 C 23.962291 3.5975966 18.876044 0 12.605469 0 z M 23.998047 8.0449219 C 23.998174 8.0606359 24 8.0760629 24 8.0917969 L 24 7.9960938 C 24.00006 8.0124607 23.998147 8.0285639 23.998047 8.0449219 z M 2.9121094 12.222656 C 2.2425334 12.223796 1.667313 12.46211 1.3457031 12.9375 C 1.1638316 13.204122 1.077675 13.531936 1.09375 13.890625 C 1.1537212 14.293189 1.209808 14.432962 1.3125 14.671875 C 1.4316055 14.948973 1.7207031 15.40625 1.7207031 15.40625 C 1.9907532 15.764415 2.3364315 16.089696 2.7304688 16.355469 C 3.6907784 17.004767 4.8168668 17.230272 5.640625 16.9375 C 5.9710419 16.821946 6.2362892 16.627161 6.4160156 16.369141 C 7.0592353 15.418362 6.445179 13.878941 5.0449219 12.931641 C 4.3447931 12.457991 3.5816854 12.221516 2.9121094 12.222656 z M 1.0195312 16.197266 C 0.64478833 16.1979 0.32257415 16.331594 0.14257812 16.597656 C 0.040789845 16.746877 -0.007044805 16.928158 0.001953125 17.128906 C 0.035517005 17.35421 0.065572735 17.432694 0.12304688 17.566406 C 0.18970686 17.72149 0.3515625 17.978516 0.3515625 17.978516 C 0.50270196 18.178971 0.69743713 18.361021 0.91796875 18.509766 C 1.4554271 18.873168 2.0858405 18.99784 2.546875 18.833984 C 2.7316813 18.769352 2.8798841 18.661846 2.9804688 18.517578 C 3.3404608 17.985454 2.9965753 17.123927 2.2128906 16.59375 C 1.8210482 16.328648 1.3942742 16.196631 1.0195312 16.197266 z "/>
|
||||
</svg>
|
||||
<span class="count reply-count">REPLIES_COUNT</span>
|
||||
</button>
|
||||
<button class="footer-button retoots">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 15.292642" fill="currentColor">
|
||||
<path d="M 5.5533678,0 C 3.6714839,2.400492 1.6157603,5.1817846 0,7.362011 c 1.4380083,0 2.4385201,-5.881e-4 3.6172864,0.024507 v 3.36241 c 0,2.591649 -0.00735,3.641069 -0.00735,4.541214 0.9377142,0 1.8786511,0.0025 4.6000315,0.0025 h 9.6117861 c -0.967065,-1.240489 -1.863419,-2.423552 -2.791388,-3.644245 -2.391113,-0.01058 -5.4310727,0 -7.7149168,0 0,-1.389694 0.00491,-2.9515088 0.00491,-4.2863375 H 10.998903 C 9.4664195,5.0599896 7.0361202,1.897534 5.5533678,0 Z m 0.6249377,0 c 0.9523292,1.225788 1.9124438,2.5142572 2.7766839,3.6368923 2.3911146,0.010578 5.4433266,0.00491 7.7271706,0.00491 0,1.3896944 -0.0025,2.9515086 -0.0025,4.2863373 h -3.678556 c 1.532486,2.3020214 3.962784,5.4669284 5.445536,7.3644624 1.881875,-2.400496 3.9376,-5.18424 5.55336,-7.3644663 -1.438009,0 -2.440971,5.881e-4 -3.619738,-0.024507 V 4.5412139 c 0,-2.5916487 0.0098,-3.64106836 0.0098,-4.5412139 -0.937714,0 -1.881102,0 -4.602482,0 z"/>
|
||||
</svg>
|
||||
<span class="count retoot-count">REBLOGS_COUNT</span>
|
||||
</button>
|
||||
<button class="footer-button likes">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.799999" fill="currentColor">
|
||||
<path d="M 12,18.324 19.416,22.8 17.448,14.364 24,8.688 15.372,7.956 12,0 8.628,7.956 0,8.688 6.552,14.364 4.584,22.8 Z"/>
|
||||
</svg>
|
||||
<span class="count like-count">FAVOURITES_COUNT</span>
|
||||
</button>
|
||||
</footer>
|
||||
</article>
|
||||
</section>
|
90
src/test/dda/masto_embed/to_html_test.cljs
Normal file
90
src/test/dda/masto_embed/to_html_test.cljs
Normal file
|
@ -0,0 +1,90 @@
|
|||
; Licensed to the Apache Software Foundation (ASF) under one
|
||||
; or more contributor license agreements. See the NOTICE file
|
||||
; distributed with this work for additional information
|
||||
; regarding copyright ownership. The ASF licenses this file
|
||||
; to you under the Apache License, Version 2.0 (the
|
||||
; "License"); you may not use this file except in compliance
|
||||
; with the License. You may obtain a copy of the License at
|
||||
;
|
||||
; http://www.apache.org/licenses/LICENSE-2.0
|
||||
;
|
||||
; Unless required by applicable law or agreed to in writing, software
|
||||
; distributed under the License is distributed on an "AS IS" BASIS,
|
||||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
; See the License for the specific language governing permissions and
|
||||
; limitations under the License.
|
||||
|
||||
(ns dda.masto-embed.to-html-test
|
||||
(:require
|
||||
[cljs.test :refer (deftest is)]
|
||||
[dda.masto-embed.to-html :as sut]
|
||||
[dda.masto-embed.data-helpers :as dh]
|
||||
[hickory.core :as h]
|
||||
[hickory.convert :as hc]
|
||||
[shadow.resource :as rc]))
|
||||
|
||||
(def media_attachments
|
||||
[{:description "Plastikmüll gesammelt",
|
||||
:meta
|
||||
{:original
|
||||
{:width 1500, :height 2000, :size "1500x2000", :aspect 0.75},
|
||||
:small
|
||||
{:width 416,
|
||||
:height 554,
|
||||
:size "416x554",
|
||||
:aspect 0.7509025270758123}},
|
||||
:type "image",
|
||||
:blurhash "UAFiMmx^9aE1yEjEM|%N0eD%w]t7D$%NR4tR",
|
||||
:preview_url
|
||||
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/small/0d01ddb07440328e.jpg",
|
||||
:preview_remote_url nil,
|
||||
:id "112432505467393505",
|
||||
:url
|
||||
"https://cdn.masto.host/socialmeissagmbhde/media_attachments/files/112/432/505/467/393/505/original/0d01ddb07440328e.jpg",
|
||||
:remote_url nil,
|
||||
:text_url nil}])
|
||||
|
||||
(def link_prev
|
||||
{:description "forgejo - Beyond coding. We forge.",
|
||||
:author_url "",
|
||||
:image_description "",
|
||||
:width 290,
|
||||
:type "link",
|
||||
:embed_url "",
|
||||
:blurhash "URC3:FsU1xJS-8NvJ9$OFIS3wexEJ9n*xEbG",
|
||||
:title
|
||||
"forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e",
|
||||
:published_at nil,
|
||||
:provider_name "Codeberg.org",
|
||||
:language "en",
|
||||
:url
|
||||
"https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go",
|
||||
:author_name "",
|
||||
:image
|
||||
"https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png",
|
||||
:provider_url "",
|
||||
:height 290,
|
||||
:html ""})
|
||||
|
||||
; TODO: Replace this test
|
||||
;(deftest test-mastodon->html
|
||||
; (is (= [:ul {:class "list-group"}
|
||||
; '([:li {:class "list-group-item, card"}
|
||||
; [:div {:class "card-body"}
|
||||
; [:h2 {:class "card-title"} [:a {:href "https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"} "2020-05-17" " " "10:12:10"]]
|
||||
; [:p {:class "card-text"} "<p>We've a new asciicast ... </p>"
|
||||
; nil]]])]
|
||||
; (sut/masto->html statuses))))
|
||||
|
||||
(deftest test-masto-media->html
|
||||
(is (= dh/post-with-img
|
||||
(sut/masto-media->html dh/post-base-img media_attachments))))
|
||||
|
||||
(deftest test-insert-link-prev
|
||||
(is (= dh/post-with-prev
|
||||
(sut/insert-link-prev dh/post-base-prev))))
|
||||
|
||||
(deftest test-masto-link-prev->html
|
||||
(is (= dh/filled-post-with-prev
|
||||
(sut/masto-link-prev->html dh/post-base-prev link_prev))))
|
||||
|
Loading…
Reference in a new issue