Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cd9838adf8 |
@@ -257,13 +257,13 @@ let add_through b = function
|
||||
(** Escape special characters in the body of a MSG clause.
|
||||
- '%' must become '%%' (literal percent)
|
||||
- '[' must become '["["]' (a Remind expression that evaluates to the literal string "[") *)
|
||||
let escape_msg s =
|
||||
let escape_msg ?(summary = false) s =
|
||||
let buf = Buffer.create (String.length s) in
|
||||
String.iter
|
||||
(function
|
||||
| '\n' -> Buffer.add_string buf "\\n"
|
||||
| '\t' -> ()
|
||||
| '"' -> Buffer.add_string buf "\\\""
|
||||
| '"' -> if summary then Buffer.add_string buf "\"" else Buffer.add_string buf "\\\""
|
||||
| '%' -> Buffer.add_string buf "%%"
|
||||
| '[' -> Buffer.add_string buf {|["["]|}
|
||||
| c -> Buffer.add_char buf c)
|
||||
@@ -272,7 +272,7 @@ let escape_msg s =
|
||||
|
||||
let add_msg b ?(alarm = empty_alarm) ?(timed = false) summary =
|
||||
let has_alarm = alarm.day_delta <> "" || alarm.time_delta <> "" || alarm.sched <> "" in
|
||||
let body = escape_msg summary in
|
||||
let body = escape_msg summary ~summary:true in
|
||||
let body =
|
||||
if has_alarm then if timed then spf "%%\"%s%%\" (%%b %%3)" body else spf "%%\"%s%%\" (%%b)" body else body
|
||||
in
|
||||
|
||||
Reference in New Issue
Block a user