diff --git a/.gitignore b/.gitignore index f53a901..90a8dc7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,8 @@ chrome-user-profile/ classes/ resources/public/cljs-out/ -/bin/ \ No newline at end of file +/bin/ +/.calva/ +/.clj-kondo/ +/.lsp/ +out/ \ No newline at end of file diff --git a/resources/public/css/main.less b/resources/public/css/main.less index 3af6161..0d49f39 100644 --- a/resources/public/css/main.less +++ b/resources/public/css/main.less @@ -447,17 +447,28 @@ a { -webkit-print-color-adjust: exact !important; &.emph-0 {background-color: none;} - &.emph-1 {background-color: rgba(0,255,100, .1);} - &.emph-2 {background-color: rgba(0,255,100, .2);} - &.emph-3 {background-color: rgba(0,255,100, .3);} - &.emph-4 {background-color: rgba(0,255,100, .4);} - &.emph-5 {background-color: rgba(0,255,100, .5);} - &.emph-6 {background-color: rgba(0,255,100, .6);} + &.emph-1 {background-color: rgba(0,255,100, 1);} + &.emph-2 {background-color: rgba(0,255,100, 1);} + &.emph-3 {background-color: rgba(0,255,100, 1);} + &.emph-4 {background-color: rgba(0,255,100, 1);} + &.emph-5 {background-color: rgba(0,255,100, 1);} + &.emph-6 {background-color: rgba(0,255,100, 1);} &.emph-7 {background-color: rgba(0,255,100, .7);} &.emph-8 {background-color: rgba(0,255,100, .8);} &.emph-9 {background-color: rgba(0,255,100, .9);} &.emph-10 {background-color: rgba(0,255,100, 1);} + // &.emph-1 {background-color: rgba(0,255,100, .1);} + // &.emph-2 {background-color: rgba(0,255,100, .2);} + // &.emph-3 {background-color: rgba(0,255,100, .3);} + // &.emph-4 {background-color: rgba(0,255,100, .4);} + // &.emph-5 {background-color: rgba(0,255,100, .5);} + // &.emph-6 {background-color: rgba(0,255,100, .6);} + // &.emph-7 {background-color: rgba(0,255,100, .7);} + // &.emph-8 {background-color: rgba(0,255,100, .8);} + // &.emph-9 {background-color: rgba(0,255,100, .9);} + // &.emph-10 {background-color: rgba(0,255,100, 1);} + &.selected.emph-0 {background-color: rgba(255,110,10, .3);} &.selected.emph-1 {background-color: rgba(255,110,10, .3);} &.selected.emph-2 {background-color: rgba(255,110,10, .3);} diff --git a/src/org_analyzer/http_server.clj b/src/org_analyzer/http_server.clj index 9738420..a444109 100644 --- a/src/org_analyzer/http_server.clj +++ b/src/org_analyzer/http_server.clj @@ -94,8 +94,9 @@ (defn send-clocks-between [org-files-and-dirs start end] - (let [{:keys [clocks org-files clock-count]} (get-clocks org-files-and-dirs) + (let [{:keys [clocks org-files clock-count]} (get-clocks org-files-and-dirs) ;;get-clocks解析org文件内容 clocks (clocks-between start end clocks)] + ;; tmp (println clocks)] ;; 筛选指定时间的clocks {:info {:clock-count clock-count :org-files (map file-path org-files)} :clocks (map clock-data clocks)})) diff --git a/src/org_analyzer/processing.clj b/src/org_analyzer/processing.clj index fd2c592..969852b 100644 --- a/src/org_analyzer/processing.clj +++ b/src/org_analyzer/processing.clj @@ -76,11 +76,13 @@ (declare parent-entries all-tags-for) (defnp find-clocks [org-data] +;; (println org-data) ;;debug (for [{:keys [type text] :as entry} org-data :when (= type :clock)] (merge {:clock-string text :sections (p ::parent-entries (parent-entries entry org-data)) :tags (p ::all-tags-for (all-tags-for entry org-data))} +;; :priority (println (parent-entries entry org-data))} (parse-clock text)))) (defn clocks-by-section [clocks] @@ -94,16 +96,20 @@ (def file-props-re #"^\s*#\+([0-9A-Za-z_\-]+):\s*(.*)") (def metadata-re #"^\s*(CLOCK|DEADLINE|START|CLOSED|SCHEDULED|CREATED):.*") (def simple-clock-re #"^\s*(CLOCK):.*") -(def section-keyword-re #"^(TODO|NEXT|MAYBE|WAIT|CANCELLED|DONE|REVIEW)\s*(.*)") +(def section-keyword-re #"^(TODO|NEXT|DELEGATED|HOLD|ABORT|MAYBE|WAIT|CANCELLED|DONE|REVIEW)\s*(.*)") +(def priority-re #"(.*)(\#\[[A-D]\])\s*(.*)") ;; #[B] ;;这里还是不对,需要深入研究 (defn parse-section-text-and-tags [text] (let [[_ keyword text-no-kw] (re-find section-keyword-re text) text (or text-no-kw text) - [_ text-no-tags raw-tags] (re-find #"(.*)\s+:([^ ]+):$" text) - text (s/trim (or text-no-tags text))] + [_ text-no-tags raw-tags] (re-find #"(.*)\s+:([^ ]+):$" text) ;; ":@Review:@Office:" + text (s/trim (or text-no-tags text)) + [_ priority text-no-priority] (re-find priority-re text) + text (or text-no-priority text)] (merge {:name text} (when keyword {:keyword keyword}) - (when raw-tags {:tags (keep not-empty (s/split raw-tags #":"))})))) + (when priority {:priority priority} (println priority)) + (when raw-tags {:tags (keep not-empty (s/split raw-tags #":"))} (println raw-tags))))) (defn read-org-lines [lines] (for [[i line] (map-indexed vector lines) diff --git a/src/org_analyzer/time.clj b/src/org_analyzer/time.clj index 6c51d14..85281c7 100644 --- a/src/org_analyzer/time.clj +++ b/src/org_analyzer/time.clj @@ -172,5 +172,5 @@ Example: ([from-date to-date] (let [from-date (adjust from-date :first-day-of-month) to-date (adjust to-date :last-day-of-month) - n-days (time/time-between from-date to-date :days)] + n-days (+ (time/time-between from-date to-date :days) 1)] (map simple-calendar-day (take n-days (time/iterate plus from-date (days 1))))))) diff --git a/test/org_analyzer/parsing_test.clj b/test/org_analyzer/parsing_test.clj index 9258e48..bf26e6c 100644 --- a/test/org_analyzer/parsing_test.clj +++ b/test/org_analyzer/parsing_test.clj @@ -189,7 +189,7 @@ this should not show the elements from BBBB as children (deftest localized-timestamps (let [test-content "* Foo :LOGBOOK: - CLOCK: [2018-03-26 m. 13:14]--[2018-03-26 m. 13:43] => 0:29 + CLOCK: [2018-03-26 m�. 13:14]--[2018-03-26 m�. 13:43] => 0:29 :END:" clocks (->> test-content java.io.StringBufferInputStream.