Skip to content

Reference formatting service

Fixes Partially addresses #113 (closed) by @larsgw

Description
This pull requests

  • sets up an internal server and service for formatting references, with support for artifacts and publications
  • adds a CakePHP helper to use the service without dealing with the technicalities of connecting (see below)
  • sets up a CakePHP REST server for /artifacts/:id and /publications/:id routes
  • adds developer documentation on how to make REST APIs with external scripts

Type of PR This PR is a feature.

Technicalities

NOTE: requires an updated CakePHP image to function

  • A Node.JS server running Citation.js (which I maintain) is set up in a new node-tools Docker service
  • The CakePHP container now has allow_url_fopen turned on (#242 (closed)). Alternatively, cURL could be used in the future.
  • A CakePHP Helper is made to abstract away the technicalities of using the server, and to make it possible to easily switch between implementations (CakePHP's HttpClient, cURL, exec + wget)
  • BibliographyComponent is added to configure bibliography export for controllers.
  • BibliographyView is added to produce the export data

Tests
To test the helper, add this somewhere in app/cake/src/Template/Artifacts/view.ctp:

<p>
    <?= $this->Scripts->formatReference($artifact, 'bibliography', [
        'template' => 'chicago',
        'format' => 'html'
    ]) ?>
</p>

Option documentation is available in app/tools/citation.js/README.md.

To test the component and the view, go to (for example) http://127.0.0.1:2354/artifacts/1.bib.

Screenshots

Example usage: 127.0.0.1_2354_artifacts_1

Checklist:

  • My pull request has a descriptive title (not a vague title like "Update index.md").
  • My pull request targets the phoenix/develop branch of the repository.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Merge request reports

Loading