Skip to content

Commit

Permalink
v1.3.1 (#289)
Browse files Browse the repository at this point in the history
Closes #288
Closes #287 
Closes #285

New template version checklist:

- [x] I have updated CITATION and CHANGELOG as appropriate.
- [x] I have updated lab-website-template-docs as appropriate.
- [x] I have checked the testbed as appropriate.

---

- use latest major version of setup-ruby gh-action
- run "commit cache" step if citations step fails so that progress
(successful citations) will be saved
- replace xml_escape filter with appropriate escapes for each situation,
and slightly modify regex_strip filter to allow some basic punctuation
  • Loading branch information
vincerubinetti authored Nov 13, 2024
1 parent 52db24e commit 2849c60
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 57 deletions.
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

0 comments on commit 2849c60

Please sign in to comment.