refactoring

This commit is contained in:
Martin Monperrus
2013-10-03 22:33:28 +02:00
parent 5d2cb77457
commit 5a9b9f1db5
+16 -15
View File
@@ -1346,44 +1346,45 @@ class BibEntry {
/** Outputs HTML line according to layout */ /** Outputs HTML line according to layout */
function toHTML() { function toHTML() {
$result = '';
switch(BIBTEXBROWSER_LAYOUT) { // open row switch(BIBTEXBROWSER_LAYOUT) { // open row
case 'list': case 'list':
echo '<li class="bibline">'; $result .= '<li class="bibline">';
break; break;
case 'ordered_list': case 'ordered_list':
echo '<li class="bibline">'; $result .= '<li class="bibline">';
break; break;
case 'table': case 'table':
echo '<tr class="bibline"><td class="bibref">'; $result .= '<tr class="bibline"><td class="bibref">';
break; break;
case 'definition': case 'definition':
echo '<dl class="bibline"><dt class="bibref">'; $result .= '<dl class="bibline"><dt class="bibref">';
if (ABBRV_TYPE=='none') { die ('Cannot define an empty term!'); } if (ABBRV_TYPE=='none') { die ('Cannot define an empty term!'); }
break; break;
} }
echo $this->anchor(); $result .= $this->anchor();
switch(BIBTEXBROWSER_LAYOUT) { // close bibref and open bibitem switch(BIBTEXBROWSER_LAYOUT) { // close bibref and open bibitem
case 'table': case 'table':
echo $this->getAbbrv().'</td><td class="bibitem">'; $result .= $this->getAbbrv().'</td><td class="bibitem">';
break; break;
case 'definition': case 'definition':
echo $this->getAbbrv().'</dt><dd class="bibitem">'; $result .= $this->getAbbrv().'</dt><dd class="bibitem">';
break; break;
} }
echo bib2html($this); $result .= bib2html($this);
echo $this->bib2links(); $result .= $this->bib2links();
switch(BIBTEXBROWSER_LAYOUT) { // close row switch(BIBTEXBROWSER_LAYOUT) { // close row
case 'list': case 'list':
echo '</li>'."\n"; $result .= '</li>'."\n";
break; break;
case 'ordered_list': case 'ordered_list':
echo '</li>'."\n"; $result .= '</li>'."\n";
break; break;
case 'table': case 'table':
echo '</td></tr>'."\n"; $result .= '</td></tr>'."\n";
break; break;
case 'definition': case 'definition':
echo '</dd></dl>'."\n"; $result .= '</dd></dl>'."\n";
break; break;
} }
return $result; return $result;
@@ -2451,7 +2452,7 @@ class SimpleDisplay {
// by default, index are in decreasing order // by default, index are in decreasing order
// so that when you add a publicaton recent , the indices of preceding publications don't change // so that when you add a publicaton recent , the indices of preceding publications don't change
$bib->setIndex($count-($i++)); $bib->setIndex($count-($i++));
$bib->toHTML(); echo $bib->toHTML();
$pred = $bib; $pred = $bib;
} // end foreach } // end foreach
@@ -3344,7 +3345,7 @@ class PagedDisplay {
$index = ($this->page-1)*PAGE_SIZE + $i; $index = ($this->page-1)*PAGE_SIZE + $i;
if (isset($this->entries[$index])) { if (isset($this->entries[$index])) {
$bib = $this->entries[$index]; $bib = $this->entries[$index];
$bib->toHTML(); echo $bib->toHTML();
} else { } else {
//break; //break;