Function: org-element-inlinetask-parser

org-element-inlinetask-parser is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element-inlinetask-parser LIMIT &optional RAW-SECONDARY-P)

Documentation

Parse an inline task.

Return a list whose CAR is inlinetask and CDR is a plist containing :title, :begin, :end, :pre-blank,
:contents-begin and :contents-end, :level, :priority,
:raw-value, :tags, :todo-keyword, :todo-type,
:scheduled, :deadline, :closed, :post-blank and
:post-affiliated keywords.

The plist also contains any property set in the property drawer, with its name in upper cases and colons added at the beginning (e.g., :CUSTOM_ID).

When optional argument RAW-SECONDARY-P is non-nil, inline-task's title will not be parsed as a secondary string, but as a plain string instead.

Assume point is at beginning of the inline task.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;;; Inlinetask

(defun org-element-inlinetask-parser (limit &optional raw-secondary-p)
  "Parse an inline task.

Return a list whose CAR is `inlinetask' and CDR is a plist
containing `:title', `:begin', `:end', `:pre-blank',
`:contents-begin' and `:contents-end', `:level', `:priority',
`:raw-value', `:tags', `:todo-keyword', `:todo-type',
`:scheduled', `:deadline', `:closed', `:post-blank' and
`:post-affiliated' keywords.

The plist also contains any property set in the property drawer,
with its name in upper cases and colons added at the
beginning (e.g., `:CUSTOM_ID').

When optional argument RAW-SECONDARY-P is non-nil, inline-task's
title will not be parsed as a secondary string, but as a plain
string instead.

Assume point is at beginning of the inline task."
  (save-excursion
    (let* ((begin (point))
	   (level (prog1 (org-reduced-level (skip-chars-forward "*"))
		    (skip-chars-forward " \t")))
	   (todo (and org-todo-regexp
		      (let (case-fold-search) (looking-at org-todo-regexp))
		      (progn (goto-char (match-end 0))
			     (skip-chars-forward " \t")
			     (match-string 0))))
	   (todo-type (and todo
			   (if (member todo org-done-keywords) 'done 'todo)))
	   (priority (and (looking-at "\\[#.\\][ \t]*")
			  (progn (goto-char (match-end 0))
				 (aref (match-string 0) 2))))
           (commentedp
	    (and (let ((case-fold-search nil))
                   (looking-at org-element-comment-string))
		 (goto-char (match-end 0))
                 (when (looking-at-p "\\(?:[ \t]\\|$\\)")
                   (point))))
	   (title-start (prog1 (point)
                          (unless (or todo priority commentedp)
                            ;; Headline like "* :tag:"
                            (skip-chars-backward " \t"))))
	   (tags (when (re-search-forward
			"[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"
			(line-end-position)
			'move)
		   (goto-char (match-beginning 0))
		   (org-split-string (match-string 1) ":")))
	   (title-end (point))
	   (raw-value (org-trim
		       (buffer-substring-no-properties title-start title-end)))
           (archivedp (member org-element-archive-tag tags))
	   (task-end (save-excursion
		       (end-of-line)
		       (and (re-search-forward org-element-headline-re limit t)
			    (looking-at-p "[ \t]*END[ \t]*$")
			    (line-beginning-position))))
	   (standard-props (and task-end (org-element--get-node-properties)))
	   (time-props (and task-end (org-element--get-time-properties)))
	   (contents-begin (and task-end
				(< (point) task-end)
				(progn
				  (forward-line)
				  (skip-chars-forward " \t\n")
				  (line-beginning-position))))
	   (contents-end (and contents-begin task-end))
	   (end (progn (when task-end (goto-char task-end))
		       (forward-line)
		       (skip-chars-forward " \r\t\n" limit)
		       (if (eobp) (point) (line-beginning-position))))
	   (inlinetask
	    (list 'inlinetask
		  (nconc
		   (list :raw-value raw-value
			 :begin begin
			 :end end
			 :pre-blank
			 (if (not contents-begin) 0
			   (1- (count-lines begin contents-begin)))
			 :contents-begin contents-begin
			 :contents-end contents-end
			 :level level
			 :priority priority
			 :tags tags
			 :todo-keyword todo
			 :todo-type todo-type
			 :post-blank (1- (count-lines (or task-end begin) end))
			 :post-affiliated begin
                         :archivedp archivedp
			 :commentedp commentedp)
		   time-props
		   standard-props))))
      (org-element-put-property
       inlinetask :title
       (if raw-secondary-p raw-value
	 (org-element--parse-objects
	  (progn (goto-char title-start)
		 (skip-chars-forward " \t")
		 (point))
	  (progn (goto-char title-end)
		 (skip-chars-backward " \t")
		 (point))
	  nil
	  (org-element-restriction 'inlinetask)
	  inlinetask))))))