Browse Source

ZRD-specific changes and generation of first draft

master
Frederik Möllers 3 days ago
parent
commit
52b67afd92
  1. 2
      .gitignore
  2. 48
      bibtexbrowser.after.php
  3. 19
      bibtexbrowser.german.php
  4. 34
      bibtexbrowser.local.php
  5. 46
      makehtml.sh
  6. 16
      persons.txt
  7. 1
      php_cli.ini
  8. 3
      prepend.php

2
.gitignore

@ -0,0 +1,2 @@
# ignore generated artifacts
/artifacts

48
bibtexbrowser.after.php

@ -0,0 +1,48 @@
<?php
/**
* A helper Display class that is just like SimpleDisplay but just never
* outputs section headers (i.e. year numbers). Used by YearCatDisplay.
**/
class NoHeaderDisplay extends SimpleDisplay {
function changeSection($pred, $bib) {
return false;
}
}
/**
* A modified "Academic" display, with reversed grouping. First grouping is by
* year, then by category. Uses NoHeaderDisplay to not have year numbers within
* categories.
*/
class YearCatDisplay extends AcademicDisplay {
/** an array of strings representing years */
var $yearIndex;
/** transforms a query to HTML
* $ query is an array (e.g. array(Q_YEAR=>'2005'))
* $title is a string, the title of the section
*/
function search2html($query, $title) {
$entries = $this->db->multisearch($query);
if (count($entries)>0) {
echo "\n".'<div class="theader">'.$title.'</div>'."\n";
}
$display = new NoHeaderDisplay();
$display->setEntries($entries);
$display->display();
}
function display() {
$this->db = createBibDataBase();
$this->db->bibdb = $this->entries;
$this->yearIndex = $this->db->yearIndex();
foreach($this->yearIndex as $year) {
echo "\n".'<div class="sheader">'.$year.'</div>'."\n";
foreach (_DefaultBibliographySections() as $section) {
$this->search2html(array_merge(array(Q_YEAR=>$year), $section['query']),$section['title']);
}
}
}
}
?>

19
bibtexbrowser.german.php

@ -0,0 +1,19 @@
<?php
global $BIBTEXBROWSER_LANG;
$BIBTEXBROWSER_LANG=array();
$BIBTEXBROWSER_LANG['Bachelor\'s thesis'] = "Bachelorarbeit";
$BIBTEXBROWSER_LANG['Books'] = 'Bücher';
$BIBTEXBROWSER_LANG['Book Chapters'] = "Buchbeiträge";
$BIBTEXBROWSER_LANG['Chapter in'] = "Kapitel in";
$BIBTEXBROWSER_LANG['In'] = "In";
$BIBTEXBROWSER_LANG['Master\'s thesis'] = "Masterarbeit";
$BIBTEXBROWSER_LANG['No date'] = "Kein Datum";
$BIBTEXBROWSER_LANG['No publications present'] = "Keine Publikationen vorhanden";
$BIBTEXBROWSER_LANG['Other Publications'] = "Andere Veröffentlichungen";
$BIBTEXBROWSER_LANG['PhD thesis'] = "Dissertation";
$BIBTEXBROWSER_LANG['Refereed Articles'] = "Zeitschriftenbeiträge";
$BIBTEXBROWSER_LANG['Refereed Conference Papers'] = "Konferenzbeiträge";
$BIBTEXBROWSER_LANG['Refereed Workshop Papers'] = "Workshopbeiträge";
$BIBTEXBROWSER_LANG['Technical report'] = "Technischer Bericht";
@define('LAST_AUTHOR_SEPARATOR',' und ');
?>

34
bibtexbrowser.local.php

