-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Parse content-line as text instead of just .* #27
Conversation
Hi @branch14 , I think we have to update your transformers. The transformed parse result should be something like this, right? [[:headline {:level 1, :title "hello world"}]
[:content
[:raw "this is the first section\n\n"]
[:parsed
[:content-line [:text [:text-normal "this is the first section"]]]
[:empty-line]]
[:headline {:level 2, :title "and this"}]
[:content
[:raw "\nis another section\n"]
[:parsed
[:empty-line]
[:content-line [:text [:text-normal "is another section"]]]] https://github.com/schoettl/org-parser/blob/feat/parse-text/test/org_parser/transform_test.cljc#L40 Of course, the elements inside I'm yet lost in the transformer code. So if you have time to update the transformer a little bit, it would be appreciated! PS: How can I embed a line of code in comments like @munen did it here? PPS: Regarding |
This comment has been minimized.
This comment has been minimized.
@schoettl Yes, the transforms currently in place are just a humble beginning. They need to be extended! I like the idea to have
Using the metadata to extract the raw string is a nifty hack! I'll give it a try. Do you think we'll need all tags in the AST of Somewhat related: It seems to me it might make sense to refactor the tests (and transformations) to be organized by features. That way we can later have (1) the input org, (2) the resulting AST, (3) the transformed result, and (4) the output org closer together, which will greatly reduce cognitive load while working on a feature. What do you think? |
I'm good with
I'm not sure about this naming. In #31 , I quote the org spec which seems to distinguish between headline and section (section beeing the content below the headline).
You mean the
I think it makes sense to sort tests by org feature. But I'm not sure about putting low-level parser tests and the tests of transformed AST in the same place. Because for some org features I have dozens of parser tests and edge cases. And many of them may not be relevant for the tests of transformations. But having tests for parsing+transformation and org code generation close together (with sample input org to compare with generated org) is probably a good thing! |
Absolutely.
Then I have to study the spec again. I thought something like this would be idiomatic
I like to stick to the wording of the spec where possible, but I also won't to provide a meaningful and easy to work with data structure. And I will likely not want to sacrifice the later for the former. We could even drop the whole
Yes
I concur. I'm sure we'll find a structure that makes sense here. I'm working on this. And I'll provide a PR. But I'll need some time. |
I like your proposed structure. But how can we represent the first section without headline? Omitting the Regarding the hidden tags. Yeah, your example makes sense. Originally, I planned to recursively parse styled markup (i.e. markup can contain markup, timestamps, and links), but that will probably not work. Currently, only very simple markup will be parsed, so it's no problem to hide that tag. Great! Looking forward to your PR. Did you fork or extend this PR? |
The list of sections will anyway be embedded in some buffer context, to store In-Buffer Settings. I'd expect it to look somewhat like this
and sections will be just a map
we could even drop
I pulled your branch and I'm working on that. My PR will merge into yours, which we'll merge to master once its feature complete. Hope that works for you. |
I agree. But I would keep the For example, we later also need
👍 |
Then it should probably be
|
Yes. It's a bit verbose but I think it's the cleanest solution! It will help to quickly understand the structure. I remember that Organice's parse structure was a bit confusing for me because there is no such separation. |
@schoettl branch14 and me just worked ok a PR as discussed here. The PR refactors I just saw that you're using a fork of org-parser at schoettl/org-parser. Hence, the PR is https://github.com/schoettl/org-parser/pull/1 Do you have a reason for using a fork? I presume it's because you still use the same repository from when you were not an org-parser maintainer(; If it works for you, I'd suggest to use the upstream repository directly. This will make at least these things easier that are now a bit complicated:
|
@munen Oh, I wasn't aware of that I branched or pushed branches still to my fork repo. At least my local master has already this repo as upstream. Probably it's best, I remove my forked repo so that I cannot accidentally push to it anymore. Can you just push the branch you worked on to 200ok-ch/org-parser? |
Or should I merge your PR at schoettl#1 into this, now? |
I think the easiest is to open a new PR here, which will include #27 (which would otherwise merge https://github.com/schoettl/org-parser/tree/feat/parse-text). I'll do that now. Closing this PR in favour of #36 |
The goal of this PR is to enable the EBNF parser to parse details in the content after a headline, e.g. links, timestamps, …
Closes #26
Closes #30
:raw
along with:ast