ソースを参照

Restore the old iCalendar quoting for the time being.

The attempt to implement RFC2455 does seem to lead to problems with
some applications.
Carsten Dominik 16 年 前
コミット
38970e875f
2 ファイル変更33 行追加0 行削除
  1. 4 0
      lisp/ChangeLog
  2. 29 0
      lisp/org-exp.el

+ 4 - 0
lisp/ChangeLog

@@ -1,5 +1,9 @@
 2008-11-14  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-exp.el (org-icalendar-cleanup-string): Restore the old
+	iCalendar quoting.  The new one seems to caus problems with
+	applications.
+
 	* org.el (org-yank): Set `this-command' to `yank', so that
 	`yank-pop' will work.
 

+ 29 - 0
lisp/org-exp.el

@@ -4519,6 +4519,35 @@ END:VTODO\n"
 When IS-BODY is non-nil, assume that this is the body of an item, clean up
 whitespace, newlines, drawers, and timestamps, and cut it down to MAXLENGTH
 characters."
+  (if (not s)
+      nil
+    (when is-body
+      (let ((re (concat "\\(" org-drawer-regexp "\\)[^\000]*?:END:.*\n?"))
+	    (re2 (concat "^[ \t]*" org-keyword-time-regexp ".*\n?")))
+	(while (string-match re s) (setq s (replace-match "" t t s)))
+	(while (string-match re2 s) (setq s (replace-match "" t t s)))))
+    (let ((start 0))
+      (while (string-match "\\([,;]\\)" s start)
+	(setq start (+ (match-beginning 0) 2)
+	      s (replace-match "\\\\\\1" nil nil s))))
+    (setq s (org-trim s))
+    (when is-body
+      (while (string-match "[ \t]*\n[ \t]*" s)
+	(setq s (replace-match "\\n" t t s))))
+    (if is-body
+	(if maxlength
+	    (if (and (numberp maxlength)
+		     (> (length s) maxlength))
+		(setq s (substring s 0 maxlength)))))
+    s))
+
+(defun org-icalendar-cleanup-string-rfc2455 (s &optional is-body maxlength)
+  "Take out stuff and quote what needs to be quoted.
+When IS-BODY is non-nil, assume that this is the body of an item, clean up
+whitespace, newlines, drawers, and timestamps, and cut it down to MAXLENGTH
+characters.
+This seems to be more like RFC 2455, but it causes problems, so it is
+not used right now."
   (if (not s)
       nil
     (if is-body