CC: | stevenharyanto [...] gmail.com, mengwong [...] gmail.com |
Subject: | get_property bug in Org::Element |
i believe that a property is generally considered to belong to the headline of an entry, not to
the text. the get_property method wrongly searches siblings for properties when it should
only search children.
example .org file:
20130112-23:41:42 mengwong@cny2:~% cat /var/tmp/testcase.org
* my first heading
my first body
* my second heading
:PROPERTIES:
:myproperty: foo
:END:
my second body
** my first child
:PROPERTIES:
:babyname: poodle
:END:
this is a child of the second heading
wrong behaviour:
20130112-23:40:29 mengwong@cny2:~% perl -MOrg::Parser -le 'my $orgp = Org::Parser-
Show quoted text
>new; my $doc = $orgp->parse_file($ARGV[0]); $doc->walk(sub { my ($el) = @_; return
unless $el->isa("Org::Element::Headline"); if (my $property = $el->get_property($ARGV[1])) {
print "$el(@{[$el->as_string]}) has property $ARGV[1] = $property\n" } });'
/var/tmp/testcase.org myproperty
Org::Element::Headline=HASH(0x7f9d8c200fc0)(** my first child
:PROPERTIES:
:babyname: poodle
:END:
this is a child of the second heading
) has property myproperty = foo
correct behaviour:
20130112-23:40:34 mengwong@cny2:~% perl -MOrg::Parser -le 'my $orgp = Org::Parser-
Show quoted text>new; my $doc = $orgp->parse_file($ARGV[0]); $doc->walk(sub { my ($el) = @_; return
unless $el->isa("Org::Element::Headline"); if (my $property = $el->get_property($ARGV[1])) {
print "$el(@{[$el->as_string]}) has property $ARGV[1] = $property\n" } });'
/var/tmp/testcase.org myproperty
Org::Element::Headline=HASH(0x7fdaea202c18)(* my second heading
:PROPERTIES:
:myproperty: foo
:END:
my second body
** my first child
:PROPERTIES:
:babyname: poodle
:END:
this is a child of the second heading
) has property myproperty = foo
patch attached.
Subject: | Element.pm-patch |
Message body not shown because it is not plain text.