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

Can’t parse trivial .org file

Open tokuchan opened this issue 5 years ago • 11 comments

I created a file with a single word, “foo” in it, named foo.org. When I attempted to access it with orgweb I was told it couldn’t parse.

tokuchan avatar Aug 17 '19 15:08 tokuchan

I just tried it with an empty file, same result.

tokuchan avatar Aug 17 '19 15:08 tokuchan

@tokuchan I have done a little work on the parser, so I can tell you from memory what's the issue. What's "trivial" and what is not is itself not trivial^^

org-web expects a file to start with either these keywords #+TODO, #+TYP_TODO or with a header (indicated by a *).

I have opened a separete issue two weeks ago that's going in a similar direction: https://github.com/DanielDe/org-web/issues/55

munen avatar Aug 17 '19 16:08 munen

Ah. I see. It might be well to mention that in the documentation then. Emacs considers almost any text file to be valid orgmode. They don't necessarily have to start with a header or tag. Thank you for the information! I really like the concept and want to use org-web.

On Sat, Aug 17, 2019 at 12:36 Alain M. Lafon [email protected] wrote:

@tokuchan https://github.com/tokuchan I have done a little work on the parser, so I can tell you from memory what's the issue. What's "trivial" and what is not is itself not trivial^^

org-web expects a file to start with either these keywords #+TODO, #+TYP_TODO or with a header (indicated by a *).

I have opened a separete issue two weeks ago that's going in a similar direction: #55 https://github.com/DanielDe/org-web/issues/55

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DanielDe/org-web/issues/68?email_source=notifications&email_token=AAOIMB5LAB3DULA3AG3L46DQFASKVA5CNFSM4IMPVXX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4QO6XQ#issuecomment-522252126, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOIMB7DK7SQTIWDEDBGUK3QFASKVANCNFSM4IMPVXXQ .

-- Sincerely, Sean R. Spillane [email protected]

╭-----╮ ┃の の┃ ┃ も ┃ ┃ へ ┃ ╰-----╯ ★ Sean Spillane ★

tokuchan avatar Aug 18 '19 13:08 tokuchan

I already have several open PRs regarding the parser which the maintainer can review/merge. I had to do those to work on my ~10k LOC of org files.

I wouldn’t consider documenting this in the readme a good fix. Instead I’d rather spend time towards better org file compatibility^^

munen avatar Aug 18 '19 14:08 munen

Hey @tokuchan, thanks for the report! org-web was largely built around my own particular use cases, which is one monolithic org file. Adding support for creating new files has been a rather commonly requested feature, however. Is that your use case here?

DanielDe avatar Aug 20 '19 06:08 DanielDe

As I mentioned in #71, org allows content before the first headline, so opening such a file should ideally be supported by org-web. I think many people stumble on the complex syntax of org, which has no real formal definition except the elisp-implementation (even though this "draft" page on worg seems to document it well). Many people have attempted to write more or less complete parsers as well, for example: https://www.reddit.com/r/orgmode/comments/7wjmwr/orga_the_ultimate_orgmode_parser_in_javascript/

Would there be a point of using something like this in org-web? Otherwise I guess it’s a quite pragmatic solution to parse the basics, and then allow free-text editing of other things in the sections. In my understanding, org-web isn’t supposed to enable all org mode workflows, but is mainly aimed towards the planning functionality.

andersjohansson avatar Aug 20 '19 19:08 andersjohansson

I looked into that parser but had already done so much work on my own by that point that I opted not to use it. One day it might make sense to swap it in, though.

My philosophy behind org-web has always been a sort of progressive enhancement. That is, I've wanted to allow editing the raw headers as plain text, but progressively over time support more org features natively (like TODOs, checklists, timestamps, etc). I think I just missed this case of allowing text before a header like this.

DanielDe avatar Aug 20 '19 20:08 DanielDe

I noticed that text content before the first * section (valid org-mode content, as far as I know) is not available in the web app. It looks like that is a subset of this issue, is that right?

alanbernstein avatar Sep 29 '19 04:09 alanbernstein

Ah, yep, that is probably contained in this issue. I didn't realize you could put valid org-mode content before the first header.

DanielDe avatar Sep 30 '19 16:09 DanielDe

Definitely! After all, one has to be able to define things like properties and todo keywords. Speaking of which, how much work would it take to become able to parse custom todo keywords?

tokuchan avatar Oct 12 '19 15:10 tokuchan

Ah I think I misunderstood what "valid content" was in this context. org-web actually already does support custom todo keywords, @tokuchan!

In the help file (Settings icon in the top right corner > Help), check out the third header under Actions > Todos (https://github.com/DanielDe/org-web/blob/master/sample.org#L2 and https://github.com/DanielDe/org-web/blob/master/sample.org#L18)

DanielDe avatar Oct 12 '19 17:10 DanielDe