From 82d6a786bcbf63154d452c16023ec0b1eb9c6915 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 2 Oct 2009 13:00:22 +0200 Subject: [PATCH] Fix bugs with inline task export --- lisp/ChangeLog | 4 ++++ lisp/org-inlinetask.el | 46 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0950ba72c..e21d000d9 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2009-10-02 Carsten Dominik + * org-inlinetask.el (org-inlinetask-get-current-indentation) + (org-inlinetask-remove-terminator): New functions. + (org-inlinetask-export-handler): Terminate the description list. + * org-exp.el (org-export-select-backend-specific-text): Remove the region markers. diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el index 3a5be3c73..00424709e 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -151,13 +151,29 @@ Either remove headline and meta data, or do special formatting." (setq content (substring content 0 (match-beginning 0)))) (setq content (org-remove-indentation content)) (if latexp (setq content (concat "\\quad \\\\\n" content))))) - (insert "- ") + (insert (make-string (org-inlinetask-get-current-indentation) ?\ ) + "- ") (setq indent (make-string (current-column) ?\ )) (insert headline " ::") - (when content - (insert (if htmlp " " (concat "\n" indent)) - (mapconcat 'identity (org-split-string content "\n") - (concat "\n" indent)) "\n")))))) + (if content + (insert (if htmlp " " (concat "\n" indent)) + (mapconcat 'identity (org-split-string content "\n") + (concat "\n" indent)) "\n") + (insert "\n")) + (insert indent) + (backward-delete-char 2) + (insert "THISISTHEINLINELISTTEMINATOR\n"))))) + +(defun org-inlinetask-get-current-indentation () + "Get the indentation of the last non-while line above this one." + (save-excursion + (beginning-of-line 1) + (skip-chars-backward " \t\n") + (beginning-of-line 1) + (or (org-at-item-p) + (looking-at "[ \t]*")) + (goto-char (match-end 0)) + (current-column))) (defun org-inlinetask-fontify (limit) "Fontify the inline tasks." @@ -181,11 +197,31 @@ Either remove headline and meta data, or do special formatting." org-inlinetask-min-level)) (replace-match ""))) +(defun org-inlinetask-remove-terminator () + (let (beg end) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "THISISTHEINLINELISTTEMINATOR\n" nil t) + (setq beg (match-beginning 0) end (match-end 0)) + (save-excursion + (beginning-of-line 1) + (and (looking-at "THISISTHEINLINELISTTEMINATOR[ \t\n]*") + (setq beg (point) end (match-end 0)))) + (delete-region beg end))))) + (eval-after-load "org-exp" '(add-hook 'org-export-preprocess-after-tree-selection-hook 'org-inlinetask-export-handler)) (eval-after-load "org" '(add-hook 'org-font-lock-hook 'org-inlinetask-fontify)) +(eval-after-load "org-html" + '(add-hook 'org-export-html-final-hook 'org-inlinetask-remove-terminator)) +(eval-after-load "org-latex" + '(add-hook 'org-export-latex-final-hook 'org-inlinetask-remove-terminator)) +(eval-after-load "org-ascii" + '(add-hook 'org-export-ascii-final-hook 'org-inlinetask-remove-terminator)) +(eval-after-load "org-docbook" + '(add-hook 'org-export-docbook-final-hook 'org-inlinetask-remove-terminator)) (provide 'org-inlinetask)