Fix get-tag and replace match usage

enhance/cli-graph-parser
Gabriel Horner 2022-04-21 17:03:56 -04:00
parent a28ea134d8
commit 4d85697953
1 changed files with 10 additions and 19 deletions

View File

@ -2,7 +2,6 @@
"Modified version of frontend.format.block" "Modified version of frontend.format.block"
(:require [clojure.string :as string] (:require [clojure.string :as string]
[clojure.walk :as walk] [clojure.walk :as walk]
; [cljs.core.match :as match]
; [frontend.format :as format] ; [frontend.format :as format]
; [frontend.state :as state] ; [frontend.state :as state]
[logseq.graph-parser.text :as text] [logseq.graph-parser.text :as text]
@ -30,22 +29,14 @@
(when-let [tag-value (and (vector? block) (when-let [tag-value (and (vector? block)
(= "Tag" (first block)) (= "Tag" (first block))
(second block))] (second block))]
;; TODO: Enable or replace match (->> tag-value
(-> (map (fn [[elem value]]
#_(map (fn [e] (case elem
(match/match e "Plain" value
["Plain" s] "Link" (:full_text value)
s "Nested_link" (:content value)
["Link" t] "")))
(let [{full_text :full_text} t] (string/join))))
full_text)
["Nested_link" t]
(let [ {content :content} t]
content)
:else
""
)) tag-value)
(string/join))))
(defn get-page-reference (defn get-page-reference
[block] [block]
@ -590,8 +581,8 @@
properties])) properties]))
result (with-pre-block-if-exists blocks body pre-block-properties encoded-content)] result (with-pre-block-if-exists blocks body pre-block-properties encoded-content)]
(map #(dissoc % :block/meta) result)) (map #(dissoc % :block/meta) result))
(catch js/Error _e (catch js/Error e
(js/console.error "extract-blocks-failed") (js/console.error "extract-blocks-failed" e)
#_(log/error :exception e)))) #_(log/error :exception e))))
(defn with-parent-and-left (defn with-parent-and-left