|
|
@@ -91,22 +91,27 @@
|
|
|
(defn page-add-properties!
|
|
|
[page-name properties]
|
|
|
(let [page (db/entity [:page/name page-name])
|
|
|
- page-format (db/get-page-format page-name)
|
|
|
- properties-content (db/get-page-properties-content page-name)
|
|
|
- properties-content (if properties-content
|
|
|
- (string/trim properties-content)
|
|
|
- (config/properties-wrapper page-format))]
|
|
|
- (let [file (db/entity (:db/id (:page/file page)))
|
|
|
- file-path (:file/path file)
|
|
|
- file-content (db/get-file file-path)
|
|
|
- after-content (subs file-content (inc (count properties-content)))
|
|
|
- new-properties-content (db/add-properties! page-format properties-content properties)
|
|
|
- full-content (str new-properties-content "\n\n" (string/trim after-content))]
|
|
|
- (file-handler/alter-file (state/get-current-repo)
|
|
|
- file-path
|
|
|
- full-content
|
|
|
- {:reset? true
|
|
|
- :re-render-root? true}))))
|
|
|
+ page-title (:or (:page/original-name page) (:page/name page))
|
|
|
+ file (:page/file page)]
|
|
|
+ (if file
|
|
|
+ (let [page-format (db/get-page-format page-name)
|
|
|
+ properties-content (db/get-page-properties-content page-name)
|
|
|
+ properties-content (if properties-content
|
|
|
+ (string/trim properties-content)
|
|
|
+ (config/properties-wrapper page-format))
|
|
|
+ file (db/entity (:db/id (:page/file page)))
|
|
|
+ file-path (:file/path file)
|
|
|
+ file-content (db/get-file file-path)
|
|
|
+ after-content (subs file-content (inc (count properties-content)))
|
|
|
+ new-properties-content (db/add-properties! page-format properties-content properties)
|
|
|
+ full-content (str new-properties-content "\n\n" (string/trim after-content))]
|
|
|
+ (file-handler/alter-file (state/get-current-repo)
|
|
|
+ file-path
|
|
|
+ full-content
|
|
|
+ {:reset? true
|
|
|
+ :re-render-root? true}))
|
|
|
+ (p/let [_ (create! page-name)]
|
|
|
+ (page-add-properties! page-name properties)))))
|
|
|
|
|
|
(defn page-remove-property!
|
|
|
[page-name k]
|