Add two editable org built-in properties

Also ported old filetags property tests from b991599244.
pull/6225/head
Gabriel Horner 2022-07-29 12:24:48 -04:00 committed by Andelf
parent f01e8d0ea9
commit 42b7f5d189
2 changed files with 26 additions and 2 deletions

View File

@ -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

View File

@ -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)