@ -0,0 +1,34 @@
<?php
define('ABBRV_TYPE','key');
// use tabular layout (HTML tables)
define('BIBTEXBROWSER_LAYOUT','table');
// URL to individual files
define('BIBTEXBROWSER_URL',"https://publications.zrd-saar.de/");
// target for links
define('BIBTEXBROWSER_LINKS_TARGET','_blank');
// use IEEE Transactions-like style, e.g. puts authors in front of title
define('BIBLIOGRAPHYSTYLE', 'JanosBibliographyStyle');
//define('BIBLIOGRAPHYSECTIONS','AGSorgeBibliographySections');
// Allow "Firstname Lastname" as well as "Lastname, Firstname" for authors
define('USE_FIRST_THEN_LAST',true);
// Enable all metadata generation
define('METADATA_COINS',true); // see https://en.wikipedia.org/wiki/COinS
define('METADATA_GS',true); // metadata google scholar
define('METADATA_DC',true); // see http://dublincore.org/
define('METADATA_OPENGRAPH',true); // see http://ogp.me/
define('METADATA_EPRINTS',true); // see https://wiki.eprints.org/w/Category:EPrints_Metadata_Fields
// include language config
if(isset($_GET['language']))
{
include(preg_replace('/local\.php$/',$_GET['language'].'.php',__FILE__));
}
// Order entries by year, but reverse the order (newest on top)
define('ORDER_FUNCTION','compare_bib_entry_by_year_reverse');
function compare_bib_entry_by_year_reverse($a, $b)
{
return 0 - compare_bib_entry_by_year($a, $b);
}
?>

46
makehtml.sh

@ -0,0 +1,46 @@
#!/bin/bash
# URL of the Bibtex file
BIBTEX_URL="https://cloud.hiz-saarland.de/public.php/dav/files/Yj8FtZsTS9TkFWG"
# command to run BibtexBrowser
BIBTEXBROWSER="php -c \"php_cli.ini\" -f \"bibtexbrowser.php\""
# DELETEME
rm -r "artifacts" "temp"
# create output directories and download bibtex file
mkdir -p "artifacts/keys" "temp"
wget -O "temp/zrd.bib" "$BIBTEX_URL"
# if `bibtool` is available, sanitize the bibtex file
if which bibtool >/dev/null 2>&1
then
bibtool "temp/zrd.bib" > "temp/zrd.new.bib"
echo "Bibtool successful!"
mv -f "temp/zrd.new.bib" "temp/zrd.bib"
fi
# copy static files
cp -fur "static" "artifacts/"
for WEBSITE_LANGUAGE in german
do :
# generate full index
eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" all display=YearCatDisplay language=$WEBSITE_LANGUAGE > \"artifacts/all.${WEBSITE_LANGUAGE}.html\""
# generate index for each person
while read LINE
do :
ALIAS="$(echo "$LINE" | cut -d ':' -f 1)"
SEARCHSTRING="$(echo "$LINE" | cut -d ':' -f 2)"
eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" \"author=$SEARCHSTRING\" academic=1 language=$WEBSITE_LANGUAGE > \"artifacts/${ALIAS}.${WEBSITE_LANGUAGE}.html\""
done < "persons.txt"
done
# generate page for each key
egrep '^@' "temp/zrd.bib" | sed -e 's/.*\t \(.*\),/\1/' | while read KEY
do :
eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" \"key=$KEY\" > \"artifacts/keys/${KEY}.html\""
done
# Clean up
rm -rf "temp"
rm bibtexbrowser_*.dat

16
persons.txt

@ -0,0 +1,16 @@
ajla:Ajla Hajric
anastasiia:Anastasiia Babych
andreas:Andreas Rebmann
anna:Anna Zichler
frederik:Frederik Möllers
greta:Greta Böttcher
jochen:Jochen Krüger
lina:Lina Nauerz
max:Maximilian Eichacker
natascha:Natascha Schliwinski
niklas:Niklas Dahlem
piotr:Piotr Rataj
simone:Simone Salemi
stephanie:Stephanie Vogelgesang
theresa:Theresa Moll
tim:Tim Schneider

1
php_cli.ini

@ -0,0 +1 @@
auto_prepend_file = "prepend.php"

3
prepend.php

@ -0,0 +1,3 @@
<?php
parse_str(implode('&', array_slice($argv, 1)), $_GET);
?>
Loading…
Cancel
Save