minor refactoring for better code

This commit is contained in:
Martin Monperrus
2010-07-01 09:59:04 +02:00
parent b4bfbbbe6c
commit b64518d3df
+6 -8
View File
@@ -629,7 +629,7 @@ class BibDBBuilder {
$entryvalue=implode('',$entryvalue_array); $entryvalue=implode('',$entryvalue_array);
if ($finalkey!='url') $formatedvalue = xtrim(latex2html($entryvalue)); if ($finalkey!='url') $formatedvalue = latex2html(xtrim($entryvalue));
else $formatedvalue = trim($entryvalue); else $formatedvalue = trim($entryvalue);
$this->currentEntry->setField($finalkey,$formatedvalue); $this->currentEntry->setField($finalkey,$formatedvalue);
@@ -669,7 +669,7 @@ class BibDBBuilder {
/** extended version of the trim function /** extended version of the trim function
* removes linebreks, tabs, etc. * removes linebreaks, tabs, etc.
*/ */
function xtrim($line) { function xtrim($line) {
$line = trim($line); $line = trim($line);
@@ -737,9 +737,7 @@ function latex2html($line) {
$line = str_replace('}','', $line); $line = str_replace('}','', $line);
$line = str_replace('{','', $line); $line = str_replace('{','', $line);
return $line;
// and some spaces
return trim($line);
} }
/** Note that & are encoded as %26 and not as & so it does not break the Z3988 URL */ /** Note that & are encoded as %26 and not as & so it does not break the Z3988 URL */
@@ -875,7 +873,7 @@ class BibEntry {
/** Returns the authors of this entry as an array */ /** Returns the authors of this entry as an array */
function getFormattedAuthors() { function getFormattedAuthors() {
$authors = array(); $authors = array();
foreach (explode(' and ', $this->getAuthor()) as $author) { foreach ($this->getRawAuthors() as $author) {
$authors[]=formatAuthor($author); $authors[]=formatAuthor($author);
} }
return $authors; return $authors;
@@ -885,7 +883,7 @@ class BibEntry {
/** Returns the authors of this entry as an array in a canonical form */ /** Returns the authors of this entry as an array in a canonical form */
function getCanonicalAuthors() { function getCanonicalAuthors() {
$authors = array(); $authors = array();
foreach (explode(' and ', $this->getAuthor()) as $author) { foreach ($this->getRawAuthors() as $author) {
$authors[]=formatAuthorCanonical($author); $authors[]=formatAuthorCanonical($author);
} }
return $authors; return $authors;
@@ -894,7 +892,7 @@ class BibEntry {
/** Returns the authors of this entry as an array in a comma-separated form */ /** Returns the authors of this entry as an array in a comma-separated form */
function getCommaSeparatedAuthors() { function getCommaSeparatedAuthors() {
$authors = array(); $authors = array();
foreach (explode(' and ', $this->getAuthor()) as $author) { foreach ($this->getRawAuthors() as $author) {
$authors[]=formatAuthorCommaSeparated($author); $authors[]=formatAuthorCommaSeparated($author);
} }
return $authors; return $authors;