Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
rougier committed May 25, 2022
2 parents 6e52f7c + 07640c9 commit efd22ed
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions examples/example-2.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
(defconst date-re "[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}")
(defconst time-re "[0-9]\\{2\\}:[0-9]\\{2\\}")
(defconst day-re "[A-Za-z]\\{3\\}")
(defconst day-time-re (format "\\(%s\\)? ?\\(%s\\)?" day-re time-re))

(defun svg-progress-percent (value)
(svg-image (svg-lib-concat
Expand Down Expand Up @@ -71,25 +72,25 @@
:crop-left t))))


;; Active date (without day name, with or without time)
;; Active date (with or without day name, with or without time)
(,(format "\\(<%s>\\)" date-re) .
((lambda (tag)
(svg-tag-make tag :beg 1 :end -1 :margin 0))))
(,(format "\\(<%s *\\)%s>" date-re time-re) .
(,(format "\\(<%s \\)%s>" date-re day-time-re) .
((lambda (tag)
(svg-tag-make tag :beg 1 :inverse nil :crop-right t :margin 0))))
(,(format "<%s *\\(%s>\\)" date-re time-re) .
(,(format "<%s \\(%s>\\)" date-re day-time-re) .
((lambda (tag)
(svg-tag-make tag :end -1 :inverse t :crop-left t :margin 0))))

;; Inactive date (without day name, with or without time)
;; Inactive date (with or without day name, with or without time)
(,(format "\\(\\[%s\\]\\)" date-re) .
((lambda (tag)
(svg-tag-make tag :beg 1 :end -1 :margin 0 :face 'org-date))))
(,(format "\\(\\[%s *\\)%s\\]" date-re time-re) .
(,(format "\\(\\[%s \\)%s\\]" date-re day-time-re) .
((lambda (tag)
(svg-tag-make tag :beg 1 :inverse nil :crop-right t :margin 0 :face 'org-date))))
(,(format "\\[%s *\\(%s\\]\\)" date-re time-re) .
(,(format "\\[%s \\(%s\\]\\)" date-re day-time-re) .
((lambda (tag)
(svg-tag-make tag :end -1 :inverse t :crop-left t :margin 0 :face 'org-date))))))

Expand All @@ -101,7 +102,11 @@
;; Progress: [1/3]
;; [42%]
;; Active date: <2021-12-24>
;; <2021-12-24 Fri>
;; <2021-12-24 14:00>
;; <2021-12-24 Fri 14:00>
;; Inactive date: [2021-12-24]
;; [2021-12-24 Fri]
;; [2021-12-24 14:00]
;; [2021-12-24 Fri 14:00]
;; Citation: [cite:@Knuth:1984]

0 comments on commit efd22ed

Please sign in to comment.