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.3.1 #289

Merged
merged 6 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Install Ruby packages
if: github.event.action != 'closed'
uses: ruby/setup-ruby@v1.172.0
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Ruby packages
uses: ruby/setup-ruby@v1.172.0
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: true
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/update-citations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ jobs:
run: python _cite/cite.py
timeout-minutes: 15

- name: Commit cache
if: failure()
uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: "**/.cache/**"
commit_message: "Commit cache"

- name: Check if citations changed
if: github.event.action != 'closed'
id: changed
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ _site
vendor
debug.log
__pycache__
.cache
!cache.db
.DS_STORE
.env*
package.json
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Reference: common-changelog.org

## 1.3.1 - 2024-11-11

### Changed

- Update and improve workflows for building site and citations
- Escape user inputs better in rare edge cases

## 1.3.0 - 2024-08-16

### Changed
Expand Down
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.3.0
date-released: 2024-08-16
version: 1.3.1
date-released: 2024-11-11
url: "https://github.com/greenelab/lab-website-template"
authors:
- family-names: "Rubinetti"
Expand Down
Binary file modified _cite/.cache/cache.db
Binary file not shown.
2 changes: 1 addition & 1 deletion _includes/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% if include.flip %}
data-flip
{% endif %}
aria-label="{{ button.tooltip | default: button.icon | default: "button" | xml_escape }}"
aria-label="{{ button.tooltip | default: button.icon | default: "button" | regex_strip }}"
>
{% include icon.html icon=button.icon %}
{% if button.text and button.text != "" %}
Expand Down
10 changes: 5 additions & 5 deletions _includes/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<div class="card" data-style="{{ include.style }}">
<a
{% if include.link %}
href="{{ include.link | relative_url | xml_escape }}"
href="{{ include.link | relative_url | uri_escape }}"
{% endif %}
aria-label="{{ include.title | default: "card link" | xml_escape }}"
aria-label="{{ include.title | default: "card link" | regex_strip }}"
class="card-image"
>
<img
src="{{ include.image | relative_url | xml_escape }}"
alt="{{ include.title | default: "card image" | xml_escape }}"
src="{{ include.image | relative_url | uri_escape }}"
alt="{{ include.title | default: "card image" | regex_strip }}"
loading="lazy"
{% include fallback.html %}
>
Expand All @@ -19,7 +19,7 @@
{% if include.title %}
<a
{% if include.link %}
href="{{ include.link | relative_url | xml_escape }}"
href="{{ include.link | relative_url | uri_escape }}"
{% endif %}
{% if include.tooltip %}
data-tooltip="{{ include.tooltip | xml_escape }}"
Expand Down
8 changes: 4 additions & 4 deletions _includes/citation.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
{% if include.style == "rich" %}
<a
{% if citation.link %}
href="{{ citation.link | relative_url | xml_escape }}"
href="{{ citation.link | relative_url | uri_escape }}"
{% endif %}
class="citation-image"
aria-label="{{ citation.title | default: "citation link" | xml_escape }}"
aria-label="{{ citation.title | default: "citation link" | regex_strip }}"
>
<img
src="{{ citation.image | relative_url | xml_escape }}"
alt="{{ citation.title | default: "citation image" | xml_escape }}"
src="{{ citation.image | relative_url | uri_escape }}"
alt="{{ citation.title | default: "citation image" | regex_strip }}"
loading="lazy"
{% include fallback.html %}
>
Expand Down
2 changes: 1 addition & 1 deletion _includes/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
data-dark="{{ dark }}"
{% endif %}
{% if background %}
style="--image: url('{{ image | relative_url | xml_escape }}')"
style="--image: url('{{ image | relative_url | uri_escape }}')"
{% endif %}
>
{{ section }}
Expand Down
8 changes: 4 additions & 4 deletions _includes/feature.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
>
<a
{% if include.link %}
href="{{ include.link | relative_url | xml_escape }}"
href="{{ include.link | relative_url | uri_escape }}"
{% endif %}
class="feature-image"
aria-label="{{ include.title | default: "feature link" | xml_escape }}"
aria-label="{{ include.title | default: "feature link" | regex_strip }}"
>
<img
src="{{ include.image | relative_url | xml_escape }}"
src="{{ include.image | relative_url | uri_escape }}"
loading="lazy"
alt="{{ include.title | default: "feature image" | xml_escape }}"
alt="{{ include.title | default: "feature image" | regex_strip }}"
{% include fallback.html %}
>
</a>
Expand Down
8 changes: 4 additions & 4 deletions _includes/figure.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<figure class="figure">
<a
{% if include.link %}
href="{{ include.link | relative_url | xml_escape }}"
href="{{ include.link | relative_url | uri_escape }}"
{% endif %}
class="figure-image"
aria-label="{{ include.caption | default: "figure link" | xml_escape }}"
aria-label="{{ include.caption | default: "figure link" | regex_strip }}"
>
<img
src="{{ include.image | relative_url | xml_escape }}"
src="{{ include.image | relative_url | uri_escape }}"
style="
width: {{ include.width | default: "auto" }};
max-height: {{ include.height | default: "unset" }};
"
alt="{{ include.caption | default: "figure image" | xml_escape }}"
alt="{{ include.caption | default: "figure image" | regex_strip }}"
loading="lazy"
{% include fallback.html %}
>
Expand Down
2 changes: 1 addition & 1 deletion _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<footer
class="background"
style="--image: url('{{ image | relative_url | xml_escape }}')"
style="--image: url('{{ image | relative_url | uri_escape }}')"
{% if dark == true or dark == false %}
data-dark="{{ dark }}"
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<header
class="background"
style="--image: url('{{ image | relative_url | xml_escape }}')"
style="--image: url('{{ image | relative_url | uri_escape }}')"
{% if dark == true or dark == false %}
data-dark="{{ dark }}"
{% endif %}
Expand All @@ -22,7 +22,7 @@
{% if svg %}
{{ svg | file_read }}
{% else %}
<img src="{{ logo | relative_url | xml_escape }}" alt="logo">
<img src="{{ logo | relative_url | uri_escape }}" alt="logo">
{% endif %}
</span>
{% endif %}
Expand All @@ -48,7 +48,7 @@
{% for page in pages %}
{% if page.nav %}
<a
href="{{ page.dir | relative_url | xml_escape }}"
href="{{ page.dir | relative_url | uri_escape }}"
data-tooltip="{{ page.nav.tooltip | xml_escape }}"
>
{{ page.title }}
Expand Down
26 changes: 13 additions & 13 deletions _includes/meta.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% assign filename = page.path | split: "/" | last %}
{% if page.name and page.name != filename %}
{% assign title = page.name | xml_escape %}
{% assign title = page.name %}
{% elsif page.title %}
{% assign title = page.title | xml_escape %}
{% assign title = page.title %}
{% else %}
{% assign title = nil %}
{% endif %}
Expand All @@ -14,11 +14,11 @@
{% if site.title %}
{% assign fulltitle = fulltitle | push: site.title %}
{% endif %}
{% assign fulltitle = fulltitle | join: " | " | xml_escape %}
{% assign fulltitle = fulltitle | join: " | " %}

