Refactor to to_html

Currently keeping reply_mode as ref
This commit is contained in:
erik 2024-05-28 18:04:58 +02:00
parent 6a7e7deac6
commit 142b74cd9b
4 changed files with 7 additions and 7 deletions

View file

@ -17,7 +17,7 @@
(:require (:require
[dda.masto-embed.browser :as b] [dda.masto-embed.browser :as b]
[dda.masto-embed.reply-mode :as rm] [dda.masto-embed.reply-mode :as rm]
[dda.masto-embed.account-mode :as am])) [dda.masto-embed.to-html :as am]))
(defn init [] (defn init []
(let [host-url (b/host-url-from-document) (let [host-url (b/host-url-from-document)
@ -25,5 +25,5 @@
replies-to (b/replies-to-from-document) replies-to (b/replies-to-from-document)
filter-favorited (b/filter-favorited-from-document)] filter-favorited (b/filter-favorited-from-document)]
(if (nil? replies-to) (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)))) (rm/replies-mode host-url account-name replies-to filter-favorited))))

View file

@ -22,7 +22,7 @@
[dda.masto-embed.api :as api] [dda.masto-embed.api :as api]
[dda.masto-embed.infra :as infra] [dda.masto-embed.infra :as infra]
[dda.masto-embed.browser :as b] [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 ; ToDo: Possibility to present replies to more than one post
(defn mastocard->html [card media] (defn mastocard->html [card media]

View file

@ -13,7 +13,7 @@
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and ; See the License for the specific language governing permissions and
; limitations under the License. ; limitations under the License.
(ns dda.masto-embed.account-mode (ns dda.masto-embed.to-html
(:require (:require
[cljs.core.async :refer [go chan <! >!]] [cljs.core.async :refer [go chan <! >!]]
[cljs.core.async.interop :refer-macros [<p!]] [cljs.core.async.interop :refer-macros [<p!]]
@ -120,7 +120,7 @@
first))) first)))
out)) out))
(defn account-mode [host-url account-name] (defn to-html [host-url account-name]
(go (go
(let [account-id (<! (find-account-id host-url account-name)) (let [account-id (<! (find-account-id host-url account-name))
status (-> status (->

View file

@ -14,10 +14,10 @@
; See the License for the specific language governing permissions and ; See the License for the specific language governing permissions and
; limitations under the License. ; limitations under the License.
(ns dda.masto-embed.account-mode-test (ns dda.masto-embed.to-html-test
(:require (:require
[cljs.test :refer (deftest is)] [cljs.test :refer (deftest is)]
[dda.masto-embed.account-mode :as sut] [dda.masto-embed.to-html :as sut]
[dda.masto-embed.data-helpers :as dh] [dda.masto-embed.data-helpers :as dh]
[hickory.core :as h] [hickory.core :as h]
[hickory.convert :as hc] [hickory.convert :as hc]