Skip to content

structured citations #961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: stable-3_5_0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@
[submodule "plugins/generic/webFeed"]
path = plugins/generic/webFeed
url = https://github.com/pkp/webFeed.git
[submodule "plugins/generic/openCitations"]
path = plugins/generic/openCitations
url = https://github.com/pkp/openCitations
19 changes: 19 additions & 0 deletions api/v1/citations/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* @defgroup api_v1_citations Citation API requests
*/

/**
* @file api/v1/citations/index.php
*
* Copyright (c) 2025 Simon Fraser University
* Copyright (c) 2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @ingroup api_v1_citations
*
* @brief Handle API requests for citations.
*/

return new \PKP\handler\APIHandler(new \PKP\API\v1\citations\PKPCitationController());
8 changes: 3 additions & 5 deletions pages/preprint/PreprintHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use APP\security\authorization\OpsServerMustPublishPolicy;
use APP\template\TemplateManager;
use Firebase\JWT\JWT;
use PKP\citation\CitationDAO;
use PKP\config\Config;
use PKP\core\Core;
use PKP\core\PKPApplication;
Expand Down Expand Up @@ -268,11 +267,10 @@ public function view($args, $request)
]);

// Citations
if ($publication->getData('citationsRaw')) {
$citationDao = DAORegistry::getDAO('CitationDAO'); /** @var CitationDAO $citationDao */
$parsedCitations = $citationDao->getByPublicationId($publication->getId());
if ($publication->getData('citations') || $publication->getData('citationsRaw')) {
$templateMgr->assign([
'parsedCitations' => $parsedCitations->toArray(),
'citations' => $publication->getData('citations'),
'citationsRaw' => $publication->getData('citationsRaw')
]);
}

Expand Down
12 changes: 6 additions & 6 deletions templates/frontend/objects/preprint_details.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* plugins using the hooks provided:
*
* @hook Templates::Preprint::Main []
* @hook Templates::Preprint::Details::Reference [[parsedCitation]]
* @hook Templates::Preprint::Details::Reference []
* @hook Templates::Preprint::Details []
*
* @uses $preprint Preprint This preprint
Expand Down Expand Up @@ -255,18 +255,18 @@
{/if}

{* References *}
{if $parsedCitations || $publication->getData('citationsRaw')}
{if $citations || $citationsRaw}
<section class="item references">
<h2 class="label">
{translate key="submission.citations"}
</h2>
<div class="value">
{if $parsedCitations}
{foreach from=$parsedCitations item="parsedCitation"}
<p>{$parsedCitation->getCitationWithLinks()|strip_unsafe_html} {call_hook name="Templates::Preprint::Details::Reference" citation=$parsedCitation}</p>
{if $citations}
{foreach from=$citations item="citation"}
<p>{$citation->getRawCitationWithLinks()|strip_unsafe_html} {call_hook name="Templates::Preprint::Details::Reference" citation=$citation}</p>
{/foreach}
{else}
{$publication->getData('citationsRaw')|escape|nl2br}
{$citationsRaw|escape|nl2br}
{/if}
</div>
</section>
Expand Down