diff --git a/lisp/org-freemind.el b/lisp/org-freemind.el index 07b57746e..2d0bed83d 100644 --- a/lisp/org-freemind.el +++ b/lisp/org-freemind.el @@ -5,7 +5,7 @@ ;; Author: Lennart Borgman (lennart O borgman A gmail O com) ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33 +;; Version: 6.32trans ;; ;; This file is part of GNU Emacs. ;; @@ -55,7 +55,6 @@ ;; 2009-02-21: Fixed bug in `org-freemind-to-org-mode'. ;; 2009-10-25: Added support for `org-odd-levels-only'. ;; Added y/n question before showing in FreeMind. -;; 2009-11-04: Added support for #+BEGIN_HTML. ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -192,7 +191,6 @@ NOT READY YET." filename)) (t (org-freemind-from-org-mode bfname filename))))) - ;;;###autoload (defun org-freemind-show (mm-file) "Show file MM-FILE in Freemind." @@ -219,8 +217,6 @@ NOT READY YET." ;;; Format converters (defun org-freemind-escape-str-from-org (org-str) - "Do some html-escaping of ORG-STR and return the result. -The characters \"&<> will be escaped." (let ((chars (append org-str nil)) (fm-str "")) (dolist (cc chars) @@ -245,20 +241,17 @@ The characters \"&<> will be escaped." fm-str)) (defun org-freemind-unescape-str-to-org (fm-str) - "Do some html-unescaping of FM-STR and return the result. -This is the opposite of `org-freemind-escape-str-from-org' but it -will also unescape nn;." (let ((org-str fm-str)) (setq org-str (replace-regexp-in-string """ "\"" org-str)) (setq org-str (replace-regexp-in-string "&" "&" org-str)) (setq org-str (replace-regexp-in-string "<" "<" org-str)) (setq org-str (replace-regexp-in-string ">" ">" org-str)) (setq org-str (replace-regexp-in-string - "\\([a-f0-9]\\{2\\}\\);" - (lambda (m) - (char-to-string (+ (string-to-number (match-string 1 org-str) 16) - ?\x800))) - org-str)))) + "\\([a-f0-9]\\{2\\}\\);" + (lambda (m) + (char-to-string (+ (string-to-number (match-string 1 str) 16) + ?\x800))) + org-str)))) ;; (org-freemind-test-escape) ;; (defun org-freemind-test-escape () @@ -271,7 +264,6 @@ will also unescape nn;." ;; )) (defun org-freemind-convert-links-from-org (org-str) - "Convert org links in ORG-STR to freemind links and return the result." (let ((fm-str (replace-regexp-in-string (rx (not (any "[\"")) (submatch @@ -292,7 +284,6 @@ will also unescape nn;." ;;(org-freemind-convert-links-to-org "link-text") (defun org-freemind-convert-links-to-org (fm-str) - "Convert freemind links in FM-STR to org links and return the result." (let ((org-str (replace-regexp-in-string (rx " FreeMind -(defun org-freemind-convert-text-p (text) - (setq text (org-freemind-escape-str-from-org text)) - (setq text (replace-regexp-in-string (rx "\n" (0+ blank) "\n") "
\n" text))
- ;;(setq text (replace-regexp-in-string (rx bol (1+ blank) eol) "" text))
- ;;(setq text (replace-regexp-in-string (rx bol (1+ blank)) "
" text))
- (setq text (replace-regexp-in-string "\n" "
" text))
- (concat "
" - (org-freemind-convert-links-from-org text) - "
\n")) - -(defun org-freemind-org-text-to-freemind-subnode/note (node-name start end drawers-regexp) - "Convert text part of org node to freemind subnode or note. -Convert the text part of the org node named NODE-NAME. The text -is in the current buffer between START and END. Drawers matching -DRAWERS-REGEXP are converted to freemind notes." +(defun org-freemind-org-text-to-freemind-subnode/note (node-name start end) ;; fix-me: doc (let ((text (buffer-substring-no-properties start end)) (node-res "") (note-res "")) (save-match-data - ;;(setq text (org-freemind-escape-str-from-org text)) + (setq text (org-freemind-escape-str-from-org text)) ;; First see if there is something that should be moved to the ;; note part: (let (drawers) @@ -391,30 +367,14 @@ DRAWERS-REGEXP are converted to freemind notes." "\n" "\n" "\n")) - (let ((begin-html-mark (regexp-quote "#+BEGIN_HTML")) - (end-html-mark (regexp-quote "#+END_HTML")) - head - end-pos - end-pos-match - ) - ;; Take care of #+BEGIN_HTML - #+END_HTML - (while (string-match begin-html-mark text) - (setq head (substring text 0 (match-beginning 0))) - (setq end-pos-match (match-end 0)) - (setq node-res (concat node-res - (org-freemind-convert-text-p head))) - (setq text (substring text end-pos-match)) - (setq end-pos (string-match end-html-mark text)) - (if end-pos - (setq end-pos-match (match-end 0)) - (message "org-freemind: Missing #+END_HTML") - (setq end-pos (length text)) - (setq end-pos-match end-pos)) - (setq node-res (concat node-res - (substring text 0 end-pos))) - (setq text (substring text end-pos-match))) - (setq node-res (concat node-res - (org-freemind-convert-text-p text)))) + (setq node-res (concat node-res "")) + (setq text (replace-regexp-in-string (rx "\n" (0+ blank) "\n") "
\n" text))
+ ;;(setq text (replace-regexp-in-string (rx bol (1+ blank) eol) "" text))
+ ;;(setq text (replace-regexp-in-string (rx bol (1+ blank)) "
" text))
+ (setq text (replace-regexp-in-string "\n" "
" text))
+ (org-freemind-convert-links-from-org text)
+ (setq node-res (concat node-res text))
+ (setq node-res (concat node-res "