[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/svg-tag-mode 8533c6c174 50/63: Added progress bar examp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/svg-tag-mode 8533c6c174 50/63: Added progress bar example. |
Date: |
Mon, 27 Dec 2021 15:58:00 -0500 (EST) |
branch: externals/svg-tag-mode
commit 8533c6c174d6ff97065fec6bce15292c041c5be1
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Added progress bar example.
---
examples/example-2.el | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/examples/example-2.el b/examples/example-2.el
index 90b66f59c4..b041af1f3a 100644
--- a/examples/example-2.el
+++ b/examples/example-2.el
@@ -19,6 +19,23 @@
(defconst time-re "[0-9]\\{2\\}:[0-9]\\{2\\}")
(defconst day-re "[A-Za-z]\\{3\\}")
+(defun svg-progress-percent (value)
+ (svg-image (svg-lib-concat
+ (svg-lib-progress-bar (/ (string-to-number value) 100.0)
+ nil :margin 0 :stroke 2 :radius 3 :padding 2
:width 11)
+ (svg-lib-tag (concat value "%")
+ nil :stroke 0 :margin 0)) :ascent 'center))
+
+(defun svg-progress-count (value)
+ (let* ((seq (mapcar #'string-to-number (split-string value "/")))
+ (count (float (car seq)))
+ (total (float (cadr seq))))
+ (svg-image (svg-lib-concat
+ (svg-lib-progress-bar (/ count total) nil
+ :margin 0 :stroke 2 :radius 3 :padding 2
:width 11)
+ (svg-lib-tag value nil
+ :stroke 0 :margin 0)) :ascent 'center)))
+
(setq svg-tag-tags
`(
;; Org tags
@@ -27,18 +44,24 @@
:beg 2 :alignment 0))))
("\\(:#[A-Za-z0-9]+:\\)$" . ((lambda (tag)
(svg-tag-make tag :face 'org-tag
- :beg 2 :end -1
+ :beg 2 :end -1
:alignment 0))))
- ;; Org priority
+ ;; Task priority
("\\[#[A-Z]\\]" . ( (lambda (tag)
(svg-tag-make tag :face 'org-priority
:beg 2 :end -1 :margin 0))))
- ;; Org TODO / DONE
+ ;; Progress
+ ("\\(\\[[0-9]\\{1,3\\}%\\]\\)" . ((lambda (tag)
+ (svg-progress-percent (substring
tag 1 -2)))))
+ ("\\(\\[[0-9]+/[0-9]+\\]\\)" . ((lambda (tag)
+ (svg-progress-count (substring tag 1
-1)))))
+
+ ;; TODO / DONE
("TODO" . ((svg-tag-make "TODO" :face 'org-todo :inverse t :margin 0)))
("DONE" . ((svg-tag-make "DONE" :face 'org-done :margin 0)))
- ;; Org date (without day name)
+ ;; Active date (without day name, with or without time)
(,(format "\\(<%s>\\)" date-re) .
((lambda (tag)
(svg-tag-make tag :beg 1 :end -1 :margin 0))))
@@ -49,6 +72,7 @@
((lambda (tag)
(svg-tag-make tag :end -1 :inverse t :crop-left t :margin 0))))
+ ;; Inactive date (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))))
@@ -64,6 +88,8 @@
;; To do: TODO DONE
;; Tags: :#MEETING:#NOTE:
;; Priorities: [#A] [#B] [#C]
+;; Progress: [1/3]
+;; [42%]
;; Active date: <2021-12-24>
;; <2021-12-24 14:00>
;; Inactive date: [2021-12-24]
- [elpa] externals/svg-tag-mode 525901723f 47/63: Fixed requirements., (continued)
- [elpa] externals/svg-tag-mode 525901723f 47/63: Fixed requirements., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 8d9dd283fb 45/63: Updated screenshot, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode aca351185b 52/63: Fixed documentation., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 558ac3d3bd 54/63: Added edit mode (tag is hidden) when pointer is over a tag., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 72068052ff 19/63: Fixed default height, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 9ddf0e4f13 38/63: Rename screenshot, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode b865793671 53/63: Updated copyright notices., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 95b5404997 35/63: Merge pull request #13 from tarsiiformes/cleanup, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 861c68af89 40/63: Updated example 1 to new tags format., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode ee16277655 42/63: Added examples from documentation, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 8533c6c174 50/63: Added progress bar example.,
ELPA Syncer <=
- [elpa] externals/svg-tag-mode d9a803a92e 49/63: Added date without time format example., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 3e49ddcee2 57/63: Cancel tag editing in read-only or view mode., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 7266de9f9c 61/63: Simplified advice on org fontify blocks., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 1d0d91bb00 46/63: Fixed layout, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 02d60e0a86 55/63: Fixed cursor selection., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode b5a00a5746 56/63: Bumped version number and fixed some documentation., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 85aed73bc6 58/63: Added custom option to let user decide on action at point., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode e2481ae15a 63/63: Modified example to highlight real org tags., ELPA Syncer, 2021/12/27