200ok-ch / org-parser

org-parser is a parser for the Org mode markup language for Emacs.
GNU Affero General Public License v3.0
316 stars 15 forks source link

TODO and other heading keywords lost in read-str #68

Closed lilactown closed 3 months ago

lilactown commented 10 months ago

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 commented 10 months ago

Priority also is dropped

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

COMMENT is also dropped

lilactown commented 10 months ago

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 []}}]}
schoettl commented 10 months ago

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.