From 1bc232fa85fb52ee10eecb3f1afaeaca80f433d7 Mon Sep 17 00:00:00 2001 From: Igor Date: Tue, 2 Nov 2010 17:21:32 +0300 Subject: Added support for @GRANT; for specifying source page ; for passing options to renderer --- bibtex.php | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) (limited to 'bibtex.php') diff --git a/bibtex.php b/bibtex.php index 9fd391f..0484915 100644 --- a/bibtex.php +++ b/bibtex.php @@ -124,7 +124,7 @@ class BibtexParser foreach ($search as $key => $value) { $key = strtolower($key); - if (!empty($entry[$key]) && !preg_match($value, $entry[$key])) + if (!empty($entry[$key]) && !preg_match('/' . $value . '/u', $entry[$key])) { $select = false; break; @@ -189,6 +189,7 @@ class BibtexParserTeam extends BibtexParser 'no.' => array('russian' => '№'), 'et al.' => array('russian' => 'и др.'), 'Ed. by' => array('russian' => 'Под ред.'), + 'leader' => array('russian' => 'рук.'), ); protected function _($str) @@ -261,6 +262,30 @@ class BibtexParserTeam extends BibtexParser ); } + protected function format_organization() // for @GRANT + { + $this->format_field_default('organization'); + $this->entry['organization'] = '' . $this->entry['organization'] . ''; + } + + protected function format_doer() // for @GRANT + { + $res = ''; + $authors_array = preg_split('/\s+and\s+/', + $this->expand_string($this->entry['doer'])); + + foreach ($authors_array as &$a) + { + $a = $this->format_author1($a); + } + + if(isset($authors_array[1])) + $authors_array[0] .= ' (' . $this->_('leader') . ')'; + $res = implode(', ', $authors_array); + + $this->entry['doer'] = $res; + } + protected function format_pages() { $this->format_field_default('pages'); @@ -364,7 +389,7 @@ class BibtexParserTeam extends BibtexParser } else { - $res = 'Not implemented for ' . $this->entry['entry']; + $res = 'Not implemented for "' . $this->entry['entry'] . '"'; } $res .= '.'; @@ -460,7 +485,7 @@ class BibtexParserTeam extends BibtexParser $parts[] = $this->entry['year']; } - if (!empty($this->entry['manth'])) + if (!empty($this->entry['month'])) { $parts[] = $this->entry['month']; } @@ -484,6 +509,39 @@ class BibtexParserTeam extends BibtexParser return implode('. — ', $parts); } + protected function format_grant() + { + $parts = array(); // All parts are connected with '. — ' + + + if (!empty($this->entry['organization'])) + { + $parts[] = $this->entry['organization']; + } + + if (!empty($this->entry['number'])) + { + $parts[] = $this->entry['number']; + } + + if (!empty($this->entry['title'])) + { + $parts[] = $this->entry['title']; + } + + if (!empty($this->entry['year'])) + { + $parts[] = $this->entry['year']; + } + + if (!empty($this->entry['doer'])) + { + $parts[] = '' . $this->entry['doer'] . ''; + } + + return implode('. — ', $parts); + } + protected function format_inproceedings() { -- cgit v1.2.3