Skip to content

Commit

Permalink
Label with family / order if lower ranks are not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
wbbaker committed Mar 3, 2025
1 parent a93ad55 commit a8630ab
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ of a specimen, from the TaxonWorks api /otus/<ID>/inventory/dwc.json.
For further reference see https://dwc.tdwg.org/terms/.
-->
<template>
<!-- <ul class="tree m-2 ml-6 list-disc">-->
<div v-html="nameAndAuthor(specimen)"/>
<ul class="tree ml-6 relative">
<li class="my-2">{{ describeSpecimen(specimen) }}</li>
Expand Down Expand Up @@ -36,11 +35,16 @@ const props = defineProps({
})

function genusSpecies(specimen) {
return [specimen.genus, specimen.specificEpithet].filter(Boolean).join(' ')
return [specimen.genus, specimen.specificEpithet].filter(Boolean).join(' ')
}

function nameAndAuthor(specimen) {
return [`<em>${genusSpecies(specimen)}</em>`, specimen.scientificNameAuthorship].filter(Boolean).join(' ')
// scientificName contains most specific available rank
// italicize the genus + species
return specimen.scientificName
.replace(genusSpecies(specimen), `<em>${genusSpecies(specimen)}</em>`)
.replace(specimen.family, `Family ${specimen.family}`)
.replace(specimen.order, `Order ${specimen.order}`)
}

/** Inspired by taxonpages-orthoptera PanelSpecimenRecords. */
Expand Down

0 comments on commit a8630ab

Please sign in to comment.