{% assign subtitle = site.subtitle | xml_escape %}
{% assign subtitle = site.subtitle %}

{% assign description = page.description | default: site.description | xml_escape %}
{% assign description = page.description | default: site.description %}
{% if site.subtitle %}
{% capture description -%}
{{ site.subtitle }}. {{ description }}
Expand Down Expand Up @@ -47,24 +47,24 @@

<link rel="icon" href="{{ icon }}">

<meta name="title" content="{{ title }}">
<meta name="description" content="{{ description }}">
<meta name="title" content="{{ title | xml_escape }}">
<meta name="description" content="{{ description | xml_escape }}">

<meta property="og:title" content="{{ title }}">
<meta property="og:site_title" content="{{ site.title }}">
<meta property="og:description" content="{{ description }}">
<meta property="og:title" content="{{ title | xml_escape }}">
<meta property="og:site_title" content="{{ site.title | xml_escape }}">
<meta property="og:description" content="{{ description | xml_escape }}">
<meta property="og:url" content="{{ url }}">
<meta property="og:image" content="{{ share }}">
<meta property="og:locale" content="en_US">

<meta property="twitter:title" content="{{ title }}">
<meta property="twitter:description" content="{{ description }}">
<meta property="twitter:title" content="{{ title | xml_escape }}">
<meta property="twitter:description" content="{{ description | xml_escape }}">
<meta property="twitter:url" content="{{ url }}">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:image" content="{{ share }}">

