From 5afb4597464bd9cd7e9c02b38731452faf554a87 Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Wed, 5 Jun 2024 16:26:24 -0400 Subject: [PATCH] v1.2.2 (#257) Closes #250 Closes #256 Closes #260 Closes #258 - adds `affiliation` to member portrait component - simplify portrait component code/css - make tag de-dupe behavior the same as search de-dupe. normalize to lower-kebab-case. - expand list of manubot-supported id types for falling back to orcid api details - change order and type of preferred ids from orcid --------- Co-authored-by: Faisal Alquaddoomi Co-authored-by: vincerubinetti --- CHANGELOG.md | 13 +++++++++ CITATION.cff | 4 +-- _cite/.cache/cache.db | Bin 49152 -> 49152 bytes _cite/plugins/orcid.py | 30 ++++++++++---------- _data/citations.yaml | 4 +-- _includes/list.html | 1 + _includes/portrait.html | 34 +++++++++++++---------- _includes/tags.html | 4 +++ _members/jane-smith.md | 1 + _scripts/search.js | 2 +- _styles/portrait.scss | 59 +++++++++++++++++++++------------------- 11 files changed, 90 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb1f988eed..35da88ea80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ Reference: common-changelog.org +## 1.2.2 - 2024-06-05 + +### Added + +- Add `affiliation` member portrait field. + +### Changed + +- Change order and type of preferred ids from ORCID API. +- Expand list of supported Manubot identifiers and thus keep ORCID API details less often. +- Simplify portrait component under-the-hood. +- Make tag component de-duplication consistent with search plugin de-duplication. + ## 1.2.1 - 2024-04-01 ### Changed diff --git a/CITATION.cff b/CITATION.cff index 4b875d4752..2ded51e8d2 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,8 +1,8 @@ # citation metadata for the template itself title: "Lab Website Template" -version: 1.2.1 -date-released: 2024-04-01 +version: 1.2.2 +date-released: 2024-06-05 url: "https://github.com/greenelab/lab-website-template" authors: - family-names: "Rubinetti" diff --git a/_cite/.cache/cache.db b/_cite/.cache/cache.db index 2ca6d980786a072bb0cc0da17cbe3bc7aadd1d82..96041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ugins/orcid.py b/_cite/plugins/orcid.py index 0017145942..2f7d04de19 100644 --- a/_cite/plugins/orcid.py +++ b/_cite/plugins/orcid.py @@ -1,6 +1,7 @@ import json from urllib.request import Request, urlopen from util import * +from manubot.cite.handlers import prefix_to_handler as manubot_prefixes def main(entry): @@ -35,16 +36,24 @@ def query(_id): # go through response structure and pull out ids e.g. doi:1234/56789 for work in response: # get list of ids - ids = get_safe(work, "external-ids.external-id", []) + ids = [] for summary in get_safe(work, "work-summary", []): ids = ids + get_safe(summary, "external-ids.external-id", []) - # prefer doi id type, or fallback to first id + # find first id of particular "relationship" type _id = next( - (id for id in ids if get_safe(id, "external-id-type", "") == "doi"), - ids[0] if len(ids) > 0 else {}, + ( + id + for id in ids + if get_safe(id, "external-id-relationship", "") + in ["self", "version-of", "part-of"] + ), + ids[0] if len(ids) > 0 else None, ) + if _id == None: + continue + # get id and id-type from response id_type = get_safe(_id, "external-id-type", "") id_value = get_safe(_id, "external-id-value", "") @@ -52,20 +61,11 @@ def query(_id): # create source source = {"id": f"{id_type}:{id_value}"} - # if not a doi, Manubot likely can't cite, so keep citation details - if id_type != "doi": + # if not an id type that Manubot can cite, keep citation details + if id_type not in manubot_prefixes: # get summaries summaries = get_safe(work, "work-summary", []) - # sort summary entries by most recent - summaries = sorted( - summaries, - key=lambda summary: (get_safe(summary, "last-modified-date.value", 0)) - or get_safe(summary, "created-date.value", 0) - or 0, - reverse=True, - ) - # get first summary with defined sub-value def first(get_func): return next( diff --git a/_data/citations.yaml b/_data/citations.yaml index db4e4b0036..0e483e3a9d 100644 --- a/_data/citations.yaml +++ b/_data/citations.yaml @@ -141,11 +141,11 @@ - Jacob D Krol - Joseph T Burke - Samuel Z Chen - - Lo Sosinski + - Lo M Sosinski - Faisal S Alquaddoomi - Evan P Brenner - Ethan P Wolfe - - Vince P Rubinetti + - Vincent P Rubinetti - Shaddai Amolitos - Kellen M Reason - John B Johnston diff --git a/_includes/list.html b/_includes/list.html index 92026fd511..cdb030c956 100644 --- a/_includes/list.html +++ b/_includes/list.html @@ -24,6 +24,7 @@ {% include {{ include.component | append: ".html" }} + affiliation=d.affiliation author=d.author authors=d.authors buttons=d.buttons diff --git a/_includes/portrait.html b/_includes/portrait.html index 3b77f3d168..3986db06d8 100644 --- a/_includes/portrait.html +++ b/_includes/portrait.html @@ -7,6 +7,8 @@ {% assign member = include %} {% endif %} +{% assign type = site.data.types[member.role] %} +
+ {% if type %} + {% include icon.html icon=type.icon %} + {% endif %} + - {% if member.name or member.role or member.description %} - - {% if member.name %} - - {{ member.name }} - - {% endif %} + {% if member.name %} + + {{ member.name }} + + {% endif %} + + {% if member.description or type %} + + {{ member.description | default: type.description }} + + {% endif %} - {% if member.role or member.description %} - - {% assign type = site.data.types[member.role] %} - {% include icon.html icon=type.icon %} - {{ member.description | default: type.description }} - - {% endif %} + {% if member.affiliation %} + + {{ member.affiliation }} {% endif %} diff --git a/_includes/tags.html b/_includes/tags.html index fb16266d50..4f92729dae 100644 --- a/_includes/tags.html +++ b/_includes/tags.html @@ -1,8 +1,12 @@ {% assign tags = include.tags | object_items | join: "," + | downcase | split: "," | array_filter + | join: "," + | regex_replace: "\s+", "-" + | split: "," | uniq %} {% assign link = include.link | default: page.dir | absolute_url %} diff --git a/_members/jane-smith.md b/_members/jane-smith.md index f4cae89631..c60188ecd7 100644 --- a/_members/jane-smith.md +++ b/_members/jane-smith.md @@ -2,6 +2,7 @@ name: Jane Smith image: images/photo.jpg role: pi +affiliation: University of Colorado aliases: - J. Smith - J Smith diff --git a/_scripts/search.js b/_scripts/search.js index fa23ca4c21..3d1da24045 100644 --- a/_scripts/search.js +++ b/_scripts/search.js @@ -38,7 +38,7 @@ // normalize tag string for comparison window.normalizeTag = (tag) => - tag.trim().toLowerCase().replaceAll(/-|\s+/g, " "); + tag.trim().toLowerCase().replaceAll(/\s+/g, "-"); // get data attribute contents of element and children const getAttr = (element, attr) => diff --git a/_styles/portrait.scss b/_styles/portrait.scss index fa0c03960b..d91785721c 100644 --- a/_styles/portrait.scss +++ b/_styles/portrait.scss @@ -11,7 +11,6 @@ justify-content: center; align-items: center; flex-direction: column; - gap: 20px; margin: 20px; width: 175px; max-width: calc(100% - 20px - 20px); @@ -29,25 +28,42 @@ text-align: left; } -.portrait-image { - width: 100%; +.portrait .icon { + position: absolute; + left: 0; + top: 0; + display: flex; + justify-content: center; + align-items: center; + width: calc(20px + 10%); aspect-ratio: 1 / 1; border-radius: 999px; - object-fit: cover; + background: var(--background); box-shadow: var(--shadow); + transform: translate(14%, 14%); } -.portrait[data-style="tiny"] .portrait-image { - width: 50px; +.portrait[data-style="small"] .icon { + left: -2px; + top: -2px; } -.portrait[data-style="tiny"] .portrait-role { +.portrait[data-style="tiny"] .icon { display: none; } -.portrait-text { - display: flex; - flex-direction: column; +.portrait-image { + width: 100%; + margin-bottom: 20px; + aspect-ratio: 1 / 1; + border-radius: 999px; + object-fit: cover; + box-shadow: var(--shadow); +} + +.portrait[data-style="tiny"] .portrait-image { + width: 50px; + margin: 0; } .portrait-name { @@ -55,22 +71,9 @@ font-weight: var(--semi-bold); } -.portrait-role .icon { - position: absolute; - left: 0; - top: 0; - display: flex; - justify-content: center; - align-items: center; - width: calc(20px + 10%); - aspect-ratio: 1 / 1; - border-radius: 999px; - background: var(--background); - box-shadow: var(--shadow); - transform: translate(14%, 14%); -} - -.portrait[data-style="small"] .portrait-role .icon { - left: -2px; - top: -2px; +.portrait[data-style="tiny"] { + .portrait-description, + .portrait-affiliation { + display: none; + } }