Split out text ns to graph-parser

This commit is contained in:
Gabriel Horner
2022-05-09 14:45:28 -04:00
parent f529777d78
commit 65804b4183
29 changed files with 131 additions and 103 deletions

View File

@@ -7,7 +7,7 @@
[frontend.db :as db]
[frontend.format :as format]
[frontend.state :as state]
[frontend.text :as text]
[logseq.graph-parser.text :as text]
[frontend.utf8 :as utf8]
[frontend.util :as util]
[frontend.util.property :as property]
@@ -185,7 +185,7 @@
(remove string/blank? v)
(if (string/blank? v)
nil
(text/parse-property format k v)))
(text/parse-property format k v (state/get-config))))
k (keyword k)
v (if (and
(string? v)

View File

@@ -1,6 +1,7 @@
(ns frontend.format.mldoc
(:require [clojure.string :as string]
[frontend.format.protocol :as protocol]
[frontend.state :as state]
[goog.object :as gobj]
[lambdaisland.glogi :as log]
["mldoc" :as mldoc :refer [Mldoc]]
@@ -43,15 +44,20 @@
(if (string/blank? content)
{}
(let [[headers blocks] (-> content (parse-opml) (gp-util/json->clj))]
[headers (gp-mldoc/collect-page-properties blocks gp-mldoc/parse-property)]))
[headers (gp-mldoc/collect-page-properties blocks gp-mldoc/parse-property (state/get-config))]))
(catch js/Error e
(log/error :edn/convert-failed e)
[])))
(defn ->edn
"Wrapper around gp-mldoc/->edn which provides config state"
[content config]
(gp-mldoc/->edn content config (state/get-config)))
(defrecord MldocMode []
protocol/Format
(toEdn [_this content config]
(gp-mldoc/->edn content config))
(->edn content config))
(toHtml [_this content config references]
(export "html" content config references))
(loaded? [_this]