diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el index eb1cfb7d2..483ce5f5c 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -105,12 +105,12 @@ When nil, they will not be exported." :type 'boolean) (defvar org-inlinetask-export-templates - '((html "
%s%s
%s
" + '((html "
%s%s
\n%s\n
" '((unless (eq todo "") (format "%s%s " class todo todo priority)) heading content)) - (latex "\\begin\{description\}\\item[%s%s]%s\\end\{description\}" + (latex "\\begin\{description\}\n\\item[%s%s]~\n%s\n\\end\{description\}" '((unless (eq todo "") (format "\\textsc\{%s%s\} " todo priority)) heading content)) (ascii " -- %s%s%s" @@ -251,7 +251,7 @@ Either remove headline and meta data, or do special formatting." (let* ((nstars (if org-odd-levels-only (1- (* 2 (or org-inlinetask-min-level 200))) (or org-inlinetask-min-level 200))) - (re1 (format "^\\(\\*\\{%d,\\}\\) .*\n" nstars)) + (re1 (format "^\\(\\*\\{%d,\\}\\)[ \t]+.*\n" nstars)) (re2 (concat "^[ \t]*" org-keyword-time-regexp)) headline beg end stars content) (while (re-search-forward re1 nil t) @@ -266,7 +266,7 @@ Either remove headline and meta data, or do special formatting." (if (re-search-forward org-property-end-re nil t) (delete-region beg (1+ (match-end 0))))) (setq beg (point)) - (when (and (re-search-forward "^\\(\\*+\\) " nil t) + (when (and (re-search-forward "^\\(\\*+\\)[ \t]+" nil t) (= (length (match-string 1)) (length stars)) (progn (goto-char (match-end 0)) (looking-at "END[ \t]*$"))) @@ -281,7 +281,10 @@ Either remove headline and meta data, or do special formatting." (if (string-match "[ \t\n]+\\'" content) (setq content (substring content 0 (match-beginning 0)))) (setq content (org-remove-indentation content)))) - (setq content (or content "")) + ;; Prevent from protecting content if there's any + (setq content (or (and content + (org-add-props content '(org-protected nil))) + "")) ;; grab elements to export (when (string-match org-complex-heading-regexp headline) (let* ((todo (or (match-string 2 headline) "")) @@ -291,16 +294,18 @@ Either remove headline and meta data, or do special formatting." (heading (or (match-string 4 headline) "")) (tags (or (match-string 5 headline) "")) (backend-spec (assq backend org-inlinetask-export-templates)) - (format-str (nth 1 backend-spec)) + (format-str (org-add-props (nth 1 backend-spec) + '(org-protected t))) (tokens (cadr (nth 2 backend-spec))) - ;; change nil arguments into empty strings - (nil-to-str (lambda (el) (or (eval el) ""))) - ;; build and protect export string + (nil-to-str + ;; Change nil arguments into empty strings + (lambda (el) (or (eval el) ""))) + ;; Build and ensure export string will not break lists (export-str (org-add-props (eval (append '(format format-str) (mapcar nil-to-str tokens))) - nil 'org-protected t))) - ;; eventually insert it + '(original-indentation 1000)))) + ;; Eventually insert it (insert export-str "\n"))))))) (defun org-inlinetask-get-current-indentation () @@ -337,7 +342,7 @@ Either remove headline and meta data, or do special formatting." (replace-match ""))) (eval-after-load "org-exp" - '(add-hook 'org-export-preprocess-after-tree-selection-hook + '(add-hook 'org-export-preprocess-before-backend-specifics-hook 'org-inlinetask-export-handler)) (eval-after-load "org" '(add-hook 'org-font-lock-hook 'org-inlinetask-fontify)) diff --git a/lisp/org-list.el b/lisp/org-list.el index a683f0da0..a29e5fa16 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -1189,8 +1189,7 @@ Assume point is at an item." (re-search-forward "^[ \t]*:END:" nil t) (forward-line 1)) ((and inlinetask-re (looking-at inlinetask-re)) - (org-inlinetask-goto-end) - (forward-line 1)) + (org-inlinetask-goto-end)) ((looking-at "^[ \t]*$") (forward-line 1)) ((org-at-item-p)