-
-
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
Parse content text that can contain style, links, footnotes, timestamps, ... #9
Conversation
Maybe, I should mention, why I put so much effort in file links compared to all other forms of links. File links, specifically with location information ( Also organice might use the file links and internal links in future, so it's best to implement detailed parsing directly here in EBNF. |
@schoettl I'm super stoked about your internal links implementation. That'll be a great addition to organice at some point 😄 |
BNF for styled text and links must be adapted to match orgmodes syntax but the new tests are good so far. |
Note: Reference implementation for emphasizing text (style):
Problem: orgmode (at least in export) supports multi-line emphasize; we can't because parsing is line-based. We don't use this regex directly because we have a EBNF parser. Probably, I have to
I will see how it behaves with recursion and what will happen when a match does not work (backtracking?). Not parsing multi-line emphasize correctly wouldn't be too bad, if the line is parsed as text-normal instead. Ref card revealing some details: More: And tables!
Implement sub- and superscripts: https://orgmode.org/manual/Subscripts-and-Superscripts.html |
Just a comment at a random time: you’re on 🔥, there’s already loads of amazing stuff in this PR! Sorry for the non-helpful comment, but I had to say it out loud(; |
Problem with parsing styled text: I have to first parse preceding non-styled normal text. But I can't just stop parsing normal text before any style delimiter because I have to make sure, the delimiter is preceded by a space (e.g. If I stop parsing only before delimiters preceded by space (using look-ahead), I cannot parse links, footnotes, or Combinations of the styled text delimiters and link/footnote delimiters do not work, e.g.
(possibly with look-aheads) They cannot work because 1) eats up styled text and 2) matches everything! I'm close to giving up with styled text. Edit: Not before I've asked some experts... org.el works differently: It has a regex (org-emph-re and org-verbatim-re) that matches the styled text and the character before and after. The BNF parser cannot do this. It can look ahead but not backwards, i.e. it cannot check the character before the styled text. ox-latex.el – don't know yet, how the org to latex exporter work, I couldn't find the place where parses styled text. Maybe it's in org-element.el, e.g. org-element-bold-parser. Anyway, it uses the org-emph-re regex which I cannot use in BNF parser. |
[1] https://orgmode.org/manual/Markup-for-Rich-Contents.html#Markup-for-Rich-Contents |
Hi @munen, I think this PR is ready for review and merge. There is a lot of good and stable things in it. The remaining problems are mostly related to the ungreatful and recursive nature of the emphasis markup Anyway, it should be a solid base for improvements. I'll rebase #11 after the merge. |
Amazing stuff, @schoettl, as always! Will happily merge! 🙏 🙇 |
text is any orgmode text that can contain style, links, footnotes, timestamps, ...
It can be a full line or part of a line (e.g. in title, lists, property values, tables, ...)