updates default settings & documentation

This commit is contained in:
Martin Monperrus
2016-04-01 00:29:30 +02:00
parent 4afbf1ada3
commit 8fe8c897fb
2 changed files with 17 additions and 12 deletions
+5 -7
View File
@@ -82,27 +82,25 @@ Create a bib file with the publication records (e.g. csgroup2008.bib) and upload
=====FAQ===== =====FAQ=====
====How to embed Bibtexbrowser into a website?==== ====How to embed Bibtexbrowser into a website?====
To embed Bibtexbrowser into a website, you need to use it as a library: To embed Bibtexbrowser into a website, you car use it as a library:
<pre> <pre>
&lt;?php &lt;?php
$_GET['library']=1; $_GET['library']=1;
define('BIBTEXBROWSER_BIBTEX_LINKS',false); // no [bibtex] link by default
require_once('bibtexbrowser.php'); require_once('bibtexbrowser.php');
global $db; global $db;
$db = new BibDataBase(); $db = new BibDataBase();
$db->load('biblio.bib'); $db->load('biblio.bib');
?>
</pre>
Then, you have to call bibtexbrowser on you own:
<pre>
&lt;?php
// printing all 2014 entries // printing all 2014 entries
// can also be $query = array('year'=>'.*');
$query = array('year'=>'2014'); $query = array('year'=>'2014');
$entries=$db->multisearch($query); $entries=$db->multisearch($query);
uasort($entries, 'compare_bib_entries'); uasort($entries, 'compare_bib_entries');
foreach ($entries as $bibentry) { foreach ($entries as $bibentry) {
echo $bibentry->toHTML(); echo $bibentry->toHTML()."&lt;br/>";
} }
?> ?>
</pre> </pre>
+12 -5
View File
@@ -140,7 +140,7 @@ if (defined('ENCODING')) {
@define('BIBTEXBROWSER_AUTHOR_LINKS','homepage'); @define('BIBTEXBROWSER_AUTHOR_LINKS','homepage');
// BIBTEXBROWSER_LAYOUT defines the HTML rendering layout of the produced HTML // BIBTEXBROWSER_LAYOUT defines the HTML rendering layout of the produced HTML
// may be table/list/ordered_list/definition (for <table>, <ol>, <dl> resp.). // may be table/list/ordered_list/definition/none (for <table>, <ol>, <dl>, nothing resp.).
// for list/ordered_list, the abbrevations are not taken into account (see ABBRV_TYPE) // for list/ordered_list, the abbrevations are not taken into account (see ABBRV_TYPE)
// for ordered_list, the index is given by HTML directly (in increasing order) // for ordered_list, the index is given by HTML directly (in increasing order)
@define('BIBTEXBROWSER_LAYOUT','table'); @define('BIBTEXBROWSER_LAYOUT','table');
@@ -1587,8 +1587,9 @@ class BibEntry {
/** Outputs HTML line according to layout */ /** Outputs HTML line according to layout */
function toHTML() { function toHTML($wrapped=false) {
$result = ''; $result = '';
if ($wrapped) {
switch(BIBTEXBROWSER_LAYOUT) { // open row switch(BIBTEXBROWSER_LAYOUT) { // open row
case 'list': case 'list':
$result .= '<li class="bibline">'; $result .= '<li class="bibline">';
@@ -1603,6 +1604,8 @@ class BibEntry {
$result .= '<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;
case 'none':
break;
} }
$result .= $this->anchor(); $result .= $this->anchor();
switch(BIBTEXBROWSER_LAYOUT) { // close bibref and open bibitem switch(BIBTEXBROWSER_LAYOUT) { // close bibref and open bibitem
@@ -1613,7 +1616,7 @@ class BibEntry {
$result .= $this->getAbbrv().'</dt><dd class="bibitem">'; $result .= $this->getAbbrv().'</dt><dd class="bibitem">';
break; break;
} }
}
// may be overridden using configuration value of BIBLIOGRAPHYSTYLE // may be overridden using configuration value of BIBLIOGRAPHYSTYLE
$result .= bib2html($this); $result .= bib2html($this);
@@ -1621,6 +1624,7 @@ class BibEntry {
// may be overridden using configuration value of BIBTEXBROWSER_LINK_STYLE // may be overridden using configuration value of BIBTEXBROWSER_LINK_STYLE
$result .= ' '.bib2links($this); $result .= ' '.bib2links($this);
if ($wrapped) {
switch(BIBTEXBROWSER_LAYOUT) { // close row switch(BIBTEXBROWSER_LAYOUT) { // close row
case 'list': case 'list':
$result .= '</li>'."\n"; $result .= '</li>'."\n";
@@ -1634,6 +1638,9 @@ class BibEntry {
case 'definition': case 'definition':
$result .= '</dd></dl>'."\n"; $result .= '</dd></dl>'."\n";
break; break;
case 'none':
break;
}
} }
return $result; return $result;
} }
@@ -2987,7 +2994,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++));
echo $bib->toHTML(); echo $bib->toHTML(true);
$pred = $bib; $pred = $bib;
} // end foreach } // end foreach
@@ -4057,7 +4064,7 @@ class PagedDisplay {
$index = ($this->page-1)*bibtexbrowser_configuration('PAGE_SIZE') + $i; $index = ($this->page-1)*bibtexbrowser_configuration('PAGE_SIZE') + $i;
if (isset($this->entries[$index])) { if (isset($this->entries[$index])) {
$bib = $this->entries[$index]; $bib = $this->entries[$index];
echo $bib->toHTML(); echo $bib->toHTML(true);
} else { } else {
//break; //break;