Beispiel #1
0
function display_one($id, $format = '', $callback = '')
{
    global $config;
    global $couch;
    global $memcache;
    global $cacheAvailable;
    $obj = null;
    // grab JSON from CouchDB
    $couch_id = $id;
    if ($cacheAvailable == true) {
        $obj = $memcache->get($couch_id);
    }
    if ($obj) {
        $obj->status = 200;
    } else {
        // fetch from CouchDB
        $obj = new stdclass();
        $resp = $couch->send("GET", "/" . $config['couchdb_options']['database'] . "/" . urlencode($couch_id));
        $reference = json_decode($resp);
        if (isset($reference->error)) {
            $obj->status = 404;
        } else {
            $obj = $reference;
            $obj->status = 200;
            if ($cacheAvailable == true) {
                $memcache->set($couch_id, $reference);
            }
        }
    }
    // Format object (if needed)
    if ($obj->status == 200) {
        switch ($format) {
            case 'citeproc':
                $obj = reference_to_citeprocjs($obj);
                $obj['status'] = 200;
                break;
            default:
                break;
        }
    }
    api_output($obj, $callback);
}
Beispiel #2
0
function display_record($id)
{
    global $config;
    global $couch;
    $reference = null;
    if (0) {
        // for now grab this from BioStor
        $json = get('http://biostor.org/reference/' . $id . '.bibjson');
        $reference = json_decode($json);
    } else {
        // grab JSON from CouchDB
        $couch_id = $id;
        $resp = $couch->send("GET", "/" . $config['couchdb_options']['database'] . "/" . urlencode($couch_id));
        $reference = json_decode($resp);
        if (isset($reference->error)) {
            // bounce
            header('Location: ' . $config['web_root'] . "\n\n");
            exit(0);
        }
    }
    $citeproc_obj = reference_to_citeprocjs($reference, 'ITEM-1');
    $bibdata['ITEM-1'] = $citeproc_obj;
    $bibdata_json = json_encode($bibdata);
    // HTML template
    $template = <<<EOT
<!DOCTYPE html>
\t<html>
        <head>
            <meta charset="utf-8"/>
            
            <base href="<BASE>" />
            
            <title><TITLE></title>

\t\t\t<!-- Le styles -->
\t\t\t<link href="assets/css/bootstrap.css" rel="stylesheet">
\t\t\t<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
\t\t\t
\t\t\t<link href='font-awesome.css' media='screen' rel='stylesheet' type='text/css' />\t\t\t
\t\t
\t\t\t<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
\t\t\t<!--[if lt IE 9]>
\t\t\t  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
\t\t\t<![endif]-->            
\t\t\t
\t\t\t<!-- citeproc-js -->
\t\t\t<script src="citeproc-js/loadabbrevs.js"></script>
\t\t\t<script src="citeproc-js/xmldom.js"></script>
\t\t\t<script src="citeproc-js/citeproc.js"></script>
\t\t\t<script src="citeproc-js/loadlocale.js"></script>
\t\t\t<script src="citeproc-js/loadsys.js"></script>
\t\t\t<!--<script src="citeproc-js/loadcsl.js"></script>\t\t-->
\t\t\t
\t\t\t<script>

\t\t\tvar bibdata = <BIBDATA>;
\t\t\t
\t\t\t// This defines the mechanism by which we get hold of the relevant data for
\t\t\t// the locale and the bibliography. 
\t\t\t// 
\t\t\t// In this case, they are pretty trivial, just returning the data which is
\t\t\t// embedded above. In practice, this might involving retrieving the data from
\t\t\t// a standard URL, for instance. 
\t\t\tvar sys = {
\t\t\t\tretrieveItem: function(id){
\t\t\t\t\treturn bibdata[id];
\t\t\t\t},
\t\t\t
\t\t\t\tretrieveLocale: function(lang){
\t\t\t\t\treturn locale[lang];
\t\t\t\t}
\t\t\t}
\t\t\t\t\t\t
\t\t\t// This is the citation object. Here, we have hard-coded this, so it will only
\t\t\t// work with the correct HTML. 
\t\t\tvar citation_object = 
\t\t\t\t{
\t\t\t\t\t// items that are in a citation that we want to add. in this case,
\t\t\t\t\t// there is only one citation object, and we know where it is in
\t\t\t\t\t// advance. 
\t\t\t\t\t"citationItems": [
\t\t\t\t\t\t{
\t\t\t\t\t\t\t"id": "ITEM-1"
\t\t\t\t\t\t}
\t\t\t\t\t],
\t\t\t\t\t// properties -- count up from 0
\t\t\t\t\t"properties": {
\t\t\t\t\t\t"noteIndex": 0
\t\t\t\t\t}
\t\t\t\t\t  
\t\t\t\t}
\t\t\t
\t\t\t
\t\t\tvar cite_styles = new Array();
\t\t\t
\t\t\tcite_styles['chicago_author_date'] = "<style       xmlns=\\"http://purl.org/net/xbiblio/csl\\"      class=\\"in-text\\"   default-locale=\\"en-US-x-sort-ja-alalc97-x-sec-en\\">  <!-- BOGUS COMMENT -->  <info>    <title>Chicago Manual of Style (Author-Date format)</title>    <id>http://www.zotero.org/styles/chicago-author-date</id>    <link href=\\"http://www.zotero.org/styles/chicago-author-date\\" />    <author>      <name>Julian Onions</name>      <email>julian.onions@gmail.com</email>    </author>    <category term=\\"author-date\\" />    <category term=\\"generic-base\\" />    <updated />    <summary>The author-date variant of the Chicago style</summary>    <link href=\\"http://www.chicagomanualofstyle.org/tools_citationguide.html\\" rel=\\"documentation\\" />  </info> <macro name=\\"secondary-contributors\\">    <choose>      <if match=\\"none\\" type=\\"chapter\\">        <group delimiter=\\". \\">          <choose>            <if variable=\\"author\\">              <names variable=\\"editor\\">                <label form=\\"verb-short\\" prefix=\\" \\" suffix=\\". \\" text-case=\\"capitalize-first\\" />                <name and=\\"text\\" delimiter=\\", \\" />              </names>            </if>          </choose>          <choose>            <if match=\\"any\\" variable=\\"author editor\\">              <names variable=\\"translator\\">                <label form=\\"verb-short\\" prefix=\\" \\" suffix=\\". \\" text-case=\\"capitalize-first\\" />                <name and=\\"text\\" delimiter=\\", \\" />              </names>            </if>          </choose>        </group>      </if>    </choose>  </macro><!-- BOGUS COMMENT -->    <macro name=\\"container-contributors\\">    <choose>      <if type=\\"chapter\\">        <group delimiter=\\", \\" prefix=\\",\\">          <choose>            <if variable=\\"author\\">              <names variable=\\"editor\\">                <label form=\\"verb-short\\" prefix=\\" \\" suffix=\\". \\" text-case=\\"lowercase\\" />                <name and=\\"text\\" delimiter=\\", \\" />              </names>            </if>          </choose>          <choose>            <if match=\\"any\\" variable=\\"author editor\\">              <names variable=\\"translator\\">                <label form=\\"verb-short\\" prefix=\\" \\" suffix=\\". \\" text-case=\\"lowercase\\" />                <name and=\\"text\\" delimiter=\\", \\" />              </names>            </if>          </choose>        </group>      </if>    </choose>  </macro>  <macro name=\\"anon\\">    <choose>      <if match=\\"none\\" variable=\\"author editor translator\\">        <text form=\\"short\\" term=\\"anonymous\\" text-case=\\"capitalize-first\\" />      </if>    </choose>  </macro>  <macro name=\\"editor\\">    <names variable=\\"editor\\">      <name and=\\"text\\" delimiter=\\", \\" delimiter-precedes-last=\\"always\\" name-as-sort-order=\\"first\\" sort-separator=\\", \\" />      <label form=\\"short\\" prefix=\\", \\" suffix=\\".\\" />    </names>  </macro>  <macro name=\\"translator\\">    <names variable=\\"translator\\">      <name and=\\"text\\" delimiter=\\", \\" delimiter-precedes-last=\\"always\\" name-as-sort-order=\\"first\\" sort-separator=\\", \\" />      <label form=\\"verb-short\\" prefix=\\", \\" suffix=\\".\\" />    </names>  </macro>  <macro name=\\"recipient\\">    <choose>      <if type=\\"personal_communication\\">        <choose>          <if variable=\\"genre\\">            <text text-case=\\"capitalize-first\\" variable=\\"genre\\" />          </if>          <else>            <text term=\\"letter\\" text-case=\\"capitalize-first\\" />          </else>        </choose>      </if>    </choose>    <names delimiter=\\", \\" variable=\\"recipient\\">      <label form=\\"verb\\" prefix=\\" \\" suffix=\\" \\" text-case=\\"lowercase\\" />      <name and=\\"text\\" delimiter=\\", \\" />    </names>  </macro>  <macro name=\\"contributors\\">    <names variable=\\"author\\">      <name and=\\"text\\" delimiter=\\", \\" delimiter-precedes-last=\\"always\\" name-as-sort-order=\\"first\\" sort-separator=\\", \\" />      <label form=\\"verb-short\\" prefix=\\", \\" suffix=\\".\\" text-case=\\"lowercase\\" />      <substitute>        <text macro=\\"editor\\" />        <text macro=\\"translator\\" />      </substitute>    </names>    <text macro=\\"anon\\" />    <text macro=\\"recipient\\" />  </macro>  <macro name=\\"contributors-short\\">    <names variable=\\"author\\">      <name and=\\"text\\" delimiter=\\", \\" form=\\"short\\" />      <substitute>        <names variable=\\"editor\\" />        <names variable=\\"translator\\" />      </substitute>    </names>    <text macro=\\"anon\\" />  </macro>  <macro name=\\"interviewer\\">    <names delimiter=\\", \\" variable=\\"interviewer\\">      <label form=\\"verb\\" prefix=\\" \\" suffix=\\" \\" text-case=\\"capitalize-first\\" />      <name and=\\"text\\" delimiter=\\", \\" />    </names>  </macro>  <macro name=\\"archive\\">    <group delimiter=\\". \\">      <text text-case=\\"capitalize-first\\" variable=\\"archive_location\\" />      <text variable=\\"archive\\" />      <text variable=\\"archive-place\\" />    </group>  </macro>  <macro name=\\"access\\">    <group delimiter=\\". \\">      <choose>        <if match=\\"any\\" type=\\"graphic report\\">          <text macro=\\"archive\\" />        </if>        <else-if match=\\"none\\" type=\\"book thesis chapter article-journal article-newspaper article-magazine\\">          <text macro=\\"archive\\" />        </else-if>      </choose>      <text prefix=\\"doi:\\" variable=\\"DOI\\" />      <text variable=\\"URL\\" />    </group>  </macro>  <macro name=\\"title\\">    <!-- BOGUS COMMENT -->  <choose>      <if match=\\"none\\" variable=\\"title\\">        <choose>          <if match=\\"none\\" type=\\"personal_communication\\">            <text text-case=\\"capitalize-first\\" variable=\\"genre\\" />          </if>        </choose>      </if>      <else-if type=\\"book\\">        <text font-style=\\"italic\\" variable=\\"title\\" />      </else-if>      <else>        <text variable=\\"title\\" />      </else>    </choose>  </macro>  <macro name=\\"edition\\">    <choose>      <if match=\\"any\\" type=\\"book chapter\\">        <choose>          <if is-numeric=\\"edition\\">            <group delimiter=\\" \\">              <number form=\\"ordinal\\" variable=\\"edition\\" />              <text form=\\"short\\" suffix=\\".\\" term=\\"edition\\" />            </group>          </if>          <else>            <text suffix=\\".\\" variable=\\"edition\\" />          </else>        </choose>      </if>    </choose>  </macro>  <macro name=\\"locators\\">    <choose>      <if type=\\"article-journal\\">        <text prefix=\\" \\" variable=\\"volume\\" />        <text prefix=\\", no. \\" variable=\\"issue\\" />      </if>      <else-if type=\\"book\\">        <group delimiter=\\". \\" prefix=\\". \\">          <group>            <text form=\\"short\\" suffix=\\". \\" term=\\"volume\\" text-case=\\"capitalize-first\\" />            <number form=\\"numeric\\" variable=\\"volume\\" />          </group>          <group>            <number form=\\"numeric\\" variable=\\"number-of-volumes\\" />            <text form=\\"short\\" plural=\\"true\\" prefix=\\" \\" suffix=\\".\\" term=\\"volume\\" />          </group>        </group>      </else-if>    </choose>  </macro>  <macro name=\\"locators-chapter\\">    <choose>      <if type=\\"chapter\\">        <group prefix=\\", \\">          <text suffix=\\":\\" variable=\\"volume\\" />          <text variable=\\"page\\" />        </group>      </if>    </choose>  </macro>  <macro name=\\"locators-article\\">    <choose>      <if type=\\"article-newspaper\\">        <group delimiter=\\", \\" prefix=\\", \\">          <group>            <text suffix=\\" \\" variable=\\"edition\\" />            <text prefix=\\" \\" term=\\"edition\\" />          </group>          <group>            <text form=\\"short\\" suffix=\\". \\" term=\\"section\\" />            <text variable=\\"section\\" />          </group>        </group>      </if>      <else-if type=\\"article-journal\\">        <text prefix=\\": \\" variable=\\"page\\" />      </else-if>    </choose>  </macro>  <macro name=\\"point-locators\\">    <group>      <choose>        <if locator=\\"page\\" match=\\"none\\">          <label form=\\"short\\" strip-periods=\\"false\\" suffix=\\" \\" variable=\\"locator\\" />        </if>      </choose>      <text variable=\\"locator\\" />    </group>  </macro>  <macro name=\\"container-prefix\\">    <text term=\\"in\\" text-case=\\"capitalize-first\\" />  </macro>  <macro name=\\"container-title\\">    <choose>      <if type=\\"chapter\\">        <text macro=\\"container-prefix\\" suffix=\\" \\" />      </if>    </choose>    <text font-style=\\"italic\\" variable=\\"container-title\\" form=\\"short\\"/>  </macro>  <macro name=\\"publisher\\">    <group delimiter=\\": \\">      <text variable=\\"publisher-place\\" />      <text variable=\\"publisher\\" />    </group>  </macro>  <macro name=\\"date\\">    <date variable=\\"issued\\" form=\\"text\\" date-parts=\\"year\\"><date-part name=\\"year\\"/></date>  </macro>  <macro name=\\"day-month\\">    <date variable=\\"issued\\">      <date-part name=\\"month\\" />      <date-part name=\\"day\\" prefix=\\" \\" />    </date>  </macro>  <macro name=\\"collection-title\\">    <text variable=\\"collection-title\\" />    <text prefix=\\" \\" variable=\\"collection-number\\" />  </macro>  <macro name=\\"event\\">    <group>      <text suffix=\\" \\" term=\\"presented at\\" />      <text variable=\\"event\\" />    </group>  </macro>  <macro name=\\"description\\">    <group delimiter=\\". \\">      <text macro=\\"interviewer\\" />      <text text-case=\\"capitalize-first\\" variable=\\"medium\\" />    </group>    <choose>      <if match=\\"none\\" variable=\\"title\\"> </if>      <else-if type=\\"thesis\\"> </else-if>      <else>        <text prefix=\\". \\" text-case=\\"capitalize-first\\" variable=\\"genre\\" />      </else>    </choose>  </macro>  <macro name=\\"issue\\">    <choose>      <if type=\\"article-journal\\">        <text macro=\\"day-month\\" prefix=\\" (\\" suffix=\\")\\" />      </if>      <else-if type=\\"speech\\">        <group delimiter=\\", \\" prefix=\\" \\">          <text macro=\\"event\\" />          <text macro=\\"day-month\\" />          <text variable=\\"event-place\\" />        </group>      </else-if>      <else-if match=\\"any\\" type=\\"article-newspaper article-magazine\\">        <text macro=\\"day-month\\" prefix=\\", \\" />      </else-if>      <else>        <group delimiter=\\", \\" prefix=\\". \\">          <choose>            <if type=\\"thesis\\">              <text text-case=\\"capitalize-first\\" variable=\\"genre\\" />            </if>          </choose>          <text macro=\\"publisher\\" />          <text macro=\\"day-month\\" />        </group>      </else>    </choose>  </macro>  <citation          disambiguate-add-givenname=\\"true\\"         disambiguate-add-names=\\"true\\"         disambiguate-add-year-suffix=\\"true\\"         et-al-min=\\"4\\"         et-al-subsequent-min=\\"4\\"         et-al-subsequent-use-first=\\"1\\"         et-al-use-first=\\"1\\">    <layout text-decoration=\\"underline\\" delimiter=\\"; \\" prefix=\\"(\\" suffix=\\")\\">      <group delimiter=\\", \\">        <group delimiter=\\" \\">          <text macro=\\"contributors-short\\" />          <text macro=\\"date\\" />        </group>        <text macro=\\"point-locators\\" />      </group>    </layout>  </citation>  <bibliography          entry-spacing=\\"0\\"         et-al-min=\\"11\\"         et-al-use-first=\\"7\\"         hanging-indent=\\"true\\"         subsequent-author-substitute=\\"---\\">    <sort>      <key macro=\\"contributors\\" />      <key macro=\\"date\\" />    </sort>    <layout suffix=\\".\\">      <text macro=\\"contributors\\" suffix=\\". \\" />      <text macro=\\"date\\" suffix=\\". \\" />      <text macro=\\"title\\" />      <text macro=\\"description\\"/>      <text macro=\\"secondary-contributors\\" prefix=\\". \\" />      <text macro=\\"container-title\\" prefix=\\". \\"/>      <text macro=\\"container-contributors\\" />      <text macro=\\"locators-chapter\\" />      <text macro=\\"edition\\" prefix=\\". \\" />      <text macro=\\"locators\\" />      <text macro=\\"collection-title\\" prefix=\\". \\" />      <text macro=\\"issue\\" />      <text macro=\\"locators-article\\" />      <text macro=\\"access\\" prefix=\\". \\" />    </layout>  </bibliography></style>";
\t\t\t
\t\t\tcite_styles['bibtex'] = "<style xmlns=\\"http://purl.org/net/xbiblio/csl\\" class=\\"in-text\\" version=\\"1.0\\" demote-non-dropping-particle=\\"sort-only\\">   <info>      <title>BibTex generic citation style</title>      <id>http://www.zotero.org/styles/bibtex</id>      <link href=\\"http://www.zotero.org/styles/bibtex\\" rel=\\"self\\"/>      <link href=\\"http://www.bibtex.org/\\" rel=\\"documentation\\"/>      <author>         <name>Markus Schaffner</name>      </author>      <contributor>         <name>Richard Karnesky</name>         <email>karnesky+zotero@gmail.com</email>         <uri>http://arc.nucapt.northwestern.edu/Richard_Karnesky</uri>      </contributor>      <category field=\\"generic-base\\"/>      <updated>2008-10-05T10:04:29-07:00</updated>      <rights>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License: http://creativecommons.org/licenses/by-sa/3.0/</rights>   </info>   <macro name=\\"zotero2bibtexType\\">      <choose>         <if type=\\"bill book graphic legal_case motion_picture report song\\" match=\\"any\\">            <text value=\\"book\\"/>         </if>         <else-if type=\\"chapter paper-conference\\" match=\\"any\\">            <text value=\\"inbook\\"/>         </else-if>         <else-if type=\\"article article-journal article-magazine article-newspaper\\" match=\\"any\\">            <text value=\\"article\\"/>         </else-if>         <else-if type=\\"thesis\\" match=\\"any\\">            <text value=\\"phdthesis\\"/>         </else-if>         <else-if type=\\"manuscript\\" match=\\"any\\">            <text value=\\"unpublished\\"/>         </else-if>         <else-if type=\\"paper-conference\\" match=\\"any\\">            <text value=\\"inproceedings\\"/>         </else-if>         <else-if type=\\"report\\" match=\\"any\\">            <text value=\\"techreport\\"/>         </else-if>         <else>            <text value=\\"misc\\"/>         </else>      </choose>   </macro>   <macro name=\\"citeKey\\">      <group delimiter=\\"_\\">         <text macro=\\"author-short\\" text-case=\\"lowercase\\"/>         <text macro=\\"issued-year\\"/>      </group>   </macro>   <macro name=\\"author-short\\">      <names variable=\\"author\\">         <name form=\\"short\\" delimiter=\\"_\\" delimiter-precedes-last=\\"always\\"/>         <substitute>            <names variable=\\"editor\\"/>            <names variable=\\"translator\\"/>            <choose>               <if type=\\"bill book graphic legal_case motion_picture report song\\" match=\\"any\\">                  <text variable=\\"title\\" form=\\"short\\"/>               </if>               <else>                  <text variable=\\"title\\" form=\\"short\\"/>               </else>            </choose>         </substitute>      </names>   </macro>   <macro name=\\"issued-year\\">      <date variable=\\"issued\\">         <date-part name=\\"year\\"/>      </date>   </macro>   <macro name=\\"issued-month\\">      <date variable=\\"issued\\">         <date-part name=\\"month\\" form=\\"short\\" strip-periods=\\"true\\"/>      </date>   </macro>   <macro name=\\"author\\">      <names variable=\\"author\\">         <name sort-separator=\\", \\" delimiter=\\" and \\" delimiter-precedes-last=\\"always\\" name-as-sort-order=\\"all\\"/>         <label form=\\"long\\" text-case=\\"capitalize-first\\"/>      </names>   </macro>   <macro name=\\"editor-translator\\">      <names variable=\\"editor translator\\" delimiter=\\", \\">         <name sort-separator=\\", \\" delimiter=\\" and \\" delimiter-precedes-last=\\"always\\" name-as-sort-order=\\"all\\"/>         <label form=\\"long\\" text-case=\\"capitalize-first\\"/>      </names>   </macro>   <macro name=\\"title\\">      <text variable=\\"title\\"/>   </macro>   <macro name=\\"number\\">      <text variable=\\"issue\\"/>      <text variable=\\"number\\"/>   </macro>   <macro name=\\"container-title\\">      <choose>         <if type=\\"chapter paper-conference\\" match=\\"any\\">            <text variable=\\"container-title\\" prefix=\\" booktitle={\\" suffix=\\"}\\"/>         </if>         <else>            <text variable=\\"container-title\\" prefix=\\" journal={\\" suffix=\\"}\\"/>         </else>      </choose>   </macro>   <macro name=\\"publisher\\">      <choose>         <if type=\\"thesis\\">            <text variable=\\"publisher\\" prefix=\\" school={\\" suffix=\\"}\\"/>         </if>         <else-if type=\\"report\\">            <text variable=\\"publisher\\" prefix=\\" institution={\\" suffix=\\"}\\"/>         </else-if>         <else>            <text variable=\\"publisher\\" prefix=\\" publisher={\\" suffix=\\"}\\"/>         </else>      </choose>   </macro>   <macro name=\\"pages\\">      <text variable=\\"page\\"/>   </macro>   <macro name=\\"edition\\">      <text variable=\\"edition\\"/>   </macro>   <citation et-al-min=\\"10\\" et-al-use-first=\\"10\\" et-al-subsequent-min=\\"10\\" et-al-subsequent-use-first=\\"10\\" disambiguate-add-year-suffix=\\"true\\" disambiguate-add-names=\\"false\\" disambiguate-add-givenname=\\"false\\" collapse=\\"year\\">      <sort>         <key macro=\\"author\\"/>         <key variable=\\"issued\\"/>      </sort>      <layout delimiter=\\"_\\">         <text macro=\\"citeKey\\"/>      </layout>   </citation>   <bibliography hanging-indent=\\"false\\" et-al-min=\\"10\\" et-al-use-first=\\"10\\">      <sort>         <key macro=\\"author\\"/>         <key variable=\\"issued\\"/>      </sort>      <layout>         <text macro=\\"zotero2bibtexType\\" prefix=\\" @\\" suffix=\\"\\"/>         <group prefix=\\"{\\" suffix=\\"}\\" delimiter=\\", \\">            <text macro=\\"citeKey\\"/>            <text variable=\\"publisher-place\\" prefix=\\" place={\\" suffix=\\"}\\"/><!--Fix This-->            <text variable=\\"chapter-number\\" prefix=\\" chapter={\\" suffix=\\"}\\"/><!--Fix This-->            <text macro=\\"edition\\" prefix=\\" edition={\\" suffix=\\"}\\"/><!--Is this in CSL? <text variable=\\"type\\" prefix=\\" type={\\" suffix=\\"}\\" />-->            <text variable=\\"collection-title\\" prefix=\\" series={\\" suffix=\\"}\\"/>            <text macro=\\"title\\" prefix=\\" title={\\" suffix=\\"}\\"/>            <text variable=\\"volume\\" prefix=\\" volume={\\" suffix=\\"}\\"/><!--Not in CSL<text variable=\\"rights\\" prefix=\\" rights={\\" suffix=\\"}\\" />-->            <text variable=\\"ISBN\\" prefix=\\" ISBN={\\" suffix=\\"}\\"/><!--Not in CSL <text variable=\\"ISSN\\" prefix=\\" ISSN={\\" suffix=\\"}\\" />--><!--Not in CSL <text variable=\\"LCCN\\" prefix=\\" callNumber={\\" suffix=\\"}\\" />-->            <text variable=\\"archive_location\\" prefix=\\" archiveLocation={\\" suffix=\\"}\\"/>            <text variable=\\"URL\\" prefix=\\" url={\\" suffix=\\"}\\"/>            <text variable=\\"DOI\\" prefix=\\" DOI={\\" suffix=\\"}\\"/>            <text variable=\\"abstract\\" prefix=\\" abstractNote={\\" suffix=\\"}\\"/>            <text variable=\\"note\\" prefix=\\" note={\\" suffix=\\"}\\"/>            <text macro=\\"number\\" prefix=\\" number={\\" suffix=\\"}\\"/>            <text macro=\\"container-title\\"/>            <text macro=\\"publisher\\"/>            <text macro=\\"author\\" prefix=\\" author={\\" suffix=\\"}\\"/>            <text macro=\\"editor-translator\\" prefix=\\" editor={\\" suffix=\\"}\\"/>            <text macro=\\"issued-year\\" prefix=\\" year={\\" suffix=\\"}\\"/>            <text macro=\\"issued-month\\" prefix=\\" month={\\" suffix=\\"}\\"/>            <text macro=\\"pages\\" prefix=\\" pages={\\" suffix=\\"}\\"/>            <text variable=\\"collection-title\\" prefix=\\" collection={\\" suffix=\\"}\\"/>         </group>      </layout>   </bibliography></style>";
\t\t\t
\t\t\tcite_styles['zookeys'] = "<style class=\\"in-text\\" version=\\"1.0\\" demote-non-dropping-particle=\\"never\\">\t<info>\t\t<title>\t\t\tZooKeys\t\t</title>\t\t<id>\t\t\tzookeys\t\t</id>\t\t<link href=\\"http://www.zotero.org/styles/apa\\" rel=\\"self\\">\t\t</link>\t\t<link href=\\"http://www.pensoft.net/journals/zookeys/about/Author%20Guidelines\\" rel=\\"documentation\\">\t\t</link>\t\t<author>\t\t\t<name>\t\t\t\tRoderic D. M. Page\t\t\t</name>\t\t\t<email>\t\t\t\trdmpage@gmail.com\t\t\t</email>\t\t\t<uri>\t\t\t\thttp://iphylo.blogspot.com\t\t\t</uri>\t\t</author>\t\t<category field=\\"biology\\">\t\t</category>\t\t<category field=\\"generic-base\\">\t\t</category>\t\t<category citation-format=\\"author-date\\">\t\t</category>\t\t<!--\t\t<updated>\t\t\t2010-01-27T20:08:03+00:00\t\t</updated>\t\t-->\t\t<rights>\t\t\tThis work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License: http://creativecommons.org/licenses/by-sa/3.0/\t\t</rights>\t\t<issn>1313-2989</issn>\t</info>\t<locale lang=\\"en\\">\t\t<terms>\t\t\t<term name=\\"translator\\" form=\\"short\\">\t\t\t\t<single>\t\t\t\t\ttrans.\t\t\t\t</single>\t\t\t\t<multiple>\t\t\t\t\ttrans.\t\t\t\t</multiple>\t\t\t</term>\t\t</terms>\t</locale>\t<macro name=\\"container-contributors\\">\t\t<choose>\t\t\t<if type=\\"chapter paper-conference\\" match=\\"any\\">\t\t\t\t<text term=\\"in\\" text-case=\\"capitalize-first\\" suffix=\\": \\">\t\t\t\t</text>\t\t\t\t<names variable=\\"editor\\" delimiter=\\", \\" suffix=\\" \\">\t\t\t\t\t<name delimiter=\\", \\" and=\\"\\" initialize-with=\\"\\" sort-separator=\\" \\" name-as-sort-order=\\"all\\" >\t\t\t\t\t</name>\t\t\t\t\t<!-- strip-periods=\\"true\\" removes the '.' after Ed/Eds -->\t\t\t\t\t<label form=\\"short\\" strip-periods=\\"true\\" text-case=\\"capitalize-first\\" prefix=\\" (\\" suffix=\\")\\">\t\t\t\t\t</label>\t\t\t\t\t<substitute>\t\t\t\t\t\t<names variable=\\"translator\\">\t\t\t\t\t\t</names>\t\t\t\t\t</substitute>\t\t\t\t</names>\t\t\t</if>\t\t</choose>\t</macro>\t<macro name=\\"secondary-contributors\\">\t\t<choose>\t\t\t<if type=\\"chapter paper-conference\\" match=\\"none\\">\t\t\t\t<names variable=\\"translator\\" delimiter=\\", \\" prefix=\\" (\\" suffix=\\")\\">\t\t\t\t\t<name and=\\"symbol\\" initialize-with=\\". \\" delimiter=\\", \\">\t\t\t\t\t</name>\t\t\t\t\t<label form=\\"short\\" prefix=\\", \\" text-case=\\"capitalize-first\\">\t\t\t\t\t</label>\t\t\t\t\t<substitute>\t\t\t\t\t\t<names variable=\\"editor\\">\t\t\t\t\t\t</names>\t\t\t\t\t</substitute>\t\t\t\t</names>\t\t\t</if>\t\t</choose>\t</macro>\t<macro name=\\"author\\">\t\t<names variable=\\"author\\">\t\t\t<name delimiter=\\", \\" delimiter-precedes-last=\\"always\\" initialize-with=\\"\\" sort-separator=\\" \\" name-as-sort-order=\\"all\\" >\t\t\t</name>\t\t\t<label form=\\"short\\" strip-periods=\\"true\\" text-case=\\"capitalize-first\\" prefix=\\" (\\" suffix=\\".)\\">\t\t\t</label>\t\t\t<substitute>\t\t\t\t<names variable=\\"editor\\">\t\t\t\t</names>\t\t\t\t<names variable=\\"translator\\">\t\t\t\t</names>\t\t\t\t<choose>\t\t\t\t\t<if type=\\"report\\">\t\t\t\t\t\t<text variable=\\"publisher\\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<text macro=\\"title\\">\t\t\t\t\t\t</text>\t\t\t\t\t</if>\t\t\t\t\t<else>\t\t\t\t\t\t<text macro=\\"title\\">\t\t\t\t\t\t</text>\t\t\t\t\t</else>\t\t\t\t</choose>\t\t\t</substitute>\t\t</names>\t</macro>\t<macro name=\\"author-short\\">\t\t<names variable=\\"author\\">\t\t\t<name form=\\"short\\" and=\\"text\\" delimiter=\\", \\" initialize-with=\\". \\">\t\t\t</name>\t\t\t<substitute>\t\t\t\t<names variable=\\"editor\\">\t\t\t\t</names>\t\t\t\t<names variable=\\"translator\\">\t\t\t\t</names>\t\t\t\t<choose>\t\t\t\t\t<if type=\\"report\\">\t\t\t\t\t\t<text variable=\\"publisher\\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<text variable=\\"title\\" form=\\"short\\" font-style=\\"italic\\">\t\t\t\t\t\t</text>\t\t\t\t\t</if>\t\t\t\t\t<else-if type=\\"bill book graphic legal_case motion_picture song\\" match=\\"any\\">\t\t\t\t\t\t<text variable=\\"title\\" form=\\"short\\" font-style=\\"italic\\">\t\t\t\t\t\t</text>\t\t\t\t\t</else-if>\t\t\t\t\t<else>\t\t\t\t\t\t<text variable=\\"title\\" form=\\"short\\" quotes=\\"false\\">\t\t\t\t\t\t</text>\t\t\t\t\t</else>\t\t\t\t</choose>\t\t\t</substitute>\t\t</names>\t</macro>\t<macro name=\\"access\\">\t\t<choose>\t\t\t<if type=\\"thesis\\">\t\t\t\t<choose>\t\t\t\t\t<if variable=\\"archive\\" match=\\"any\\">\t\t\t\t\t\t<group>\t\t\t\t\t\t\t<text term=\\"retrieved\\" text-case=\\"capitalize-first\\" suffix=\\" \\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text term=\\"from\\" suffix=\\" \\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text variable=\\"archive\\" suffix=\\".\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text variable=\\"archive_location\\" prefix=\\" (\\" suffix=\\")\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t</group>\t\t\t\t\t</if>\t\t\t\t\t<else>\t\t\t\t\t\t<group>\t\t\t\t\t\t\t<text term=\\"retrieved\\" text-case=\\"capitalize-first\\" suffix=\\" \\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text term=\\"from\\" suffix=\\" \\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text variable=\\"URL\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t</group>\t\t\t\t\t</else>\t\t\t\t</choose>\t\t\t</if>\t\t\t<else>\t\t\t\t<choose>\t\t\t\t\t<if variable=\\"DOI\\">\t\t\t\t\t\t<text variable=\\"DOI\\" prefix=\\"doi: \\" suffix=\\".\\">\t\t\t\t\t\t</text>\t\t\t\t\t</if>\t\t\t\t\t<else>\t\t\t\t\t\t<choose>\t\t\t\t\t\t\t<if type=\\"webpage\\">\t\t\t\t\t\t\t\t<group delimiter=\\" \\">\t\t\t\t\t\t\t\t\t<!--\t\t\t\t\t\t\t\t\t<text term=\\"retrieved\\" text-case=\\"capitalize-first\\" suffix=\\" \\">\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t\t<group>\t\t\t\t\t\t\t\t\t\t<date variable=\\"accessed\\" suffix=\\", \\">\t\t\t\t\t\t\t\t\t\t\t<date-part name=\\"month\\" suffix=\\" \\">\t\t\t\t\t\t\t\t\t\t\t</date-part>\t\t\t\t\t\t\t\t\t\t\t<date-part name=\\"day\\" suffix=\\", \\">\t\t\t\t\t\t\t\t\t\t\t</date-part>\t\t\t\t\t\t\t\t\t\t\t<date-part name=\\"year\\">\t\t\t\t\t\t\t\t\t\t\t</date-part>\t\t\t\t\t\t\t\t\t\t</date>\t\t\t\t\t\t\t\t\t</group>\t\t\t\t\t\t\t\t\t<text term=\\"from\\">\t\t\t\t\t\t\t\t\t</text> -->\t\t\t\t\t\t\t\t\t<text variable=\\"URL\\">\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t</group>\t\t\t\t\t\t\t</if>\t\t\t\t\t\t\t<else>\t\t\t\t\t\t\t\t<group>\t\t\t\t\t\t\t\t\t<text term=\\"retrieved\\" text-case=\\"capitalize-first\\" suffix=\\" \\">\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t\t<text term=\\"from\\" suffix=\\" \\">\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t\t<text variable=\\"URL\\">\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t</group>\t\t\t\t\t\t\t</else>\t\t\t\t\t\t</choose>\t\t\t\t\t</else>\t\t\t\t</choose>\t\t\t</else>\t\t</choose>\t</macro>\t<macro name=\\"title\\">\t\t<choose>\t\t\t<if type=\\"report thesis\\" match=\\"any\\">\t\t\t\t<text variable=\\"title\\">\t\t\t\t</text>\t\t\t\t<group prefix=\\" (\\" suffix=\\")\\">\t\t\t\t\t<text variable=\\"genre\\">\t\t\t\t\t</text>\t\t\t\t\t<text variable=\\"number\\" prefix=\\" No. \\">\t\t\t\t\t</text>\t\t\t\t</group>\t\t\t</if>\t\t\t<else-if type=\\"book graphic  motion_picture report song manuscript speech\\" match=\\"any\\">\t\t\t\t<text variable=\\"title\\" >\t\t\t\t</text>\t\t\t</else-if>\t\t\t<else>\t\t\t\t<text variable=\\"title\\">\t\t\t\t</text>\t\t\t</else>\t\t</choose>\t</macro>\t<macro name=\\"publisher\\">\t\t<choose>\t\t\t<if type=\\"report\\" match=\\"any\\">\t\t\t\t<group delimiter=\\", \\">\t\t\t\t\t<text variable=\\"publisher\\">\t\t\t\t\t</text>\t\t\t\t\t<text variable=\\"publisher-place\\">\t\t\t\t\t</text>\t\t\t\t</group>\t\t\t</if>\t\t\t<else-if type=\\"thesis\\" match=\\"any\\">\t\t\t\t<group delimiter=\\", \\">\t\t\t\t\t<text variable=\\"publisher\\">\t\t\t\t\t</text>\t\t\t\t\t<text variable=\\"publisher-place\\">\t\t\t\t\t</text>\t\t\t\t</group>\t\t\t</else-if>\t\t\t<else>\t\t\t\t<group delimiter=\\", \\">\t\t\t\t\t<choose>\t\t\t\t\t\t<if variable=\\"event\\" match=\\"none\\">\t\t\t\t\t\t\t<text variable=\\"genre\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t</if>\t\t\t\t\t</choose>\t\t\t\t\t<group delimiter=\\", \\">\t\t\t\t\t\t<text variable=\\"publisher\\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<text variable=\\"publisher-place\\">\t\t\t\t\t\t</text>\t\t\t\t\t</group>\t\t\t\t</group>\t\t\t</else>\t\t</choose>\t</macro>\t<macro name=\\"event\\">\t\t<choose>\t\t\t<if variable=\\"event\\">\t\t\t\t<choose>\t\t\t\t\t<if variable=\\"genre\\" match=\\"none\\">\t\t\t\t\t\t<text term=\\"presented at\\" text-case=\\"capitalize-first\\" suffix=\\" \\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<text variable=\\"event\\">\t\t\t\t\t\t</text>\t\t\t\t\t</if>\t\t\t\t\t<else>\t\t\t\t\t\t<group delimiter=\\" \\">\t\t\t\t\t\t\t<text variable=\\"genre\\" text-case=\\"capitalize-first\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text term=\\"presented at\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text variable=\\"event\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t</group>\t\t\t\t\t</else>\t\t\t\t</choose>\t\t\t</if>\t\t</choose>\t</macro>\t<macro name=\\"issued\\">\t\t<choose>\t\t\t<if type=\\"legal_case bill\\" match=\\"none\\">\t\t\t\t<choose>\t\t\t\t\t<if variable=\\"issued\\">\t\t\t\t\t\t<group prefix=\\" (\\" suffix=\\")\\">\t\t\t\t\t\t\t<date variable=\\"issued\\">\t\t\t\t\t\t\t\t<date-part name=\\"year\\">\t\t\t\t\t\t\t\t</date-part>\t\t\t\t\t\t\t</date>\t\t\t\t\t\t\t<text variable=\\"year-suffix\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<choose>\t\t\t\t\t\t\t\t<if type=\\"bill book graphic legal_case motion_picture report song article-journal chapter paper-conference\\" match=\\"none\\">\t\t\t\t\t\t\t\t\t<date variable=\\"issued\\">\t\t\t\t\t\t\t\t\t\t<date-part prefix=\\", \\" name=\\"month\\">\t\t\t\t\t\t\t\t\t\t</date-part>\t\t\t\t\t\t\t\t\t\t<date-part prefix=\\" \\" name=\\"day\\">\t\t\t\t\t\t\t\t\t\t</date-part>\t\t\t\t\t\t\t\t\t</date>\t\t\t\t\t\t\t\t</if>\t\t\t\t\t\t\t</choose>\t\t\t\t\t\t</group>\t\t\t\t\t</if>\t\t\t\t\t<else>\t\t\t\t\t\t<if type=\\"webpage\\">\t\t\t\t\t\t</if>\t\t\t\t\t\t<else>\t\t\t\t\t\t\t\t\t\t\t\t<group prefix=\\" (\\" suffix=\\").\\">\t\t\t\t\t\t\t\t<text term=\\"no date\\" form=\\"short\\">\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t<text variable=\\"year-suffix\\" prefix=\\"-\\">\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t</group>\t\t\t\t\t\t</else>\t\t\t\t\t</else>\t\t\t\t</choose>\t\t\t</if>\t\t</choose>\t</macro>\t<macro name=\\"issued-sort\\">\t\t<choose>\t\t\t<if type=\\"bill book graphic legal_case motion_picture report song article-journal chapter paper-conference\\" match=\\"none\\">\t\t\t\t<date variable=\\"issued\\">\t\t\t\t\t<date-part name=\\"year\\">\t\t\t\t\t</date-part>\t\t\t\t\t<date-part prefix=\\", \\" name=\\"month\\">\t\t\t\t\t</date-part>\t\t\t\t\t<date-part prefix=\\" \\" name=\\"day\\">\t\t\t\t\t</date-part>\t\t\t\t</date>\t\t\t</if>\t\t\t<else>\t\t\t\t<date variable=\\"issued\\">\t\t\t\t\t<date-part name=\\"year\\">\t\t\t\t\t</date-part>\t\t\t\t</date>\t\t\t</else>\t\t</choose>\t</macro>\t<macro name=\\"issued-year\\">\t\t<choose>\t\t\t<if variable=\\"issued\\">\t\t\t\t<date variable=\\"issued\\">\t\t\t\t\t<date-part name=\\"year\\">\t\t\t\t\t</date-part>\t\t\t\t</date>\t\t\t\t<text variable=\\"year-suffix\\">\t\t\t\t</text>\t\t\t</if>\t\t\t<else>\t\t\t\t\t\t<if type=\\"webpage\\">\t\t\t\t\t\t</if>\t\t\t\t\t\t<else>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<text term=\\"no date\\" form=\\"short\\">\t\t\t\t</text>\t\t\t\t<text variable=\\"year-suffix\\" prefix=\\"-\\">\t\t\t\t</text>\t\t\t\t\t\t\t\t\t</else>\t\t\t</else>\t\t</choose>\t</macro>\t<macro name=\\"edition\\">\t\t<choose>\t\t\t<if is-numeric=\\"edition\\">\t\t\t\t<group delimiter=\\" \\">\t\t\t\t\t<number variable=\\"edition\\" form=\\"ordinal\\">\t\t\t\t\t</number>\t\t\t\t\t<text term=\\"edition\\" form=\\"short\\" suffix=\\".\\" strip-periods=\\"true\\">\t\t\t\t\t</text>\t\t\t\t</group>\t\t\t</if>\t\t\t<else>\t\t\t\t<text variable=\\"edition\\" suffix=\\".\\">\t\t\t\t</text>\t\t\t</else>\t\t</choose>\t</macro>\t<macro name=\\"locators\\">\t\t<choose>\t\t\t<if type=\\"article-journal article-magazine\\" match=\\"any\\">\t\t\t\t<group delimiter=\\" \\" prefix=\\" \\">\t\t\t\t\t<group suffix=\\":\\">\t\t\t\t\t\t<text variable=\\"volume\\" font-style=\\"normal\\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<text variable=\\"issue\\" prefix=\\"(\\" suffix=\\")\\">\t\t\t\t\t\t</text>\t\t\t\t\t</group>\t\t\t\t\t<text variable=\\"page\\">\t\t\t\t\t</text>\t\t\t\t</group>\t\t\t</if>\t\t\t<else-if type=\\"article-newspaper\\">\t\t\t\t<group delimiter=\\" \\" prefix=\\", \\">\t\t\t\t\t<label variable=\\"page\\" form=\\"short\\">\t\t\t\t\t</label>\t\t\t\t\t<text variable=\\"page\\">\t\t\t\t\t</text>\t\t\t\t</group>\t\t\t</else-if>\t\t\t<else-if type=\\"book graphic motion_picture report song chapter paper-conference\\" match=\\"any\\">\t\t\t\t<group prefix=\\"\\" suffix=\\" pp\\" delimiter=\\".\\">\t\t\t\t\t<text macro=\\"edition\\">\t\t\t\t\t</text>\t\t\t\t\t<group>\t\t\t\t\t\t<text term=\\"volume\\" form=\\"short\\" plural=\\"true\\" text-case=\\"capitalize-first\\" suffix=\\". \\" strip-periods=\\"true\\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<number variable=\\"number-of-volumes\\" form=\\"numeric\\" prefix=\\"1-\\">\t\t\t\t\t\t</number>\t\t\t\t\t</group>\t\t\t\t\t<group>\t\t\t\t\t\t<text term=\\"volume\\" form=\\"short\\" text-case=\\"capitalize-first\\" suffix=\\". \\" strip-periods=\\"true\\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<number variable=\\"volume\\" form=\\"numeric\\">\t\t\t\t\t\t</number>\t\t\t\t\t</group>\t\t\t\t\t<group>\t\t\t\t\t\t<!--<label variable=\\"page\\" form=\\"short\\" suffix=\\" \\">\t\t\t\t\t\t</label>-->\t\t\t\t\t\t<text variable=\\"page\\">\t\t\t\t\t\t</text>\t\t\t\t\t</group>\t\t\t\t</group>\t\t\t</else-if>\t\t\t<else-if type=\\"legal_case\\">\t\t\t\t<group prefix=\\" (\\" suffix=\\")\\" delimiter=\\" \\">\t\t\t\t\t<text variable=\\"authority\\">\t\t\t\t\t</text>\t\t\t\t\t<date variable=\\"issued\\" delimiter=\\" \\">\t\t\t\t\t\t<date-part name=\\"month\\" form=\\"short\\">\t\t\t\t\t\t</date-part>\t\t\t\t\t\t<date-part name=\\"day\\" suffix=\\",\\">\t\t\t\t\t\t</date-part>\t\t\t\t\t\t<date-part name=\\"year\\">\t\t\t\t\t\t</date-part>\t\t\t\t\t</date>\t\t\t\t</group>\t\t\t</else-if>\t\t\t<else-if type=\\"bill\\">\t\t\t\t<date variable=\\"issued\\" prefix=\\" (\\" suffix=\\")\\">\t\t\t\t\t<date-part name=\\"year\\">\t\t\t\t\t</date-part>\t\t\t\t</date>\t\t\t</else-if>\t\t</choose>\t</macro>\t<macro name=\\"citation-locator\\">\t\t<group>\t\t\t<label variable=\\"locator\\" form=\\"short\\">\t\t\t</label>\t\t\t<text variable=\\"locator\\" prefix=\\" \\">\t\t\t</text>\t\t</group>\t</macro>\t<macro name=\\"container\\">\t\t<choose>\t\t\t<if type=\\"legal_case bill\\" match=\\"none\\">\t\t\t\t<text variable=\\"container-title\\" font-style=\\"normal\\">\t\t\t\t</text>\t\t\t</if>\t\t\t<else>\t\t\t\t<group delimiter=\\" \\" prefix=\\", \\">\t\t\t\t\t<choose>\t\t\t\t\t\t<if variable=\\"container-title\\">\t\t\t\t\t\t\t<text variable=\\"volume\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text variable=\\"container-title\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<group delimiter=\\" \\">\t\t\t\t\t\t\t\t<text term=\\"section\\" form=\\"symbol\\">\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t<text variable=\\"section\\">\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t</group>\t\t\t\t\t\t\t<text variable=\\"page\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t</if>\t\t\t\t\t\t<else>\t\t\t\t\t\t\t<choose>\t\t\t\t\t\t\t\t<if type=\\"legal_case\\">\t\t\t\t\t\t\t\t\t<text variable=\\"number\\" prefix=\\"No. \\">\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t</if>\t\t\t\t\t\t\t\t<else>\t\t\t\t\t\t\t\t\t<text variable=\\"number\\" prefix=\\"Pub. L. No. \\">\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t\t<group delimiter=\\" \\">\t\t\t\t\t\t\t\t\t\t<text term=\\"section\\" form=\\"symbol\\">\t\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t\t\t<text variable=\\"section\\">\t\t\t\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t\t\t</group>\t\t\t\t\t\t\t\t</else>\t\t\t\t\t\t\t</choose>\t\t\t\t\t\t</else>\t\t\t\t\t</choose>\t\t\t\t</group>\t\t\t</else>\t\t</choose>\t</macro>\t<citation et-al-min=\\"6\\" et-al-use-first=\\"1\\" et-al-subsequent-min=\\"3\\" et-al-subsequent-use-first=\\"1\\" disambiguate-add-year-suffix=\\"true\\" disambiguate-add-names=\\"true\\" disambiguate-add-givenname=\\"true\\" collapse=\\"year\\" givenname-disambiguation-rule=\\"primary-name\\">\t\t<sort>\t\t\t<key macro=\\"author\\">\t\t\t</key>\t\t\t<key macro=\\"issued-sort\\">\t\t\t</key>\t\t</sort>\t\t<layout prefix=\\"(\\" suffix=\\")\\" delimiter=\\"; \\">\t\t\t<group delimiter=\\" \\">\t\t\t\t<text macro=\\"author-short\\">\t\t\t\t</text>\t\t\t\t<text macro=\\"issued-year\\">\t\t\t\t</text>\t\t\t\t<text macro=\\"citation-locator\\">\t\t\t\t</text>\t\t\t</group>\t\t</layout>\t</citation>\t<bibliography hanging-indent=\\"true\\" et-al-min=\\"8\\" et-al-use-first=\\"7\\" entry-spacing=\\"0\\" line-spacing=\\"2\\">\t\t<sort>\t\t\t<key macro=\\"author\\">\t\t\t</key>\t\t\t<key macro=\\"issued-sort\\" sort=\\"ascending\\">\t\t\t</key>\t\t</sort>\t\t<layout>\t\t\t<group suffix=\\".\\">\t\t\t\t<group delimiter=\\" \\">\t\t\t\t\t<text macro=\\"author\\">\t\t\t\t\t</text>\t\t\t\t\t<text macro=\\"issued\\">\t\t\t\t\t</text>\t\t\t\t</group>\t\t\t\t<group delimiter=\\". \\">\t\t\t\t\t<text macro=\\"title\\" prefix=\\" \\">\t\t\t\t\t</text>\t\t\t\t\t<group>\t\t\t\t\t\t<text macro=\\"container-contributors\\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<text macro=\\"secondary-contributors\\">\t\t\t\t\t\t</text>\t\t\t\t\t\t<group delimiter=\\", \\">\t\t\t\t\t\t\t<text macro=\\"container\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t\t<text variable=\\"collection-title\\">\t\t\t\t\t\t\t</text>\t\t\t\t\t\t</group>\t\t\t\t\t</group>\t\t\t\t</group>\t\t\t\t\t\t\t\t<!-- publisher, place -->\t\t\t\t<group delimiter=\\", \\" prefix=\\". \\" suffix=\\", \\">\t\t\t\t\t<text macro=\\"event\\">\t\t\t\t\t</text>\t\t\t\t\t<text macro=\\"publisher\\">\t\t\t\t\t</text>\t\t\t\t</group>\t\t\t\t\t\t\t\t<!-- volume, issue, pagination, DOI -->\t\t\t\t<text macro=\\"locators\\">\t\t\t\t</text>\t\t\t\t\t\t\t</group>\t\t\t<text macro=\\"access\\" prefix=\\" \\">\t\t\t</text>\t\t</layout>\t</bibliography></style>";
\t\t\t
\t\t\tcite_styles['zootaxa'] = "<style xmlns=\\"http://purl.org/net/xbiblio/csl\\" class=\\"in-text\\" version=\\"1.0\\" demote-non-dropping-particle=\\"sort-only\\" default-locale=\\"en-US\\">  <info>    <title>Zootaxa</title>    <id>http://www.zotero.org/styles/zootaxa</id>    <link href=\\"http://www.zotero.org/styles/zootaxa\\" rel=\\"self\\"/>    <link href=\\"http://www.mapress.com/zootaxa/support/author.html#Preparation%20of%20manuscripts\\" rel=\\"documentation\\"/>    <link href=\\"http://www.zotero.org/styles/apsa\\" rel=\\"template\\"/>    <author>      <name>Bastian Drolshagen</name>      <email>bdrolshagen@gmail.com</email>    </author>    <category citation-format=\\"author-date\\"/>    <category field=\\"biology\\"/>    <issn>1175-5326</issn>    <eissn>1175-5334</eissn>    <updated>2012-11-18T18:42:51+00:00</updated>    <summary>The Zootaxa style.</summary>    <rights license=\\"http://creativecommons.org/licenses/by-sa/3.0/\\">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>  </info>  <locale xml:lang=\\"en-US\\">    <date form=\\"text\\">      <date-part name=\\"month\\" suffix=\\" \\"/>      <date-part name=\\"day\\" suffix=\\", \\"/>      <date-part name=\\"year\\"/>    </date>  </locale>  <macro name=\\"editor\\">    <names variable=\\"editor\\" delimiter=\\", \\">      <name and=\\"text\\" initialize-with=\\". \\" delimiter=\\", \\"/>      <label form=\\"short\\" prefix=\\" (\\" text-case=\\"capitalize-first\\" suffix=\\")\\" strip-periods=\\"true\\"/>    </names>  </macro>  <macro name=\\"anon\\">    <text term=\\"anonymous\\" form=\\"short\\" text-case=\\"capitalize-first\\" strip-periods=\\"true\\"/>  </macro>  <macro name=\\"author\\">    <names variable=\\"author\\">\t\t<name name-as-sort-order=\\"all\\" and=\\"text\\" sort-separator=\\", \\" initialize-with=\\".\\" delimiter-precedes-last=\\"never\\" delimiter=\\", \\"/>\t  <et-al font-style=\\"italic\\" prefix=\\" \\"/>      <label form=\\"short\\" prefix=\\" \\" suffix=\\".\\" text-case=\\"lowercase\\" strip-periods=\\"true\\"/>      <substitute>        <names variable=\\"editor\\"/>        <text macro=\\"anon\\"/>      </substitute>    </names>  </macro>  <macro name=\\"author-short\\">    <names variable=\\"author\\">\t\t<name form=\\"short\\" and=\\"symbol\\" delimiter=\\", \\" delimiter-precedes-last=\\"never\\" initialize-with=\\". \\"/>\t\t<et-al font-style=\\"italic\\" prefix=\\" \\"/>      <substitute>        <names variable=\\"editor\\"/>        <names variable=\\"translator\\"/>        <text macro=\\"anon\\"/>      </substitute>    </names>  </macro>  <macro name=\\"access\\">    <choose>      <if type=\\"legal_case\\" match=\\"none\\">        <choose>          <if variable=\\"URL\\">            <group delimiter=\\" \\">              <text variable=\\"URL\\" prefix=\\"Available from: \\"/>              <group prefix=\\"(\\" suffix=\\")\\">                <date variable=\\"accessed\\" form=\\"text\\"/>              </group>            </group>          </if>        </choose>      </if>    </choose>  </macro>  <macro name=\\"title\\">    <choose>      <if type=\\"bill book graphic legal_case legislation motion_picture report song\\" match=\\"any\\">        <text variable=\\"title\\" font-style=\\"italic\\"/>      </if>      <else>        <text variable=\\"title\\" quotes=\\"false\\"/>      </else>    </choose>  </macro>  <macro name=\\"legal_case\\">    <group prefix=\\" \\" delimiter=\\" \\">      <text variable=\\"volume\\"/>      <text variable=\\"container-title\\"/>    </group>    <text variable=\\"authority\\" prefix=\\" (\\" suffix=\\")\\"/>  </macro>  <macro name=\\"publisher\\">    <choose>      <if type=\\"thesis\\" match=\\"none\\">        <group prefix=\\"\\" suffix=\\"\\" delimiter=\\", \\">          <text variable=\\"publisher\\" suffix=\\"\\"/>          <text variable=\\"publisher-place\\"/>        </group>        <text variable=\\"genre\\" prefix=\\". \\"/>      </if>      <else>        <group delimiter=\\". \\">          <text variable=\\"genre\\"/>          <text variable=\\"publisher\\"/>        </group>      </else>    </choose>  </macro>  <macro name=\\"year-date\\">    <choose>      <if variable=\\"issued\\"><group prefix=\\"(\\">        <date variable=\\"issued\\">          <date-part name=\\"year\\"/>        </date>        </group>      </if>      <else>        <text term=\\"no date\\" form=\\"short\\"/>      </else>    </choose>  </macro>  <macro name=\\"edition\\">    <choose>      <if is-numeric=\\"edition\\">        <group delimiter=\\" \\">          <number variable=\\"edition\\" form=\\"ordinal\\"/>          <text term=\\"edition\\" form=\\"short\\" suffix=\\".\\" strip-periods=\\"true\\"/>        </group>      </if>      <else>        <text variable=\\"edition\\" suffix=\\".\\"/>      </else>    </choose>  </macro>  <macro name=\\"locator\\">    <choose>      <if locator=\\"page\\">        <text variable=\\"locator\\"/>      </if>      <else>        <group delimiter=\\" \\">          <label variable=\\"locator\\" form=\\"short\\"/>          <text variable=\\"locator\\"/>        </group>      </else>    </choose>  </macro>  <citation et-al-min=\\"2\\" et-al-use-first=\\"2\\" et-al-subsequent-min=\\"2\\" et-al-subsequent-use-first=\\"1\\" disambiguate-add-year-suffix=\\"true\\" disambiguate-add-names=\\"true\\" disambiguate-add-givenname=\\"true\\" collapse=\\"year\\" givenname-disambiguation-rule=\\"primary-name\\">       <sort>      <key macro=\\"author-short\\"/>      <key macro=\\"year-date\\"/>    </sort>    <layout prefix=\\"\\" delimiter=\\"; \\">      <group delimiter=\\", \\">        <group delimiter=\\" \\">          <text macro=\\"author-short\\"/><text macro=\\"year-date\\" suffix=\\")\\"/>        </group>        <text macro=\\"locator\\"/>      </group>    </layout>  </citation>  <bibliography hanging-indent=\\"true\\">    <sort>      <key macro=\\"author\\"/>      <key macro=\\"year-date\\"/>      <key variable=\\"title\\"/>    </sort>    <layout suffix=\\" \\">      <text macro=\\"author\\" suffix=\\" (\\"/>      <date variable=\\"issued\\">        <date-part name=\\"year\\" suffix=\\")\\"/>      </date>      <choose>        <if type=\\"book\\" match=\\"any\\">          <text macro=\\"legal_case\\"/>          <group prefix=\\" \\" delimiter=\\" \\">            <text macro=\\"title\\" suffix=\\".\\"/>            <text macro=\\"edition\\"/>            <text macro=\\"editor\\" suffix=\\".\\"/>          </group>          <group prefix=\\" \\" suffix=\\".\\" delimiter=\\", \\">          <text macro=\\"publisher\\"/>          <text variable=\\"page\\" prefix=\\" \\" suffix=\\" pp\\"/>          </group></if>        <else-if type=\\"chapter paper-conference\\" match=\\"any\\">                  <text macro=\\"title\\" prefix=\\" \\" suffix=\\".\\"/>          <group prefix=\\" In: \\" delimiter=\\" \\"><text macro=\\"editor\\" suffix=\\",\\"/>            <text variable=\\"container-title\\" font-style=\\"italic\\" suffix=\\".\\"/>            <text variable=\\"collection-title\\" suffix=\\".\\"/>            <group suffix=\\".\\">              <text macro=\\"publisher\\"/>              <group prefix=\\", pp. \\" delimiter=\\" \\" suffix=\\".\\">                <text variable=\\"page\\"/>              </group>            </group>          </group>        </else-if>                        <else-if type=\\"bill graphic legal_case legislation manuscript motion_picture report song thesis\\" match=\\"any\\">          <text macro=\\"legal_case\\"/>          <group prefix=\\" \\" delimiter=\\" \\">            <text macro=\\"title\\" suffix=\\".\\"/>            <text macro=\\"edition\\"/>            <text macro=\\"editor\\" suffix=\\".\\"/>          </group>          <group prefix=\\" \\" suffix=\\"\\" delimiter=\\", \\">          <text macro=\\"publisher\\"/>          <text variable=\\"page\\" prefix=\\" \\" suffix=\\"pp.\\"/>          </group>        </else-if>                <else>          <group prefix=\\" \\" delimiter=\\" \\" suffix=\\".\\">            <text macro=\\"title\\"/>            <text macro=\\"editor\\"/>          </group>          <group prefix=\\" \\" suffix=\\".\\">            <text variable=\\"container-title\\" font-style=\\"italic\\"/>            <group prefix=\\" \\">              <text variable=\\"volume\\"/>            </group>            <text variable=\\"page\\" prefix=\\", \\" suffix=\\".\\"/>          </group>        </else>              </choose>      <text prefix=\\" \\" macro=\\"access\\" suffix=\\".\\"/>    </layout>  </bibliography></style>";
\t\t\t
\t\t\t</script>
\t\t\t
\t\t\t<!-- documentcloud -->
\t\t\t<!--[if (!IE)|(gte IE 8)]><!-->
\t\t\t\t<link href="public/assets/viewer-datauri.css" media="screen" rel="stylesheet" type="text/css" />
\t\t\t\t<link href="public/assets/plain-datauri.css" media="screen" rel="stylesheet" type="text/css" />
\t\t\t<!--<![endif]-->
\t\t\t<!--[if lte IE 7]>
\t\t\t<link href="public/assets/viewer.css" media="screen" rel="stylesheet" type="text/css" />
\t\t\t<link href="public/assets/plain.css" media="screen" rel="stylesheet" type="text/css" />
\t\t\t<![endif]-->

\t\t\t<script src="public/assets/viewer.js" type="text/javascript" charset="utf-8"></script>
\t\t\t<script src="public/assets/templates.js" type="text/javascript" charset="utf-8"></script>\t
\t\t\t
\t\t</head>
\t\t<body onload="\$(window).resize();">

\t\t   <div class="navbar navbar-fixed-top">
\t\t\t  <div class="navbar-inner">
\t\t\t\t<div class="container">
\t\t\t\t  <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
\t\t\t\t\t<span class="icon-bar"></span>
\t\t\t\t\t<span class="icon-bar"></span>
\t\t\t\t\t<span class="icon-bar"></span>
\t\t\t\t  </a>
\t\t\t\t  <a class="brand" href=".">Biostor in the cloud</a>
\t\t\t\t  <div class="nav-collapse">
\t\t\t\t\t<ul class="nav">
\t\t\t\t\t  <li class="active"><a href=".">Home</a></li>
\t\t\t\t\t  <li><a href="?page=about">About</a></li>
\t\t\t\t\t</ul>
\t\t\t\t  </div><!--/.nav-collapse -->
\t\t\t\t  
\t\t\t\t\t<form class="navbar-search pull-left" method="get" action=".">
\t\t\t\t\t\t<input type="text" id='q' name='q' class="search-query" placeholder="Search">
\t\t\t\t\t</form>          
\t\t\t\t  
\t\t\t\t  
\t\t\t\t</div>
\t\t\t  </div>
\t\t\t</div>
\t\t
\t\t
\t\t\t<div style="margin-top:40px;padding:0px;" class="container-fluid">\t\t\t
\t\t\t\t<div class="row-fluid">
\t\t\t\t\t<div class="span8">
\t\t\t\t\t\t<div id="doc">Loading...</div>
\t\t\t\t\t</div>
\t\t\t\t\t<div class="span4" id="metadata" style="padding-right:40px;height:400px;overflow:auto;">
\t\t\t\t\t\t<h4><TITLE></h4>
\t\t\t\t\t\t
\t\t\t\t\t\t<ul class="unstyled">
\t\t\t\t\t\t<IDENTIFIER>
\t\t\t\t\t\t</ul>
\t\t\t\t\t\t
\t\t\t\t\t\t<COINS>
\t\t\t\t\t\t
\t\t\t\t\t\t<h5><i class="icon-bullhorn"></i>Cite</h5>
\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t\t\t\t\t<div class="tabbable"> <!-- Only required for left/right tabs -->
\t\t\t\t\t\t  <ul class="nav nav-tabs" id="myTab">
\t\t\t\t\t\t\t<li class="active"><a href="#tab1" data-toggle="tab">Zootaxa</a></li>
\t\t\t\t\t\t\t<li><a href="#tab2" data-toggle="tab">Zookeys</a></li>
\t\t\t\t\t\t\t<li><a href="#tab3" data-toggle="tab">BibTeX</a></li>
\t\t\t\t\t\t  </ul>\t\t\t\t\t\t
\t\t\t\t\t\t
\t\t\t\t\t\t\t
\t\t\t\t\t\t\t<div class="tab-content">
\t\t\t\t\t\t\t\t<div class="tab-pane active" id="tab1">
\t\t\t\t\t\t\t\t\t<pre id="zootaxa">
\t\t\t\t\t\t\t\t\t</pre>\t
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t<div class="tab-pane" id="tab2">
\t\t\t\t\t\t\t\t\t<pre id="zookeys">
\t\t\t\t\t\t\t\t\t</pre>\t
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t\t<div class="tab-pane" id="tab3">
\t\t\t\t\t\t\t\t\t<pre id="bibtex">
\t\t\t\t\t\t\t\t\t</pre>\t
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t</div>\t\t\t


\t   <!-- Le javascript
\t\t================================================== -->
\t\t<!-- Placed at the end of the document so the pages load faster -->
\t\t<script src="assets/js/jquery.js"></script>
\t\t<script src="assets/js/bootstrap.js"></script>
\t\t\t
\t\t<script type="text/javascript">
\t\t\t
\t\t\tvar windowWidth = \$(window).width();
\t\t\tvar windowHeight =\$(window).height() - 40;
\t\t
\t\t\t/* Viewer */
\t\t\t<DOCVIEWER>

\t\t\t// http://stackoverflow.com/questions/6762564/setting-div-width-according-to-the-screen-size-of-user
\t\t\t\$(window).resize(function() { 
\t\t\t\tvar windowHeight =\$(window).height() - 40;\t\t\t\t
\t\t\t\t\$('#doc').css({'width':'100%' ,'height':windowHeight });
\t\t\t\t\$('#metadata').css({'height':windowHeight });
\t\t\t});
\t\t\t
\t\tfunction show_formatted_citation(format)
\t\t{
\t\t  citeproc = new CSL.Engine( sys, cite_styles[format] );
  \t\tciteproc.appendCitationCluster( citation_object )[ 0 ][ 1 ];
 \t\t\t \$('#' + format).html(citeproc.makeBibliography()[ 1 ].join(""));
 \t\t}

\t\t\t
 \t\t\$(function () {
\t\t\t\$('#myTab a:first').tab('show');
\t\t\tshow_formatted_citation('zootaxa');
\t\t  })\t
\t\t  
\t\t  \$('a[data-toggle="tab"]').on('shown', function (e) {
  //e.target // activated tab
  //e.relatedTarget // previous tab
  
  var format = \$(e.target).text().toLowerCase();
  //alert(format);
  show_formatted_citation(format);
  
  
})
\t\t</script>
\t\t
\t\t</body>
\t</html>
EOT;
    $template = str_replace('<BASE>', $config['web_server'] . $config['web_root'], $template);
    $viewer = '';
    $identifiers = reference_identifiers($reference);
    // BioStor?
    if ($viewer == '') {
        if (isset($identifiers['biostor'])) {
            $viewer = "var docUrl = 'http://biostor.org/dv/" . $identifiers['biostor'] . ".json';\n\t\t\t\tDV.load(docUrl, {\n\t\t\t\t\tcontainer: '#doc',\n\t\t\t\t\twidth:700,\n\t\t\t\t\theight:windowHeight,\n\t\t\t\t\tsidebar: false\n\t\t\t\t});";
        }
    }
    // PDF?
    if ($viewer == '') {
        // Do we have a PDF file?
        if (isset($reference->file)) {
            // If we have a PDF sha1 and a thumbnail then this is a cached, viewable PDF
            if (isset($reference->file->sha1) && isset($reference->thumbnail)) {
                $viewer = "var docUrl = 'http://bionames.org/archive/documentcloud/" . $reference->file->sha1 . ".json';\n\t\t\t\t\tDV.load(docUrl, {\n\t\t\t\t\t\tcontainer: '#doc',\n\t\t\t\t\t\twidth:700,\n\t\t\t\t\t\theight:windowHeight,\n\t\t\t\t\t\tsidebar: false\n\t\t\t\t\t});";
            }
        }
    }
    // Gallica
    if ($viewer == '') {
        if (isset($identifiers['ark'])) {
            if (preg_match('/(?<namespace>\\d+)\\/(?<id>.*)\\/f(?<page>\\d+)$/', $identifiers['ark'], $m)) {
                $namespace = $m['namespace'];
                $arkid = $m['id'];
                $start_page = $m['page'];
                $viewer = "var docUrl = 'http://bionames.org/gallica/documentcloud/" . $arkid . "f" . $start_page . ".json';\n\t\t\t\t\tDV.load(docUrl, {\n\t\t\t\t\t\tcontainer: '#doc',\n\t\t\t\t\t\twidth:700,\n\t\t\t\t\t\theight:windowHeight,\n\t\t\t\t\t\tsidebar: false\n\t\t\t\t\t});";
            }
        }
    }
    // DOI
    if ($viewer == '') {
        if (isset($identifiers['doi'])) {
            $viewer = '$("#doc").html(\'<iframe src="http://dx.doi.org/' . $identifiers['doi'] . '" width="700" height="100%" style="border: none;"></iframe>\');';
        }
    }
    // JSTOR
    if ($viewer == '') {
        if (isset($identifiers['jstor'])) {
            $viewer = '$("#doc").html(\'<iframe src="http://www.jstor.org/stable/' . $identifiers['jstor'] . '" width="700" height="100%" style="border: none;"></iframe>\');';
        }
    }
    // CiNii
    if ($viewer == '') {
        if (isset($identifiers['cinii'])) {
            $viewer = '$("#doc").html(\'<iframe src="http://ci.nii.ac.jp/naid/' . $identifiers['cinii'] . '" width="700" height="100%" style="border: none;"></iframe>\');';
        }
    }
    // Handle
    if ($viewer == '') {
        if (isset($identifiers['handle'])) {
            $viewer = '$("#doc").html(\'<iframe src="http://hdl.handle.net/' . $identifiers['handle'] . '" width="700" height="100%" style="border: none;"></iframe>\');';
        }
    }
    $template = str_replace('<DOCVIEWER>', $viewer, $template);
    $template = str_replace('<BIBDATA>', $bibdata_json, $template);
    $template = str_replace('<TITLE>', $reference->title, $template);
    $template = str_replace('<COINS>', reference_to_coins($reference), $template);
    $html = '';
    foreach ($identifiers as $k => $v) {
        switch ($k) {
            case 'ark':
                if (preg_match('/^12148/', $v)) {
                    $html .= '<li><a href="http://gallica.bnf.fr/ark:/' . $v . '" target="_new"><i class="icon-external-link"></i>ark:/' . $v . '</a></li>';
                }
                break;
            case 'bhl':
                $html .= '<li><a href="http://biodiversitylibrary.org/page/' . $v . '" target="_new"><i class="icon-external-link"></i>biodiversitylibrary.org/page/' . $v . '</a></li>';
                break;
            case 'biostor':
                $html .= '<li><a href="http://biostor.org/reference/' . $v . '" target="_new"><i class="icon-external-link"></i>biostor.org/reference/' . $v . '</a></li>';
                break;
            case 'cinii':
                $html .= '<li><a href="http://ci.nii.ac.jp/naid/' . $v . '" target="_new"><i class="icon-external-link"></i>ci.nii.ac.jp/naid/' . $v . '</a></li>';
                break;
            case 'doi':
                $html .= '<li><a href="http://dx.doi.org/' . $v . '" target="_new"><i class="icon-external-link"></i>dx.doi.org/' . $v . '</a></li>';
                break;
            case 'handle':
                $html .= '<li><a href="http://hdl.handle.net/' . $v . '" target="_new"><i class="icon-external-link"></i>hdl.handle.net/' . $v . '</a></li>';
                break;
            case 'jstor':
                $html .= '<li><a href="http://ww.jstor.org/stable/' . $v . '" target="_new"><i class="icon-external-link"></i>www.jstor.org/stable/' . $v . '</a></li>';
                break;
            default:
                break;
        }
    }
    $template = str_replace('<IDENTIFIER>', $html, $template);
    echo $template;
}