aboutsummaryrefslogtreecommitdiff
path: root/org-d20.el
diff options
context:
space:
mode:
Diffstat (limited to 'org-d20.el')
-rw-r--r--org-d20.el26
1 files changed, 9 insertions, 17 deletions
diff --git a/org-d20.el b/org-d20.el
index 05b7510..dcb6c27 100644
--- a/org-d20.el
+++ b/org-d20.el
@@ -429,23 +429,15 @@ the best N of them, e.g., 4d6k3."
;; Bracket a number so it looks a bit like a dice roll result
(defun org-d20--rolls-bracket (sides roll)
- (let ((roll* (int-to-string roll)))
- (cond ((= sides 4)
- (concat "‹" roll* "›"))
- ((= sides 6)
- (concat "|" roll* "|"))
- ((= sides 8)
- (concat "/" roll* "/"))
- ((= sides 10)
- (concat "{" roll* "}"))
- ((= sides 12)
- (concat "⟨" roll* "⟩"))
- ((= sides 20)
- (concat "(" roll* ")"))
- ((= sides 100)
- (concat "«" roll* "»"))
- (t
- (concat "[" roll* "]")))))
+ (let ((brackets (or (assoc sides '((4 "‹" "›")
+ (6 "|" "|")
+ (8 "/" "/")
+ (10 "{" "}")
+ (12 "⟨" "⟩")
+ (20 "(" ")")
+ (100 "«" "»")))
+ '(nil "[" "]"))))
+ (concat (cadr brackets) (int-to-string roll) (caddr brackets))))
(defun org-d20--org-table-end-of-current-cell-content ()
"Move point to the end of the content of the current Org table cell."