Lines Matching +full:- +full:- +full:group
4 * Edited by Hans-Nikolai Viessmann, 2016
43 * @author Hans-Nikolai Viessmann <hv15@hw.ac.uk>
58 * group => (none|firstauthor|entrytype|$field)
63 * key => string (exposed in template at global-scope)
96 * - only => array([$field => $regexp], ...)
97 * - group => (none|year|firstauthor|entrytype|$field)
98 * - order_groups => (asc|desc)
99 * - sort_by => (DATE|$field)
100 * - order => (asc|desc)
101 * - lang => any string as long as proper lang/$s.php exists
109 $this->options = array(
111 'group' => 'year',
119 // lame replacement for non-constant default parameter
121 $this->sanitise = $sanitise;
124 $this->sanitise = create_function('$i', 'return $i;');
128 foreach ( $this->options as $key => $value ) {
130 $this->options[$key] = $options[$key];
137 if ( is_readable(dirname(__FILE__).'/lang/'.$this->options['lang'].'.php') ) {
138 require('lang/'.$this->options['lang'].'.php');
143 $this->options['lang'] = $translations;
145 $this->helper = new Helper($this->options);
148 $this->authorlist = array();
151 $this->authorlist[$tmp[1]] = "[[".$tmp[0]."|".$tmp[1]."]]";
169 self::$parser->loadString($bibtex);
170 $stat = self::$parser->parse();
176 $parsed = self::$parser->data;
200 if ( preg_match('/@\{group@/s', $template) + preg_match('/@\}group@/s', $template) < 2 ) {
201 $groupingDisabled = $this->options['group'];
202 $this->options['group'] = 'none';
206 if ( $this->options['group'] === 'none' ) {
207 $template = preg_replace(array('/@\{group@/s', '/@\}group@/s'), '', $template);
218 $data = $this->filter($data, $replacementKeys);
219 $data = $this->group($data);
220 $data = $this->sort($data);
221 $result = $this->translate($data, $template);
226 $this->options['group'] = $groupingDisabled;
237 * language file are put into a distinct group.
252 if ( empty($this->options['lang']['entrytypes'][$entry['entrytype']]) ) {
253 $entry['entrytype'] = $this->options['lang']['entrytypes']['unknown'];
258 foreach ( $this->options['only'] as $field => $regexp ) {
293 private function group(&$data) { function in BibtexConverter
296 if ( $this->options['group'] !== 'none' ) {
298 … if ( !empty($entry[$this->options['group']]) || $this->options['group'] === 'firstauthor' ) {
299 if ( $this->options['group'] === 'firstauthor' ) {
302 elseif ( $this->options['group'] === 'author' ) {
306 $target = $entry[$this->options['group']];
310 $target = $this->options['lang']['rest'];
321 $result[$this->options['lang']['all']] = $data;
328 * This function sorts the passed group of entries and the individual
337 if ( $this->options['group'] !== 'none' ) {
338 uksort($data, array($this->helper, 'group_cmp'));
342 foreach ( $data as &$group ) {
343 uasort($group, array($this->helper, 'entry_cmp'));
363 array(Helper::lcount($data, 2), count($data), $this->options['key']),
366 if ( $this->options['group'] !== 'none' ) {
367 $pattern = '/@\{group@(.*?)@\}group@/s';
369 // Extract group templates
373 // For all occurrences of an group template
378 foreach ( $data as $groupkey => $group ) {
379 $groups .= $this->translate_group($groupkey, $id++, $group, $group_tpl[1]);
390 foreach ( $data as $groupkey => $group ) { // loop will only be run once
391 $groups .= $this->translate_group($groupkey, 0, $group, $template);
398 * This function translates one entry group
401 * @param string key The rendered group's key
402 * @param int id A unique ID for this group
403 * @param array data Array of entries in this group
404 * @param string template The group part of the template
405 * @return string String representing the passed group wrt template
410 // Replace group values
411 if ( $this->options['group'] === 'entrytype' ) {
412 $key = $this->options['lang']['entrytypes'][$key];
429 $entries .= $this->translate_entry($entry, $entry_tpl[1]);
451 $result = $this->resolve_conditions($entry, $result);
460 $value = $this->authorlink($value);
469 $replacements []= call_user_func($this->sanitise, $value);
490 * Group 1 field field \w+
491 * Group 2 then operator .*? / <=|>=|==|!=|~
492 * Group 3 [else] value .*?
493 * Group 4 --- then .*?
494 * Group 5 --- [else] .*?
544 $resolved = $this->resolve_conditions($entry, $resolved);
553 * This function adds links to co-author websites where available.
560 $data = str_replace(array_keys($this->authorlist),$this->authorlist,$data);