Re: official orgmode parser

2020-11-28 Thread Gerry Agbobada
Hello, On Wed, Nov 11, 2020, at 10:15, Bastien wrote: > > The example file would be also good to help users track for small > syntactic changes, when they happen. > > When I thought mistakenly I could use an EBNF parser to parse Org-mode, I wrote a little examples to get going (never went

Re: official orgmode parser

2020-11-12 Thread Tom Gillespie
Hi Bastien, I agree it would be great to ask them to contribute to whichever ruby library they are using. I will see if I can get in touch, but I have no idea of where to start if we really want to get to the folks who could make a decision. It looks like gitlab uses the same org-ruby library

Re: official orgmode parser

2020-11-11 Thread Daniele Nicolodi
On 11/11/2020 10:15, Bastien wrote: > Hi Daniele, > > Daniele Nicolodi writes: > >> Would it make sense to have one "official" (or a set of) org-mode test >> files and the corresponding syntax tree as parsed by org-elements (maybe >> in a format easier to read from other programming languages

Re: official orgmode parser

2020-11-11 Thread Bastien
Hi Daniele, Daniele Nicolodi writes: > Would it make sense to have one "official" (or a set of) org-mode test > files and the corresponding syntax tree as parsed by org-elements (maybe > in a format easier to read from other programming languages than > s-expressions, json maybe?) to make

Re: official orgmode parser

2020-11-11 Thread Bastien
Hi Tom, Tom Gillespie writes: >> which Ruby org-mode parser does Github use? > > I'm pretty sure that github uses https://github.com/wallyqs/org-ruby. > It is ... not compliant, shall we say. I have making some fixes to the > footnote parsing section on my todo list, but I don't expect to get

Re: official orgmode parser

2020-11-11 Thread Bastien
Hi Ken, Ken Mankoff writes: > Yes, I meant to write that I think Org syntax is maybe *not* > context-free, and therefore EBNF can't capture all of it. But it could > still be very helpful and capture most of it. Perhaps. Or you willing to give it a try and report here? -- Bastien

Re: official orgmode parser

2020-11-11 Thread Bastien
Hi Ken, Ken Mankoff writes: > On 2020-10-26 at 09:24 -07, Nicolas Goaziou wrote... >> # This is a comment (1) >> >> #+begin_example >> # This is not a comment (2) >> #+end_example >> >> AFAICT, you cannot distinguish between lines (1) and (2) with EBNF. > > I agree. I think

Re: official orgmode parser

2020-11-11 Thread Bastien
Hi Sébastien, rey-coyrehourcq writes: > Some partial org Parsers (AST or regex...) i found on the web for a > recent state of the art : Thanks -- I've updated https://orgmode.org/worg/org-tools/ with this information. Best, -- Bastien

Re: official orgmode parser

2020-10-26 Thread Przemysław Kamiński
I'm no expert in parsing but I would expect org's parser to be quite similar to the multitude of markdown or CommonMark [1] parsers. There isn't that much difference in syntax, except maybe org is more versatile and has more syntax elements, like drawers. Searching for "EBNF Markdown" I

Re: official orgmode parser

2020-10-26 Thread Tom Gillespie
Even if this did work for plain lists it won't work for headlines because headlines have an arbitrary number of stars and thus it is not possible for the grammar to know what is a sub-headline vs "the next headline". For a similar reason I'm fairly sure that the sublist approach will not work due

Re: official orgmode parser

2020-10-26 Thread Ken Mankoff
On 2020-10-26 at 14:00 -07, Tom Gillespie wrote... >> list ::= ('+' string newline)+ sublist? >> sublist ::= (indent list)+ >> >> I think this captures lists? > > Ah yes, I see my mistake here. In order for this to work the parser > has to implement significant whitespace, so whitespace cannot

Re: official orgmode parser

2020-10-26 Thread Tom Gillespie
Here is an attempt to clarify my own confusion around the nested structures in org. In short: each node in the headline tree and the plain list tree can be parse using the EBNF, the nesting level cannot, which means that certain useful operations such as folding, require additional rules beyond

Re: official orgmode parser

2020-10-26 Thread Ken Mankoff
On 2020-10-26 at 10:59 -07, Tom Gillespie wrote... > You can identify headlines, but you can't identify nesting level; Do you need to? This is valid as an entire Org file, I think: *** foo * bar * baz And that can be represented in EBNF. I'm not aware of places where behavior is

Re: official orgmode parser

2020-10-26 Thread Tom Gillespie
I started writing down Org's grammar as an EBNF (with Racket's #lang brag) on Saturday. There is indeed a layer of Org grammar that can be implemented via EBNF, but it is fairly minimal. You can identify headlines, but you can't identify nesting level; the arbitrary nesting depth means that you

Re: official orgmode parser

2020-10-26 Thread Ken Mankoff
On 2020-10-26 at 09:24 -07, Nicolas Goaziou wrote... > # This is a comment (1) > > #+begin_example > # This is not a comment (2) > #+end_example > > AFAICT, you cannot distinguish between lines (1) and (2) with EBNF. I agree. I think this is a better (correct?) example than the

Re: official orgmode parser

2020-10-26 Thread Nicolas Goaziou
Ken Mankoff writes: > Yes, I meant to write that I think Org syntax is maybe *not* > context-free, and therefore EBNF can't capture all of it. But it could > still be very helpful and capture most of it. I'm not arguing about the usefulness of a partial EBNF description. I'm merely pointing out

Re: official orgmode parser

2020-10-26 Thread Ken Mankoff
On 2020-10-26 at 07:21 -07, Nicolas Goaziou wrote... > Ken Mankoff writes: > >> I question if this is possible because EBNF is for context-free >> grammars, but I *think* Org syntax is context-free. > > It's not as explained in a footnote in the Org syntax document. Yes, I meant to write that

Re: official orgmode parser

2020-10-26 Thread Nicolas Goaziou
Hello, Ken Mankoff writes: > I question if this is possible because EBNF is for context-free > grammars, but I *think* Org syntax is context-free. It's not as explained in a footnote in the Org syntax document. Regards, -- Nicolas Goaziou

Re: official orgmode parser

2020-10-26 Thread Ken Mankoff
Hello, On 2020-09-23 at 01:09 -07, Bastien wrote... > I disagree that a parser is too difficult to maintain because Org is a > moving target. Org core syntax is not moving anymore, a parser can > reasonably target it. That's what is done with the Ruby parser, in use > in this small project

Re: official orgmode parser

2020-10-24 Thread Tom Gillespie
> which Ruby org-mode parser does Github use? I'm pretty sure that github uses https://github.com/wallyqs/org-ruby. It is ... not compliant, shall we say. I have making some fixes to the footnote parsing section on my todo list, but I don't expect to get to it any time in the near future. Tom

Re: official orgmode parser

2020-10-24 Thread Daniele Nicolodi
On 23/09/2020 10:09, Bastien wrote: > I disagree that a parser is too difficult to maintain because Org is > a moving target. Org core syntax is not moving anymore, a parser can > reasonably target it. That's what is done with the Ruby parser, in > use in this small project called github.com :)

Re: official orgmode parser

2020-09-23 Thread rey-coyrehourcq
Hi Przemysław, Some partial org Parsers (AST or regex...) i found on the web for a recent state of the art : * org-js https://github.com/mooz/org-js * orgajs Orga is a flexible org-mode syntax parser. It parses org content into AST (Abstract Syntax Tree) https://github.com/orgapp/orgajs *

Re: official orgmode parser

2020-09-23 Thread Przemysław Kamiński
On 9/23/20 10:09 AM, Bastien wrote: Hi Przemysław, Przemysław Kamiński writes: I oftentimes find myself needing to parse org files with some external tools (to generate reports for customers or sum up clock times for given month, etc). Looking through the list

Re: official orgmode parser

2020-09-23 Thread Bastien
Hi Gerry, "Gerry Agbobada" writes: > Having a tree-sitter parser would be really great in my opinion 1+ Thanks for working on this, let us know how it goes! -- Bastien

Re: official orgmode parser

2020-09-23 Thread Bastien
Hi Przemysław, Przemysław Kamiński writes: > I oftentimes find myself needing to parse org files with some external > tools (to generate reports for customers or sum up clock times for > given month, etc). Looking through the list > > https://orgmode.org/worg/org-tools/ Can you help on making

Re: official orgmode parser

2020-09-17 Thread Przemysław Kamiński
On 9/17/20 3:18 AM, Ihor Radchenko wrote: So basically this is what this thread is about. One needs a working Emacs instance and work in "push" mode to export any Org data. This requires dealing with temporary files, as described above, and some ad-hoc formats to keep whatever data I need to

Re: official orgmode parser

2020-09-16 Thread Ihor Radchenko
> So basically this is what this thread is about. One needs a working > Emacs instance and work in "push" mode to export any Org data. This > requires dealing with temporary files, as described above, and some > ad-hoc formats to keep whatever data I need to pull from org. > "Pull" mode would

Re: official orgmode parser

2020-09-16 Thread Matt Huszagh
"Gerry Agbobada" writes: > I'm currently toying with the idea of trying a tree-sitter parser for Org. > The very static nature of a shared object parser (knowing TODO keywords are > pretty dynamic for example) is a challenge I'm not sure to overcome ; to be > honest even without that I can't

Re: official orgmode parser

2020-09-16 Thread Ihor Radchenko
FYI: You may find https://github.com/ndwarshuis/org-ml helpful. Przemysław Kamiński writes: > On 9/15/20 2:37 PM, to...@tuxteam.de wrote: >> On Tue, Sep 15, 2020 at 01:15:56PM +0200, Przemysław Kamiński wrote: >> >> [...] >> >>> There's the org-json (or ox-json) package but for some reason I

Re: official orgmode parser

2020-09-16 Thread Przemysław Kamiński
On 9/16/20 2:02 PM, Ihor Radchenko wrote: However what Ihor presented is interesting. Do you use similar approach with shellout and 'emacs -batch' to show currently running task or you 'push' data from emacs to show it in the taskbar? I prefer to avoid querying emacs too often for performance

Re: official orgmode parser

2020-09-16 Thread tomas
On Wed, Sep 16, 2020 at 02:09:42PM +0200, Przemysław Kamiński wrote: [...] > So I looked at (pp (org-element-parse-buffer)) however it does print > out recursive stuff which other schemes have trouble parsing. > > My code looks more or less like this: > > (defun org-parse (f) >

Re: official orgmode parser

2020-09-16 Thread Przemysław Kamiński
On 9/15/20 2:37 PM, to...@tuxteam.de wrote: On Tue, Sep 15, 2020 at 01:15:56PM +0200, Przemysław Kamiński wrote: [...] There's the org-json (or ox-json) package but for some reason I wasn't able to run it successfully. I guess export to S-exps would be best here. But yes I'll check that out.

Re: official orgmode parser

2020-09-16 Thread Ihor Radchenko
> However what Ihor presented is interesting. Do you use similar approach > with shellout and 'emacs -batch' to show currently running task or you > 'push' data from emacs to show it in the taskbar? I prefer to avoid querying emacs too often for performance reasons. Instead, I only update the

Re: official orgmode parser

2020-09-16 Thread Przemysław Kamiński
On 9/16/20 9:56 AM, Ihor Radchenko wrote: Wow, another awesomewm user here; could you share your code? Are you interested in something particular about awesome WM integration? I am using simple textbox widgets to show currently clocked in task and weighted summary of clocked time. See the

Re: official orgmode parser

2020-09-16 Thread Ihor Radchenko
> Wow, another awesomewm user here; could you share your code? Are you interested in something particular about awesome WM integration? I am using simple textbox widgets to show currently clocked in task and weighted summary of clocked time. See the attachments. Best, Ihor Marcin Borkowski

Re: official orgmode parser

2020-09-16 Thread Marcin Borkowski
On 2020-09-15, at 11:17, Przemysław Kamiński wrote: > So, I keep clock times for work in org mode, this is very > handy. However, my customers require that I use their service to > provide the times. They do offer API. So basically I'm using elisp to > parse org, make API calls, and at the

Re: official orgmode parser

2020-09-15 Thread Tim Cross
Przemysław Kamiński writes: > > So, I keep clock times for work in org mode, this is very handy. > However, my customers require that I use their service to provide the > times. They do offer API. So basically I'm using elisp to parse org, > make API calls, and at the same time generate CSV

Re: official orgmode parser

2020-09-15 Thread Diego Zamboni
There's also org-ql (https://github.com/alphapapa/org-ql), which also provides a query-based API against Org structures. --Diego On Tue, Sep 15, 2020 at 2:59 PM wrote: > On Tue, Sep 15, 2020 at 01:15:56PM +0200, Przemysław Kamiński wrote: > > [...] > > > There's the org-json (or ox-json)

Re: official orgmode parser

2020-09-15 Thread tomas
On Tue, Sep 15, 2020 at 01:15:56PM +0200, Przemysław Kamiński wrote: [...] > There's the org-json (or ox-json) package but for some reason I > wasn't able to run it successfully. I guess export to S-exps would > be best here. But yes I'll check that out. If that's your route, perhaps the "Org

Re: official orgmode parser

2020-09-15 Thread Przemysław Kamiński
On 9/15/20 11:55 AM, Russell Adams wrote: On Tue, Sep 15, 2020 at 11:17:57AM +0200, Przemysław Kamiński wrote: Org mode IS an elsip application. This is the main goal. The reason it works so well is because elisp is largely a DSL that focuses on text manipulation and is therefore ideally suited

Re: official orgmode parser

2020-09-15 Thread Russell Adams
On Tue, Sep 15, 2020 at 11:17:57AM +0200, Przemysław Kamiński wrote: > > Org mode IS an elsip application. This is the main goal. The reason it > > works so well is because elisp is largely a DSL that focuses on text > > manipulation and is therefore ideally suited for a text based organiser. > >

Re: official orgmode parser

2020-09-15 Thread Przemysław Kamiński
On 9/15/20 11:03 AM, Tim Cross wrote: Przemysław Kamiński writes: Hello, I oftentimes find myself needing to parse org files with some external tools (to generate reports for customers or sum up clock times for given month, etc). Looking through the list https://orgmode.org/worg/org-tools/

Re: official orgmode parser

2020-09-15 Thread Tim Cross
Przemysław Kamiński writes: > Hello, > > I oftentimes find myself needing to parse org files with some external > tools (to generate reports for customers or sum up clock times for given > month, etc). Looking through the list > > https://orgmode.org/worg/org-tools/ > > and having tested

Re: official orgmode parser

2020-09-15 Thread Gerry Agbobada
Hi, I'm currently toying with the idea of trying a tree-sitter parser for Org. The very static nature of a shared object parser (knowing TODO keywords are pretty dynamic for example) is a challenge I'm not sure to overcome ; to be honest even without that I can't say I'll manage to do it.