Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit d1f3d1d

Browse files
Add paragraphs of text (#34)
* Add paragraphs of text * Add handlers test * Fix indentation
1 parent 7302e3b commit d1f3d1d

File tree

6 files changed

+526
-1
lines changed

6 files changed

+526
-1
lines changed

.docker/api/data/scholarly-articles/article1/1.xml

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,91 @@
1515
<jats:article-meta>
1616

1717
<jats:title-group>
18-
<jats:article-title>Article 1</jats:article-title>
18+
19+
<jats:article-title>
20+
<jats:italic>Homo naledi</jats:italic>, a new species of the genus
21+
<jats:italic>Homo</jats:italic> from the Dinaledi Chamber, South Africa
22+
</jats:article-title>
23+
1924
</jats:title-group>
2025

2126
</jats:article-meta>
2227

2328
</jats:front>
2429

30+
<jats:body>
31+
32+
<jats:p>Fossil hominins were first recognized in the Dinaledi Chamber in the Rising Star cave system in
33+
October 2013. During a relatively short excavation, our team recovered an extensive collection of
34+
1550 hominin specimens, representing nearly every element of the skeleton multiple times (Figure 1),
35+
including many complete elements and morphologically informative fragments, some in articulation, as
36+
well as smaller fragments many of which could be refit into more complete elements. The collection is
37+
a morphologically homogeneous sample that can be attributed to no previously-known hominin species.
38+
Here we describe this new species, <jats:italic>Homo naledi</jats:italic>. We have not defined
39+
<jats:italic>H. naledi</jats:italic> narrowly based on a single jaw or skull because the entire body
40+
of material has informed our understanding of its biology.
41+
</jats:p>
42+
43+
<jats:p>Order Primates LINNAEUS 1758</jats:p>
44+
45+
<jats:p>Suborder Anthropoidea MIVART 1864</jats:p>
46+
47+
<jats:p>Superfamily Hominoidea GRAY 1825</jats:p>
48+
49+
<jats:p>Family Hominidae GRAY 1825</jats:p>
50+
51+
<jats:p>Tribe Hominini GRAY 1825</jats:p>
52+
53+
<jats:p>Genus <jats:italic>Homo</jats:italic> LINNAEUS 1758</jats:p>
54+
55+
<jats:p><jats:italic>Homo naledi</jats:italic> sp. nov.
56+
urn:lsid:zoobank.org:pub:00D1E81A-6E08-4A01-BD98-79A2CEAE2411
57+
</jats:p>
58+
59+
<jats:p>The word <jats:italic>naledi</jats:italic> means ‘star’ in the Sotho language and refers to the
60+
Dinaledi Chamber's location within the Rising Star cave system.
61+
</jats:p>
62+
63+
<jats:p>The Dinaledi chamber is located approximately 30 meters underground, within the Rising Star cave
64+
system at about 26°1′13′′ S; 27°42′43′′ E. The system lies within the Malmani dolomites, approximately
65+
800 meters southwest of the well-known site of Swartkrans in the Cradle of Humankind World Heritage
66+
Site, Gauteng Province, South Africa.
67+
</jats:p>
68+
69+
<jats:p>The present sample of skeletal material from the Dinaledi Chamber was recovered during two field
70+
expeditions, in November 2013 and March 2014.
71+
</jats:p>
72+
73+
<jats:p>Six specimens from an ex situ context can be identified as bird bones, and few fragmentary rodent
74+
remains have been recovered within the excavation area. Neither of these faunal constituents can
75+
presently be associated with the hominin fossil collection (Dirks et al., 2015).
76+
</jats:p>
77+
78+
<jats:p>Aside from these limited faunal materials, the Dinaledi collection is entirely composed of hominin
79+
skeletal and dental remains. The collection so far comprises 1550 fossil hominin specimens, this number
80+
includes 1413 bone specimens and 137 isolated dental specimens; an additional 53 teeth are present in
81+
mandibular or maxillary bone specimens. Aside from the fragmentary rodent teeth, all dental crowns (n =
82+
179) are hominin, recovered both from surface collection and excavation. Likewise, aside from the few
83+
bird elements, all morphologically informative bone specimens are clearly hominin. In all cases where
84+
elements are repeated in the sample, they are morphologically homogeneous, with variation consistent
85+
with body size and sex differences within a single population. These remains represent a minimum of 15
86+
hominin individuals, as indicated by the repetition and presence of deciduous and adult dental elements.
87+
</jats:p>
88+
89+
<jats:p>The geological age of the fossils is not yet known. Excavations have thus far recovered hominin
90+
material from Unit 2 and Unit 3 in the chamber (Dirks et al., 2015). Surface-collected hominin material
91+
from the present top of Unit 3, which includes material derived from both Unit 2 and Unit 3, represents
92+
a minority of the assemblage, and is morphologically indistinguishable from material excavated from in
93+
situ within Unit 3. In addition to general morphological homogeneity including cranial shape,
94+
distinctive morphological configurations of all the recovered first metacarpals, femora, molars, lower
95+
premolars and lower canines, are identical in both surface-collected and excavated specimens (see Figure
96+
14 later in the text). These include traits not found in any other hominin species yet described. These
97+
considerations strongly indicate that this material represents a single species, and not a commingled
98+
assemblage.
99+
</jats:p>
100+
101+
</jats:body>
102+
25103
</jats:article>
26104

27105
</item>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Libero\JatsContentBundle\EventListener;
6+
7+
use FluentDOM\DOM\Element;
8+
use Libero\ContentPageBundle\Event\CreateContentPageEvent;
9+
use Libero\ViewsBundle\Views\ConvertsChildren;
10+
use Libero\ViewsBundle\Views\View;
11+
use Libero\ViewsBundle\Views\ViewConverter;
12+
13+
final class BodyListener
14+
{
15+
use ConvertsChildren;
16+
17+
private $converter;
18+
19+
public function __construct(ViewConverter $converter)
20+
{
21+
$this->converter = $converter;
22+
}
23+
24+
public function onCreatePage(CreateContentPageEvent $event) : void
25+
{
26+
$xpath = $event->getItem()->xpath();
27+
28+
$body = $xpath->firstOf('/libero:item/jats:article/jats:body');
29+
30+
if (!$body instanceof Element) {
31+
return;
32+
}
33+
34+
$event->addContent(
35+
new View(
36+
'@LiberoPatterns/single-column-grid.html.twig',
37+
['content' => $this->convertChildren($body, $event->getContext())]
38+
)
39+
);
40+
}
41+
}

vendor-extra/JatsContentBundle/src/Resources/config/services.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
<defaults public="false"/>
1010

11+
<service id="Libero\JatsContentBundle\EventListener\BodyListener"
12+
class="Libero\JatsContentBundle\EventListener\BodyListener">
13+
<argument type="service" id="Libero\ViewsBundle\Views\ViewConverter"/>
14+
<tag name="kernel.event_listener" event="libero.page.content" method="onCreatePage"/>
15+
</service>
16+
1117
<service id="Libero\JatsContentBundle\EventListener\ContentHeaderListener"
1218
class="Libero\JatsContentBundle\EventListener\ContentHeaderListener">
1319
<argument type="service" id="Libero\ViewsBundle\Views\ViewConverter"/>
@@ -45,6 +51,12 @@
4551
<tag name="libero.view_converter"/>
4652
</service>
4753

54+
<service id="Libero\JatsContentBundle\ViewConverter\ParagraphVisitor"
55+
class="Libero\JatsContentBundle\ViewConverter\ParagraphVisitor">
56+
<argument type="service" id="Libero\ViewsBundle\Views\ViewConverter"/>
57+
<tag name="libero.view_converter"/>
58+
</service>
59+
4860
</services>
4961

5062
</container>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Libero\JatsContentBundle\ViewConverter;
6+
7+
use FluentDOM\DOM\Element;
8+
use Libero\ViewsBundle\Views\ConvertsChildren;
9+
use Libero\ViewsBundle\Views\SimplifiedChildVisitor;
10+
use Libero\ViewsBundle\Views\View;
11+
use Libero\ViewsBundle\Views\ViewConverter;
12+
use Libero\ViewsBundle\Views\ViewConverterVisitor;
13+
14+
final class ParagraphVisitor implements ViewConverterVisitor
15+
{
16+
use ConvertsChildren;
17+
use SimplifiedChildVisitor;
18+
19+
private $converter;
20+
21+
public function __construct(ViewConverter $converter)
22+
{
23+
$this->converter = $converter;
24+
}
25+
26+
protected function doVisit(Element $object, View $view, array &$context = []) : View
27+
{
28+
return $view->withArgument('text', $this->convertChildren($object, $context));
29+
}
30+
31+
protected function possibleTemplate() : string
32+
{
33+
return '@LiberoPatterns/paragraph.html.twig';
34+
}
35+
36+
protected function expectedElement() : string
37+
{
38+
return '{http://jats.nlm.nih.gov}p';
39+
}
40+
41+
protected function unexpectedArguments() : array
42+
{
43+
return ['text'];
44+
}
45+
}

0 commit comments

Comments
 (0)