|
@@ -1,13 +1,11 @@
|
|
|
(ns logseq.graph-parser.property
|
|
|
- "Core vars and util fns for properties"
|
|
|
+ "Core vars and util fns for properties and file based graphs"
|
|
|
(:require [logseq.graph-parser.util :as gp-util]
|
|
|
[clojure.string :as string]
|
|
|
[clojure.set :as set]
|
|
|
[goog.string :as gstring]
|
|
|
[goog.string.format]))
|
|
|
|
|
|
-;; Graph agnostic fns
|
|
|
-;; ==================
|
|
|
(def colons "Property delimiter for markdown mode" "::")
|
|
|
(defn colons-org
|
|
|
"Property delimiter for org mode"
|
|
@@ -28,9 +26,6 @@
|
|
|
(contains? #{"Property_Drawer" "Properties"}
|
|
|
(first block))))
|
|
|
|
|
|
-;; Configuration and fns for older, file graph properties
|
|
|
-;; =============
|
|
|
-
|
|
|
(defn valid-property-name?
|
|
|
[s]
|
|
|
{:pre [(string? s)]}
|
|
@@ -162,89 +157,4 @@
|
|
|
lines (concat before middle after)]
|
|
|
(string/join "\n" lines))
|
|
|
content))
|
|
|
- content))
|
|
|
-
|
|
|
-;; Configuration and fns for db graph properties
|
|
|
-;; =============
|
|
|
-
|
|
|
-;; FIXME: no support for built-in-extended-properties
|
|
|
-(def db-built-in-properties
|
|
|
- "Map of built in properties for db graphs. Each property has a config map with
|
|
|
- the following keys:
|
|
|
- * :schema - Property's schema. Required key
|
|
|
- * :original-name - Property's :block/original-name
|
|
|
- * :attribute - Property keyword that is saved to a datascript attribute outside of :block/properties
|
|
|
- * :visible - Boolean to indicate user can see and use this property"
|
|
|
- {:alias {:original-name "Alias"
|
|
|
- :attribute :block/alias
|
|
|
- :visible true
|
|
|
- :schema {:type :page
|
|
|
- :cardinality :many}}
|
|
|
- :tags {:original-name "Tags"
|
|
|
- :attribute :block/tags
|
|
|
- :visible true
|
|
|
- :schema {:type :page
|
|
|
- :cardinality :many}}
|
|
|
- :background-color {:schema {:type :default}}
|
|
|
- :heading {:schema {:type :any}} ; number (1-6) or boolean for auto heading
|
|
|
- :query-table {:schema {:type :checkbox}}
|
|
|
- ;; query-properties is a coll of property uuids and keywords where keywords are special frontend keywords
|
|
|
- :query-properties {:schema {:type :coll}}
|
|
|
- ;; query-sort-by is either a property uuid or a keyword where keyword is a special frontend keyword
|
|
|
- :query-sort-by {:schema {:type :any}}
|
|
|
- :query-sort-desc {:schema {:type :checkbox}}
|
|
|
- :logseq.query/nlp-date {:schema {:type :checkbox}}
|
|
|
- :ls-type {:schema {:type :keyword}}
|
|
|
- :hl-type {:schema {:type :keyword}}
|
|
|
- :hl-page {:schema {:type :number}}
|
|
|
- :hl-stamp {:schema {:type :number}}
|
|
|
- :hl-color {:schema {:type :default}}
|
|
|
- :logseq.macro-name {:schema {:type :default}}
|
|
|
- :logseq.macro-arguments {:schema {:type :default}}
|
|
|
- :logseq.order-list-type {:schema {:type :checkbox}}
|
|
|
- :logseq.tldraw.page {:schema {:type :map}}
|
|
|
- :logseq.tldraw.shape {:schema {:type :map}}
|
|
|
- ;; color props
|
|
|
- :logseq.color {:schema {:type :default}
|
|
|
- :visible true}
|
|
|
- ;; table-v2 props
|
|
|
- :logseq.table.version {:schema {:type :number}
|
|
|
- :visible true}
|
|
|
- :logseq.table.compact {:schema {:type :checkbox}
|
|
|
- :visible true}
|
|
|
- :logseq.table.headers {:schema {:type :default}
|
|
|
- :visible true}
|
|
|
- :logseq.table.hover {:schema {:type :default}
|
|
|
- :visible true}
|
|
|
- :logseq.table.borders {:schema {:type :checkbox}
|
|
|
- :visible true}
|
|
|
- :logseq.table.stripes {:schema {:type :checkbox}
|
|
|
- :visible true}
|
|
|
- :logseq.table.max-width {:schema {:type :number}
|
|
|
- :visible true}
|
|
|
-
|
|
|
- :icon {:original-name "Icon"
|
|
|
- :schema {:type :map}}
|
|
|
- :public {:schema {:type :checkbox}}
|
|
|
- :filters {:schema {:type :map}}
|
|
|
- :exclude-from-graph-view {:schema {:type :checkbox}}
|
|
|
- :created-in-property {:schema {:type :checkbox}}})
|
|
|
-
|
|
|
-(def db-visible-built-in-properties
|
|
|
- "These are built-in properties that users can see and use"
|
|
|
- (set (keep (fn [[k v]] (when (:visible v) k)) db-built-in-properties)))
|
|
|
-
|
|
|
-(defonce db-built-in-properties-keys
|
|
|
- (set (keys db-built-in-properties)))
|
|
|
-
|
|
|
-(def db-hidden-built-in-properties
|
|
|
- (set/difference db-built-in-properties-keys db-visible-built-in-properties))
|
|
|
-
|
|
|
-(defonce db-built-in-properties-keys-str
|
|
|
- (set (map name (keys db-built-in-properties))))
|
|
|
-
|
|
|
-(defn db-valid-property-name?
|
|
|
- [s]
|
|
|
- {:pre [(string? s)]}
|
|
|
- ;; Disallow tags or page refs as they would create unreferenceable page names
|
|
|
- (not (re-find #"^(#|\[\[)" s)))
|
|
|
+ content))
|