Skip to content

Ensure citation html builder accepts dois with doi: prefix#218

Open
DarianGill wants to merge 4 commits intodevelopfrom
bugfix-217-doi-citation-display
Open

Ensure citation html builder accepts dois with doi: prefix#218
DarianGill wants to merge 4 commits intodevelopfrom
bugfix-217-doi-citation-display

Conversation

@DarianGill
Copy link
Copy Markdown
Collaborator

@DarianGill DarianGill commented Apr 1, 2026

Deployed on develop rc: https://dev.vegbank.org/rc?cite=doi:10.82902/J17P4J

What

Fixes #217 by ensuring that the citation text builder recognizes both dois that are prefixed with doi: and those without it.

Also updates all copy permalink buttons to specify https instead of a bare vegbank.org url and adds the ability to pass a specific non-vegbank citation url to them as well. The dataset detail view uses that ability to copy doi.org citations for datasets that have dois and identifiers.org citations for legacy accession codes. If neither pattern matches, it falls back to copying https://vegbank.org/cite/ds_code.

Finally, the detail panel css was updated to use dvh instead of just vh to hopefully ensure all details scroll into view (works on my phone now on the dev rc site!). When I opened your linked problem page on mobile the browser controls obscured part of the view and prevented me from actually seeing the error.

Why

Because the api's create_dataset() saves an accession_code with the doi: prefix and this was breaking the application as documented in 217.

How

  • detail_dataset.R now checks whether an accession_code is a doi or a legacy vegbank code with the following regex:
    • doi: "^(doi:)?10\.\d{4,9}/"
    • vegbank legacy: "^VB\.ds\.\d+\."
  • detail_dataset.R has two new helpers:
    • extract_clean_doi() pulls the doi without the prefix from the accession_code
    • dataset_accession_url() uses the regex above to build a doi.org or identifiers.org permalink
  • the detail panel css height uses dynamic viewport height which is updated by the browser to always match the current visible viewport but leaves the old 100vh line as a fallback for browsers that don't support dvh yet (all modern iOS Safari 16+ supports it)
  • the detail panel padding-bottom uses env(safe-area-inset-bottom). On iPhones with a Home Indicator the OS exposes safe-area-inset-bottom (~34px), which ensures the last card clears the gesture indicator even when the panel is exactly 100dvh tall. On devices without one it resolves to 0 with no effect.

Testing and Documentation

All 1586 tests pass and check() has no errors, warnings, or notes!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes dataset citation rendering for DOIs that may be stored with a doi: prefix (as produced by the API), ensuring the citation builder generates a correct DOI link and avoids Shiny render errors in the citation subpanel.

Changes:

  • Rename build_dataset_citation_text() to build_dataset_citation_html() and update callers/tests accordingly.
  • Expand DOI detection to accept optional doi: prefix and normalize the DOI for display/linking.
  • Adjust citation plain-text extraction to parse from wrapped HTML content before copying.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
R/detail_dataset.R Updates DOI detection/normalization and switches detail view citation rendering to the new HTML builder.
tests/testthat/test_detail_dataset.R Renames tests to the new function and adds coverage for doi:-prefixed DOIs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants