emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Perl parser, some questions
@ 2011-03-31  5:05 Steven Haryanto
  2011-03-31  8:21 ` Eric S Fraga
  2011-03-31  8:39 ` Carsten Dominik
  0 siblings, 2 replies; 6+ messages in thread
From: Steven Haryanto @ 2011-03-31  5:05 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

Hi all,

I'm writing an Org parser for Perl[1]. There are a few things about the
syntax which are still unclear to me.

1. The manual says that multiple (different) in-buffer settings can be
specified on the same line, but so far I haven't found such example
anywhere. What is the syntax for this?

2. For settings that can be applied near a block or table, like:

 |1|2
 |2|6
 #+TBLFM: @2$1=@1$1*2::@2$2=@1$2*3

does it matter if it is specified before/after? Can there be separating
lines between them? E.g.

 #+CAPTION: Some caption
 some text <-- allowed?
 #+LABEL: ...
 some more text <-- allowed?
 |...|...|
 |...|...|

(And btw, multiple #+TBLFM below a table doesn't seem to work on my Emacs,
all formulas need to be specified on a single (long) TBLFM setting.)

3. What constitutes a valid tag? Emacs doesn't seem to recognize tags (e.g.
align them) if they contain a dash.

4. What is the difference between TYP_TODO/TODO/SEQ_TODO? (IIRC, the manual
is not clear on this). Or between TAGS/FILETAGS.


There may be more coming along.

Regards,
Steven

[1] http://search.cpan.org/dist/Org-Parser/lib/Org/Parser.pm

[-- Attachment #2: Type: text/html, Size: 1638 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Perl parser, some questions
  2011-03-31  5:05 Perl parser, some questions Steven Haryanto
@ 2011-03-31  8:21 ` Eric S Fraga
  2011-03-31  8:35   ` Steven Haryanto
  2011-03-31  8:39 ` Carsten Dominik
  1 sibling, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2011-03-31  8:21 UTC (permalink / raw)
  To: Steven Haryanto; +Cc: emacs-orgmode

Steven Haryanto <stevenharyanto@gmail.com> writes:

> Hi all,
>
> I'm writing an Org parser for Perl[1]. There are a few things about the
> syntax which are still unclear to me.
>
> 1. The manual says that multiple (different) in-buffer settings can be
> specified on the same line, but so far I haven't found such example
> anywhere. What is the syntax for this?

If you are referring to lines like this one:

#+OPTIONS: oddeven hideblocks

the syntax is space separated options.

I cannot really help you with the rest of your questions unfortunately.
I do think you may end up getting a little frustrated in the near
future: org has grown "organically" and so doesn't have a well defined
or consistent syntax across all the features.  This is not a criticism
of org mode, by the way... just an observation!

The only real definition of the syntax is the (ever changing) emacs lisp
code that implements it.

What is the main purpose of your parser?

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.122.g2f72.dirty)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Perl parser, some questions
  2011-03-31  8:21 ` Eric S Fraga
@ 2011-03-31  8:35   ` Steven Haryanto
  2011-03-31  8:53     ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Haryanto @ 2011-03-31  8:35 UTC (permalink / raw)
  To: Steven Haryanto, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]

On Thu, Mar 31, 2011 at 3:21 PM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> Steven Haryanto <stevenharyanto@gmail.com> writes:
>
> > Hi all,
> >
> > I'm writing an Org parser for Perl[1]. There are a few things about the
> > syntax which are still unclear to me.
> >
> > 1. The manual says that multiple (different) in-buffer settings can be
> > specified on the same line, but so far I haven't found such example
> > anywhere. What is the syntax for this?
>
> If you are referring to lines like this one:
>
> #+OPTIONS: oddeven hideblocks
>
> the syntax is space separated options.
>

From the manual (emphasis mine): "*Several setting words* can be in the same
line, but you can also have multiple lines for the keyword." So I guess
"setting words" mean setting's arguments (and not setting names, like
specifying OPTIONS and TODO on the same line)?


> What is the main purpose of your parser?
>

I first wrote it because I thought it would be fun, and CPAN does not have
one already. The parser converts Org document into a tree of node objects,
and can be a base for other efforts, like exporter to HTML/TXT/POD.

--
sh

[-- Attachment #2: Type: text/html, Size: 1735 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Perl parser, some questions
  2011-03-31  5:05 Perl parser, some questions Steven Haryanto
  2011-03-31  8:21 ` Eric S Fraga
@ 2011-03-31  8:39 ` Carsten Dominik
  2011-03-31  9:15   ` Steven Haryanto
  1 sibling, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2011-03-31  8:39 UTC (permalink / raw)
  To: Steven Haryanto; +Cc: emacs-orgmode


On Mar 31, 2011, at 7:05 AM, Steven Haryanto wrote:

> Hi all,
> 
> I'm writing an Org parser for Perl[1]. There are a few things about the syntax which are still unclear to me.
> 
> 1. The manual says that multiple (different) in-buffer settings can be specified on the same line, but so far I haven't found such example anywhere. What is the syntax for this?

This only applied to the #+STARTUP settings which can have a number
of keywords on a single line, like

#+STARTUP: align hidestars odd

> 
> 2. For settings that can be applied near a block or table, like:
> 
>  |1|2
>  |2|6
>  #+TBLFM: @2$1=@1$1*2::@2$2=@1$2*3
> 
> does it matter if it is specified before/after? Can there be separating lines between them? E.g.

Yes, there can be other lines in between, even though
this is probably not a good idea.  The way the parser works
is that it runs through the buffer, finds CAPTURE etc and
applies it the next thing (table, link,...) that wants it.

> 
>  #+CAPTION: Some caption
>  some text <-- allowed?
>  #+LABEL: ...
>  some more text <-- allowed?
>  |...|...|
>  |...|...|
> 
> (And btw, multiple #+TBLFM below a table doesn't seem to work on my Emacs, all formulas need to be specified on a single (long) TBLFM setting.)

Yes, only one TBLFM line per table.

> 
> 3. What constitutes a valid tag? Emacs doesn't seem to recognize tags (e.g. align them) if they contain a dash.

Tags are matched by [[:alnum:]_@#%:]+

Dashes are not allowed because this would be cumbersome for the
agenda tags matcher which uses "-" as NOT.

> 
> 4. What is the difference between TYP_TODO/TODO/SEQ_TODO?

TODO and SEQ_TODO are the same.  TYP_TODO is slightly different
in operation.  When you press C-c C-t in a line with the keyword
defined by TYP_TODO, the task will immediately switch to DONE, 
instead of to the next state in the sequence.  I do believe the
manual explains this quite well, but I don't believe many people use this.


> (IIRC, the manual is not clear on this). Or between TAGS/FILETAGS.

TAGS defines tags that will be used in the buffer 
and defines fast keyboard shortcuts for them.  Though
you are allowed to also use tags that are not in tis list.

FILETAGS defines tags that are *inherited* by all trees in the buffer,
You can imagine FILETAGS as the tags specified on a level zero headline
of which all level one headlines in the buffer are children.

HTH.

- Carsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Perl parser, some questions
  2011-03-31  8:35   ` Steven Haryanto
@ 2011-03-31  8:53     ` Eric S Fraga
  0 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2011-03-31  8:53 UTC (permalink / raw)
  To: Steven Haryanto; +Cc: emacs-orgmode

Steven Haryanto <stevenharyanto@gmail.com> writes:

[...]

>From the manual (emphasis mine): "*Several setting words* can be in the same
> line, but you can also have multiple lines for the keyword." So I guess
> "setting words" mean setting's arguments (and not setting names, like
> specifying OPTIONS and TODO on the same line)?

Yes, I think the manual is trying to say that you can have
multiple #+OPTIONS: lines, say, each of which may have one or more
settings (tags:, t:, toc:, ...).

>> What is the main purpose of your parser?
>>
>
> I first wrote it because I thought it would be fun, and CPAN does not have
> one already. The parser converts Org document into a tree of node objects,
> and can be a base for other efforts, like exporter to HTML/TXT/POD.

I asked because org has multiple uses, from outliner through to project
management, and it may help to concentrate on one particular aspect...

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.122.g2f72.dirty)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Perl parser, some questions
  2011-03-31  8:39 ` Carsten Dominik
@ 2011-03-31  9:15   ` Steven Haryanto
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Haryanto @ 2011-03-31  9:15 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2875 bytes --]

On Thu, Mar 31, 2011 at 3:39 PM, Carsten Dominik
<carsten.dominik@gmail.com>wrote:

>
> On Mar 31, 2011, at 7:05 AM, Steven Haryanto wrote:
>
> > Hi all,
> >
> > I'm writing an Org parser for Perl[1]. There are a few things about the
> syntax which are still unclear to me.
> >
> > 1. The manual says that multiple (different) in-buffer settings can be
> specified on the same line, but so far I haven't found such example
> anywhere. What is the syntax for this?
>
> This only applied to the #+STARTUP settings which can have a number
> of keywords on a single line, like
>
> #+STARTUP: align hidestars odd
>
> >
> > 2. For settings that can be applied near a block or table, like:
> >
> >  |1|2
> >  |2|6
> >  #+TBLFM: @2$1=@1$1*2::@2$2=@1$2*3
> >
> > does it matter if it is specified before/after? Can there be separating
> lines between them? E.g.
>
> Yes, there can be other lines in between, even though
> this is probably not a good idea.  The way the parser works
> is that it runs through the buffer, finds CAPTURE etc and
> applies it the next thing (table, link,...) that wants it.
>
> >
> >  #+CAPTION: Some caption
> >  some text <-- allowed?
> >  #+LABEL: ...
> >  some more text <-- allowed?
> >  |...|...|
> >  |...|...|
> >
> > (And btw, multiple #+TBLFM below a table doesn't seem to work on my
> Emacs, all formulas need to be specified on a single (long) TBLFM setting.)
>
> Yes, only one TBLFM line per table.
>
> >
> > 3. What constitutes a valid tag? Emacs doesn't seem to recognize tags
> (e.g. align them) if they contain a dash.
>
> Tags are matched by [[:alnum:]_@#%:]+
>
> Dashes are not allowed because this would be cumbersome for the
> agenda tags matcher which uses "-" as NOT.
>
> >
> > 4. What is the difference between TYP_TODO/TODO/SEQ_TODO?
>
> TODO and SEQ_TODO are the same.  TYP_TODO is slightly different
> in operation.  When you press C-c C-t in a line with the keyword
> defined by TYP_TODO, the task will immediately switch to DONE,
> instead of to the next state in the sequence.  I do believe the
> manual explains this quite well, but I don't believe many people use this.
>
>
> > (IIRC, the manual is not clear on this). Or between TAGS/FILETAGS.
>
> TAGS defines tags that will be used in the buffer
> and defines fast keyboard shortcuts for them.  Though
> you are allowed to also use tags that are not in tis list.
>
> FILETAGS defines tags that are *inherited* by all trees in the buffer,
> You can imagine FILETAGS as the tags specified on a level zero headline
> of which all level one headlines in the buffer are children.
>
> HTH.
>
>
 Thanks for the clear up, Carsten! I've implemented some of the points (like
regex for tags) into the parser, and the rest into the project's todo list.
Btw, you probably meant [[:alnum:]_@#%]+ (without the colon)? Since the
colon is used to separate between tags?

Regards,
Steven

[-- Attachment #2: Type: text/html, Size: 3688 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-31  9:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-31  5:05 Perl parser, some questions Steven Haryanto
2011-03-31  8:21 ` Eric S Fraga
2011-03-31  8:35   ` Steven Haryanto
2011-03-31  8:53     ` Eric S Fraga
2011-03-31  8:39 ` Carsten Dominik
2011-03-31  9:15   ` Steven Haryanto

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).