mirror of https://github.com/logseq/logseq
Add two editable org built-in properties
Also ported old filetags property tests from b991599244
.
pull/6225/head
parent
f01e8d0ea9
commit
42b7f5d189
|
@ -33,7 +33,9 @@
|
|||
(defn editable-built-in-properties
|
||||
"Properties used by logseq that user can edit"
|
||||
[]
|
||||
(into #{:title :icon :template :template-including-parent :public :filters :exclude-from-graph-view}
|
||||
(into #{:title :icon :template :template-including-parent :public :filters :exclude-from-graph-view
|
||||
;; org-mode only
|
||||
:macro :filetags}
|
||||
editable-linkable-built-in-properties))
|
||||
|
||||
(defn hidden-built-in-properties
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
" md-config {})))
|
||||
"Src example with leading whitespace"))
|
||||
|
||||
(deftest properties-test
|
||||
(deftest md-properties-test
|
||||
(are [x y] (= [["Properties" y] nil]
|
||||
(first (gp-mldoc/->edn x md-config {})))
|
||||
|
||||
|
@ -98,6 +98,28 @@
|
|||
(first (gp-mldoc/->edn "term
|
||||
: definition" md-config {})))))
|
||||
|
||||
(defn- parse-properties
|
||||
[text]
|
||||
(->> (gp-mldoc/->edn text (gp-mldoc/default-config :org) {})
|
||||
(filter #(= "Properties" (ffirst %)))
|
||||
ffirst
|
||||
second))
|
||||
|
||||
(deftest org-properties-test
|
||||
[]
|
||||
(testing "just title"
|
||||
(let [content "#+TITLE: some title "
|
||||
props (parse-properties content)]
|
||||
(is (= "some title " (:title props)))))
|
||||
|
||||
(testing "filetags"
|
||||
(let [content "#+FILETAGS: :tag1:tag2:@tag:
|
||||
#+TAGS: tag3
|
||||
body"
|
||||
props (parse-properties content)]
|
||||
(is ["@tag" "tag1" "tag2"] (sort (:filetags props)))
|
||||
(is ["@tag" "tag1" "tag2" "tag3"] (sort (:tags props))))))
|
||||
|
||||
(deftest ^:integration test->edn
|
||||
(let [graph-dir "test/docs"
|
||||
_ (docs-graph-helper/clone-docs-repo-if-not-exists graph-dir)
|
||||
|
|
Loading…
Reference in New Issue