mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 10:56:32 +00:00
fix(export): replace page-ref-id with its block/title
This commit is contained in:
@@ -4,19 +4,19 @@
|
||||
when use together with dynamic var."
|
||||
(:refer-clojure :exclude [map filter mapcat concat remove])
|
||||
(:require [cljs.core.match :refer [match]]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.string :as string]
|
||||
[frontend.db :as db]
|
||||
[frontend.format.mldoc :as mldoc]
|
||||
[frontend.modules.file.core :as outliner-file]
|
||||
[frontend.modules.outliner.tree :as outliner-tree]
|
||||
[frontend.persist-db.browser :as db-browser]
|
||||
[frontend.state :as state]
|
||||
[frontend.util :as util :refer [concatv mapcatv removev]]
|
||||
[frontend.worker.export :as worker-export]
|
||||
[malli.core :as m]
|
||||
[malli.util :as mu]
|
||||
[promesa.core :as p]
|
||||
[frontend.persist-db.browser :as db-browser]
|
||||
[frontend.worker.export :as worker-export]
|
||||
[clojure.edn :as edn]))
|
||||
[promesa.core :as p]))
|
||||
|
||||
;;; TODO: split frontend.handler.export.text related states
|
||||
(def ^:dynamic *state*
|
||||
@@ -59,10 +59,9 @@
|
||||
(defn- get-blocks-contents
|
||||
[repo root-block-uuid & {:keys [init-level]
|
||||
:or {init-level 1}}]
|
||||
(->
|
||||
(db/get-block-and-children repo root-block-uuid)
|
||||
(outliner-tree/blocks->vec-tree (str root-block-uuid))
|
||||
(outliner-file/tree->file-content {:init-level init-level})))
|
||||
(-> (db/pull-many (keep :db/id (db/get-block-and-children repo root-block-uuid)))
|
||||
(outliner-tree/blocks->vec-tree (str root-block-uuid))
|
||||
(outliner-file/tree->file-content {:init-level init-level})))
|
||||
|
||||
(defn root-block-uuids->content
|
||||
[repo root-block-uuids]
|
||||
@@ -522,7 +521,6 @@
|
||||
[[tp _]]
|
||||
(= tp "Properties"))
|
||||
|
||||
|
||||
(defn replace-Heading-with-Paragraph
|
||||
"works on block-ast
|
||||
replace all heading with paragraph when indent-style is no-indent"
|
||||
@@ -561,7 +559,6 @@
|
||||
:result-ast-tcoll
|
||||
persistent!))
|
||||
|
||||
|
||||
;;; inline transformers
|
||||
|
||||
(defn remove-emphasis
|
||||
@@ -585,6 +582,9 @@
|
||||
(if (and (= "Page_ref" (first url))
|
||||
(or (empty? label)
|
||||
(= label [["Plain" ""]])))
|
||||
;; (let [plain-text (second url)]
|
||||
;; (if (db-content/))
|
||||
;; )
|
||||
["Plain" (second url)]
|
||||
inline-ast))
|
||||
;; else
|
||||
@@ -823,11 +823,9 @@
|
||||
|
||||
;;; simple ast (ends)
|
||||
|
||||
|
||||
;;; TODO: walk the hiccup tree,
|
||||
;;; and call escape-html on all its contents
|
||||
;;;
|
||||
|
||||
|
||||
;;; walk the hiccup tree,
|
||||
;;; and call escape-html on all its contents (ends)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
(ns frontend.worker.export
|
||||
"Export data"
|
||||
(:require [logseq.db :as ldb]
|
||||
[logseq.outliner.tree :as otree]
|
||||
(:require [datascript.core :as d]
|
||||
[frontend.db :as db]
|
||||
[frontend.worker.file.core :as worker-file]
|
||||
[datascript.core :as d]
|
||||
[logseq.graph-parser.property :as gp-property]))
|
||||
[logseq.db :as ldb]
|
||||
[logseq.graph-parser.property :as gp-property]
|
||||
[logseq.outliner.tree :as otree]))
|
||||
|
||||
(defn block->content
|
||||
"Converts a block including its children (recursively) to plain-text."
|
||||
@@ -14,7 +15,7 @@
|
||||
(if (ldb/page? (d/entity db [:block/uuid root-block-uuid]))
|
||||
0
|
||||
1))
|
||||
blocks (ldb/get-block-and-children db root-block-uuid)
|
||||
blocks (db/pull-many (keep :db/id (ldb/get-block-and-children db root-block-uuid)))
|
||||
tree (otree/blocks->vec-tree repo db blocks (str root-block-uuid))]
|
||||
(worker-file/tree->file-content repo db tree
|
||||
(assoc tree->file-opts :init-level init-level)
|
||||
|
||||
Reference in New Issue
Block a user