{% if page.author %}
<meta name="author" content="{{ page.author }}">
<meta name="author" content="{{ page | xml_escape.author }}">
<meta property="og:type" content="article">
<meta property="og:updated_time" content="{{ updated }}">
<meta property="article:published_time" content="{{ published }}">
Expand Down
6 changes: 3 additions & 3 deletions _includes/portrait.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
<div class="portrait-wrapper">
<a
{% if page.slug != member.slug %}
href="{{ member.url | relative_url | xml_escape }}"
href="{{ member.url | relative_url | uri_escape }}"
{% endif %}
class="portrait"
data-style="{{ include.style }}"
aria-label="{{ member.name | default: "member link" | xml_escape }}"
aria-label="{{ member.name | default: "member link" | regex_strip }}"
>
{% if type %}
{% include icon.html icon=type.icon %}
{% endif %}

<img
src="{{ member.image | relative_url | xml_escape }}"
src="{{ member.image | relative_url | uri_escape }}"
class="portrait-image"
alt="member portrait"
loading="lazy"
Expand Down
13 changes: 6 additions & 7 deletions _includes/post-excerpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@

{% if image %}
<a
href="{{ url | relative_url | xml_escape }}"
href="{{ url | relative_url | uri_escape }}"
class="post-excerpt-image"
aria-label="{{ title | default: "excerpt link" | xml_escape }}"
aria-label="{{ title | default: "excerpt link" | regex_strip }}"
>
<img
src="{{ image | relative_url | xml_escape }}"
alt="{{ title | default: "excerpt image" | xml_escape }}"
src="{{ image | relative_url | uri_escape }}"
alt="{{ title | default: "excerpt image" | regex_strip }}"
loading="lazy"
{% include fallback.html %}
>
</a>
{% endif %}

<div class="post-excerpt-text">
<a href="{{ url | relative_url | xml_escape }}">{{ title }}</a>
<a href="{{ url | relative_url | uri_escape }}">{{ title }}</a>

{%
include post-info.html
Expand All @@ -48,11 +48,10 @@
| strip_html
%}
{% assign search = post.content
| strip_html
| strip_newlines
| regex_strip
%}
<p data-search="{{ search | xml_escape }}">
<p data-search="{{ search }}">
{{ excerpt }}
</p>
</div>
Expand Down
4 changes: 2 additions & 2 deletions _includes/post-nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<span>
{% if include.post.previous %}
{% include icon.html icon="fa-solid fa-angle-left" %} Previous post<br>
<a href="{{ include.post.previous.url | relative_url | xml_escape }}">
<a href="{{ include.post.previous.url | relative_url }}">
{{ include.post.previous.title }}
</a>
{% endif %}
</span>
<span>
{% if include.post.next %}
Next post {% include icon.html icon="fa-solid fa-angle-right" %}<br>
<a href="{{ include.post.next.url | relative_url | xml_escape }}">
<a href="{{ include.post.next.url | relative_url }}">
{{ include.post.next.title }}
</a>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions _layouts/member.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{%- endcapture %}

<p class="center">
<a href="{{ search | relative_url | xml_escape }}">
<a href="{{ search | relative_url | uri_escape }}">
Search for {{ page.name | default: page.title }}'s papers on the Research page
</a>
</p>
Expand All @@ -44,7 +44,7 @@

<!--
<p class="center">
<a href="{{ search | relative_url | xml_escape }}">
<a href="{{ search | relative_url | uri_escape }}">
See {{ page.name | default: page.title }}'s posts on the Blog page
</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion _plugins/regex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def regex_replace(string, search, replace)

# strip all non-letter and non-number characters from string
def regex_strip(string)
return string.gsub(/[^\p{L}\p{N}]/u, " ")
return string.gsub(/[^\p{L}\p{N}.,;:-]/u, " ").gsub(/\s+/, " ").strip
end
end
end
Expand Down