enhance(zotero): allow extra tags for each imported page

pull/2471/head^2
Weihua Lu 2021-08-06 15:24:13 +08:00
parent 67c10e3d16
commit 435c2110bc
3 changed files with 18 additions and 2 deletions

View File

@ -239,6 +239,18 @@
{:default-value (setting/setting :page-insert-prefix)
:on-blur (fn [e] (setting/set-setting! :page-insert-prefix (util/evalue e)))}]]]]
[:div.row
[:label.title
{:for "zotero_extra_tags"
:title "Extra tags to add for every imported page. Separate by comma, or leave it empty."}
"Extra tags to add:"]
[:div.mt-1.sm:mt-0.sm:col-span-2
[:div.max-w-lg.rounded-md
[:input.form-input.block
{:default-value (setting/setting :extra-tags)
:placeholder "tag1,tag2,tag3"
:on-blur (fn [e] (setting/set-setting! :extra-tags (util/evalue e)))}]]]]
[:div.row
[:label.title
{:for "zotero_import_all"}

View File

@ -58,8 +58,11 @@
(let [tags
(->> (-> item :data :tags)
(mapv (fn [{:keys [tag]}] (string/trim tag)))
(mapcat #(string/split % #",\s?")))]
(distinct tags)))
(mapcat #(string/split % #",\s?")))
extra-tags (->> (str/split (setting/setting :extra-tags) #",")
(map str/trim)
(remove str/blank?))]
(distinct (concat tags extra-tags))))
(defn date->journal [item]
(if-let [date (-> item :meta :parsed-date

View File

@ -11,6 +11,7 @@
:attachments-block-text "[[Attachments]]"
:include-notes? true
:notes-block-text "[[Notes]]"
:extra-tags ""
:page-insert-prefix "@"})
(defn api-key []