org-parser icon indicating copy to clipboard operation
org-parser copied to clipboard

TODO and other heading keywords lost in read-str

Open lilactown opened this issue 2 years ago • 4 comments

Describe the bug

read-str currently drops information about TODO and other keywords contained in headlines. I'd like to have this information.

To Reproduce

  (org/read-str "* TODO foo bar")
  ;; => {:headlines
  ;;     [{:headline
  ;;       {:level 1,
  ;;        :title [[:text-normal "foo bar"]],
  ;;        :planning [],      <--- should this contain it?
  ;;        :tags []}}]}

  (org.parser/parse "* TODO foo bar")
  ;; => [:S
  ;;     [:headline
  ;;      [:stars "*"]
  ;;      [:keyword "TODO"]  <--- is present in actual parsed output
  ;;      [:text [:text-normal "foo bar"]]]]

Expected behavior

The output of read-str should contain information about the todo state.

Screenshots

N/A

Additional context

N/A

lilactown avatar Sep 05 '23 00:09 lilactown

Priority also is dropped

  (org/read-str "* [#B] foo bar")
  ;; => {:headlines
  ;;     [{:headline
  ;;       {:level 1,
  ;;        :title [[:text-normal "foo bar"]],
  ;;        :planning [],
  ;;        :tags []}}]}

lilactown avatar Sep 05 '23 00:09 lilactown

COMMENT is also dropped

lilactown avatar Sep 05 '23 01:09 lilactown

With PR #69, * TODO [#B] foo bar should now output

{:headlines [{:headline {:level 1,
                         :title [[:text-normal "foo bar"]],
                         :planning [],
                         :keyword "TODO",
                         :priority "B",
                         :commented? false
                         :tags []}}]}

lilactown avatar Sep 05 '23 01:09 lilactown

Hey @lilactown, thanks for contributing! The planning is meant for headline timestamp information (scheduled, deadline).

Implementing TODO keyword and COMMENT is a great improvement. I'll look at your PR.

schoettl avatar Sep 05 '23 07:09 schoettl