Skip Menu |

This queue is for tickets about the Org-Parser CPAN distribution.

Report information
The Basics
Id: 82658
Status: resolved
Priority: 0/
Queue: Org-Parser

People
Owner: Nobody in particular
Requestors: FREESIDE [...] cpan.org
Cc: mengwong [...] gmail.com
stevenharyanto [...] gmail.com
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



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
Download Element.pm-patch
application/octet-stream 833b

Message body not shown because it is not plain text.

hi, after re-reading http://orgmode.org/manual/Properties-and-Columns.html i think you're correct. "entry" in the manual probably refers to headlines and not any element. moved get_property() from Org::Element base class to Org::Element::Headline and change it to search children instead of sibling. released 0.29. thanks! regards, steven
CC: "FREESIDE [...] cpan.org" <FREESIDE [...] cpan.org>, "stevenharyanto [...] gmail.com" <stevenharyanto [...] gmail.com>
Subject: Re: [rt.cpan.org #82658] get_property bug in Org::Element
Date: Wed, 16 Jan 2013 09:18:06 +0800
To: "bug-Org-Parser [...] rt.cpan.org" <bug-Org-Parser [...] rt.cpan.org>
From: Meng Weng Wong <mengwong [...] gmail.com>
Cool, thank you!