1: <?php
2:
3: 4: 5: 6: 7:
8:
9: namespace academicpuma\citeproc;
10:
11: 12: 13: 14: 15:
16:
17: class Bibliography extends Format {
18:
19: private $layout = NULL;
20:
21: function init($dom_node, $citeproc) {
22: $hier_name_attr = $this->get_hier_attributes();
23: $options = $dom_node->getElementsByTagName('option');
24: foreach ($options as $option) {
25: $value = $option->getAttribute('value');
26: $name = $option->getAttribute('name');
27: $this->attributes[$name] = $value;
28: }
29:
30: $layouts = $dom_node->getElementsByTagName('layout');
31: foreach ($layouts as $layout) {
32: $this->layout = new Layout($layout, $citeproc);
33: }
34: }
35:
36: function init_formatting() {
37: $this->div_class = 'csl-bib-body';
38: parent::init_formatting();
39: }
40:
41: function render($data, $mode = NULL) {
42: $this->citeproc->quash = array();
43: $text = $this->layout->render($data, 'bibliography');
44: if ($this->{'hanging-indent'} == 'true') {
45: $text = '<div style="text-indent: -25px; padding-left: 25px;">' . $text . '</div>';
46: }
47: $text = str_replace('?.', '?', str_replace('..', '.', $text));
48: return $this->format($text);
49: }
50:
51: }
52: