Skip to content

Commit

Permalink
pkp/pkp-lib#9374 Push author biographical statement to JATS
Browse files Browse the repository at this point in the history
  • Loading branch information
ewhanson authored and asmecher committed Nov 22, 2023
1 parent 8fa4e43 commit 17603f8
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions JatsTemplatePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use APP\core\Services;
use APP\core\Application;
use APP\template\TemplateManager;
use HTMLPurifier;
use HTMLPurifier_Config;
use PKP\core\PKPString;
use PKP\db\DAORegistry;
use PKP\plugins\GenericPlugin;
Expand Down Expand Up @@ -213,8 +215,21 @@ function toXml(&$record, $format = null) {
"\t\t\t\t\t</name-alternatives>\n" .
($affiliationToken?"\t\t\t\t\t<xref ref-type=\"aff\" rid=\"$affiliationToken\" />\n":'') .
"\t\t\t\t\t<email>" . htmlspecialchars($author->getEmail()) . "</email>\n" .
(($s = $author->getUrl()) != ''?"\t\t\t\t\t<uri>" . htmlspecialchars($s) . "</uri>\n":'') .
"\t\t\t\t</contrib>\n";
(($s = $author->getUrl()) != ''?"\t\t\t\t\t<uri>" . htmlspecialchars($s) . "</uri>\n":'');

static $purifier;
if (!$purifier) {
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', 'p,em,strong');
$config->set('Cache.SerializerPath', 'cache');
$purifier = new HTMLPurifier($config);
}

foreach ($author->getData('biography') as $locale => $bio) {
$response .= "\t\t\t\t\t<bio xml:lang=\"" . substr($locale, 0, 2) . "\">" . $purifier->purify($bio) . "</bio>\n";
}

$response .= "\t\t\t\t</contrib>\n";
}
$response .= "\t\t\t</contrib-group>\n";
foreach ($affiliations as $affiliationToken => $affiliation) {
Expand Down

0 comments on commit 17603f8

Please sign in to comment.