Skip to content
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

v1.2.2 #257

Merged
merged 13 commits into from
Jun 5, 2024
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,19 @@

Reference: common-changelog.org

## 1.2.2 - 2024-05-07

### Added

- Add `affiliation` member portrait field.

### Changed

- Simplify portrait component under-the-hood.
- Make tag component de-duplication consistent with search plugin de-duplication.
- Expand list of supported Manubot identifiers and thus keep ORCID API details less often.
- Change order and type of preferred ids from ORCID API.

## 1.2.1 - 2024-04-01

### Changed
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -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-05-07
url: "https://github.com/greenelab/lab-website-template"
authors:
- family-names: "Rubinetti"
Binary file modified _cite/.cache/cache.db
Binary file not shown.
22 changes: 16 additions & 6 deletions _cite/plugins/orcid.py
vincerubinetti marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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,25 +36,34 @@ 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", [])
ids = ids + get_safe(work, "external-ids.external-id", [])

# prefer doi id type, or fallback to first id
# prefer particular "relationship" type, or fallback to first id
_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"]
vincerubinetti marked this conversation as resolved.
Show resolved Hide resolved
),
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", "")

# 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 list(manubot_prefixes.keys()):
vincerubinetti marked this conversation as resolved.
Show resolved Hide resolved
# get summaries
summaries = get_safe(work, "work-summary", [])

1 change: 1 addition & 0 deletions _includes/list.html
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@

{%
include {{ include.component | append: ".html" }}
affiliation=d.affiliation
author=d.author
authors=d.authors
buttons=d.buttons
34 changes: 20 additions & 14 deletions _includes/portrait.html
Original file line number Diff line number Diff line change
@@ -7,6 +7,8 @@
{% assign member = include %}
{% endif %}

{% assign type = site.data.types[member.role] %}

<div class="portrait-wrapper">
<a
{% if page.slug != member.slug %}
@@ -16,6 +18,10 @@
data-style="{{ include.style }}"
aria-label="{{ member.name | default: "member link" }}"
>
{% if type %}
{% include icon.html icon=type.icon %}
{% endif %}

<img
src="{{ member.image | relative_url }}"
class="portrait-image"
@@ -24,21 +30,21 @@
{% include fallback.html %}
>

{% if member.name or member.role or member.description %}
<span class="portrait-text">
{% if member.name %}
<span class="portrait-name">
{{ member.name }}
</span>
{% endif %}
{% if member.name %}
<span class="portrait-name">
{{ member.name }}
</span>
{% endif %}

{% if member.description or type %}
<span class="portrait-description">
{{ member.description | default: type.description }}
</span>
{% endif %}

{% if member.role or member.description %}
<span class="portrait-role">
{% assign type = site.data.types[member.role] %}
{% include icon.html icon=type.icon %}
<span>{{ member.description | default: type.description }}</span>
</span>
{% endif %}
{% if member.affiliation %}
<span class="portrait-affiliation">
{{ member.affiliation }}
</span>
{% endif %}
</a>
4 changes: 4 additions & 0 deletions _includes/tags.html
Original file line number Diff line number Diff line change
@@ -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 %}
1 change: 1 addition & 0 deletions _members/jane-smith.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
name: Jane Smith
image: images/photo.jpg
role: pi
affiliation: University of Colorado
aliases:
- J. Smith
- J Smith
2 changes: 1 addition & 1 deletion _scripts/search.js
Original file line number Diff line number Diff line change
@@ -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) =>
59 changes: 31 additions & 28 deletions _styles/portrait.scss
Original file line number Diff line number Diff line change
@@ -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,48 +28,52 @@
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 {
font-family: var(--heading);
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;
}
}