ndwarshuis / org-sql

SQL backend for Emacs Org-Mode
GNU General Public License v3.0
97 stars 9 forks source link

can't see a file's #+title nor #+category #20

Open Wonko7 opened 3 months ago

Wonko7 commented 3 months ago

Hi!

first off, thank you so much for this, I'm close to having a web interface on my org notes thanks to you!

Quick question: in my org files, I set a #+title & #+category, I'm not seeing these in the DB, am I missing something or is this not supported? A roam daily file starts like this for me:

:PROPERTIES:
:ID:       43a3b72d-e69a-44dd-8c0f-f287406ab42a
:END:
#+title: 2024-06-05
#+category: 2024-06-05
ndwarshuis commented 3 months ago

first off, thank you so much for this

you are welcome :)

I'm not seeing these in the DB, am I missing something or is this not supported?

This isn't really supported. The closest that exists in the db now is the "outline_preamble" value in the "outlines" table which is just a string of that entire top section before the first headline. Probably not too useful since you would need to parse that yourself.

The only things that are currently taken from the top level are properties defined with "+PROPERTY" and filetags defined with "+FILETAG."

In theory it shouldn't be that hard to at least add the property drawer since this is just a different way of writing "+PROPERTY." Keywords would take some more work since there currently isn't a table for that. Note that if I added a keyword table that those dates would just be strings.

Is this all that you would want? The reason why I didn't focus too hard on the top section is because there's lots of little edge cases that didn't seem super common (different drawers, properties, keywords, lots of special flags that control the behavior of the file, free form text, etc) and thus it wasn't clear how to arrange a database schema around it.

Wonko7 commented 2 months ago

I hacked something together: https://github.com/ndwarshuis/org-sql/pull/21