Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0RC6

Request #9878 Unable to parse bibtex without authors being spit into an array
Submitted: 2007-01-19 14:50 UTC
From: p dot baker at ieee dot org Assigned: hugoki
Status: Closed Package: Structures_BibTex (version 1.0.0RC2)
PHP Version: Irrelevant OS: FC6
Roadmaps: (Not assigned)    
Subscription  


 [2007-01-19 14:50 UTC] p dot baker at ieee dot org (Pete Baker)
Description: ------------ It is not possible to use Structures_BibTex with the OSBib rendering package (http://bibliophile.sf.net), as the authors field is split into associative arrays when parsing the .bib database. It would be more flexible if a runtime option allowed for the authors field _not_ to be parsed, so the parsing could either be handled further down the line, or not at all. I propose a simple configuration option to allow this: 'extractAuthors'. Test script: --------------- --- BibTex.php 2007-01-19 14:41:14.000000000 +0000 +++ BibTexOld.php 2007-01-19 14:34:01.000000000 +0000 @@ -163,6 +163,7 @@ 'wordWrapBreak' => "\n", 'wordWrapCut' => 0, 'removeCurlyBraces' => false, + 'extractAuthors' => true, ); foreach ($options as $option => $value) { $test = $this->setOption($option, $value); @@ -427,7 +428,7 @@ } } //Handling the authors - if (in_array('author', array_keys($ret))) { + if (in_array('author', array_keys($ret)) && $this->_options['extractAuthors']) { $ret['author'] = $this->_extractAuthors($ret['author']); } }

Comments

 [2007-01-23 23:02 UTC] hugoki at php dot net (Elmar Pitschke)
Thank you for taking the time to report a problem with the package. This problem may have been already fixed by a previous change that is in the CVS of the package. Please log into CVS with: cvs -d :pserver:cvsread@cvs.php.net:/repository login and check out the CVS repository of this package and upgrade cvs -d :pserver:cvsread@cvs.php.net:/repository co pear/Structures_BibTex pear upgrade pear/Structures_BibTex/package2.xml or pear upgrade pear/Structures_BibTex/package.xml If you are able to reproduce the bug with the latest CVS, please change the status back to "Open". Again, thank you for your continued support of PEAR. I added the changes to CVS. Do you want the author field as whole string (Version 1) or still splitted into an array but the single author not splitted (Version 2)? Example: author="John Doe and Jane Doe" Version 1: $data['author']="John Doe and Jane Doe"; Version 2: $data['author'][0]="John Doe"; $data['author'][1]="Jane Doe"; Currently the version one is implemented. Please give me a short feedback if that is ok or version two is wanted.
 [2007-01-24 09:51 UTC] p dot baker at ieee dot org
I think the first version is easiest to work with, although you could easily implement both versions accessible through a configuration option. Depends on exactly on what functionality you want to include in the package. When it comes down to it, parsing the names list using 'and' as a delimiter is easy to implement inside or outside the package. Personally I'll be using the first version you outlined, as I don't parse the names at all - they get passed down through the OSBib renderer and end up as a properly formatted reference with the authors field intact.
 [2007-01-25 20:27 UTC] hugoki at php dot net (Elmar Pitschke)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Structures_BibTex I do not want to have to much configuration options so i will stick to the first version as you requested. Thanks very much for the feedback!