diff --git a/.docker/Dockerfile b/.docker/Dockerfile new file mode 100644 index 0000000000..dd46fb4b5a --- /dev/null +++ b/.docker/Dockerfile @@ -0,0 +1,30 @@ +# start with official ruby docker image as base +FROM ruby:3.1.2 + +# set working directory within container +WORKDIR /usr/src/app + +# pull in ruby (jekyll) and python (cite process) package info +COPY Gemfile Gemfile.lock _cite/requirements.txt ./ + +# install ruby packages +RUN VERSION=$(grep -A 1 'BUNDLED WITH' Gemfile.lock | tail -n 1 | xargs); \ + gem install bundler --version ${VERSION} && \ + bundle _${VERSION}_ install + +# install python +RUN apt update && apt install -y python3 python3-pip + +# install python packages +RUN python3 -m pip install --upgrade --requirement requirements.txt + +# install python package for listening for file changes +RUN pip install "watchdog[watchmedo]" + +# ports used by jekyll +EXPOSE 4000 +EXPOSE 35729 + +# run jekyll and cite process +COPY .docker/entrypoint.sh /var +CMD [ "/var/entrypoint.sh" ] diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh new file mode 100755 index 0000000000..2b734e3e3a --- /dev/null +++ b/.docker/entrypoint.sh @@ -0,0 +1,24 @@ +#! /bin/bash + +# print folder contents for debugging +echo "Contents:" +echo "" +ls +echo "" + +# run jekyll serve in hot-reload mode. +# rerun whenever _config.yaml changes (jekyll hot-reload doesn't work with this file). +watchmedo auto-restart \ + --debug-force-polling \ + --patterns="_config.yaml" \ + --signal SIGTERM \ + -- bundle exec jekyll serve --open-url --force_polling --livereload --trace --host=0.0.0.0 \ + | sed 's/0.0.0.0/localhost/g' & + +# run cite process. +# rerun whenever _data files change. +watchmedo shell-command \ + --debug-force-polling \ + --recursive \ + --command="python3 _cite/cite.py" \ + --patterns="_data/sources*;_data/orcid*;_data/pubmed*;_data/google-scholar*" \ diff --git a/.docker/run.sh b/.docker/run.sh new file mode 100755 index 0000000000..34ffd0533d --- /dev/null +++ b/.docker/run.sh @@ -0,0 +1,37 @@ +#! /bin/bash + +# name of image +IMAGE=lab-website-renderer:latest + +# name of running container +CONTAINER=lab-website-renderer + +# choose platform flag +PLATFORM="" + +# default vars +DOCKER_RUN="docker run" +WORKING_DIR=$(pwd) + +# fix windows faux linux shells/tools +if [[ $OSTYPE == msys* ]] || [[ $OSTYPE == cygwin* ]]; then + DOCKER_RUN="winpty docker run" + WORKING_DIR=$(cmd //c cd) +fi + +# build docker image +docker build ${PLATFORM} \ + --tag ${IMAGE} \ + --file ./.docker/Dockerfile . && \ + +# run built docker image +${DOCKER_RUN} ${PLATFORM} \ + --name ${CONTAINER} \ + --init \ + --rm \ + --interactive \ + --tty \ + --publish 4000:4000 \ + --publish 35729:35729 \ + --volume "${WORKING_DIR}:/usr/src/app" \ + ${IMAGE} "$@" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c1339b18f4..6aaf76bdc2 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,8 +6,8 @@ You are about to open this pull request against THE TEMPLATE ITSELF. You probabl FOR THE TEMPLATE MAINTAINER(S) -Checklist: +New template version checklist: -- [ ] I have updated CITATION and CHANGELOG. +- [ ] I have updated CITATION and CHANGELOG as appropriate. - [ ] I have updated lab-website-template-docs as appropriate. - [ ] I have checked the testbed as appropriate. diff --git a/.github/workflows/build-preview.yaml b/.github/workflows/build-preview.yaml index c449856fcd..f363fe938e 100644 --- a/.github/workflows/build-preview.yaml +++ b/.github/workflows/build-preview.yaml @@ -47,7 +47,7 @@ jobs: - name: Build preview version of site if: github.event.action != 'closed' run: | - bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}/${{ env.PREVIEWS_FOLDER }}/pr-${{ github.event.number }}" + JEKYLL_ENV=production bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}/${{ env.PREVIEWS_FOLDER }}/pr-${{ github.event.number }}" - name: Commit preview to Pages branch uses: rossjrw/pr-preview-action@v1 diff --git a/.github/workflows/build-site.yaml b/.github/workflows/build-site.yaml index 6d10739489..a7c36dd69d 100644 --- a/.github/workflows/build-site.yaml +++ b/.github/workflows/build-site.yaml @@ -40,7 +40,7 @@ jobs: - name: Build live version of site run: | - bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}" + JEKYLL_ENV=production bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}" - name: Commit live site to Pages branch uses: JamesIves/github-pages-deploy-action@v4 diff --git a/.github/workflows/versioning.yaml b/.github/workflows/versioning.yaml index f096235847..e76dc24534 100644 --- a/.github/workflows/versioning.yaml +++ b/.github/workflows/versioning.yaml @@ -57,7 +57,7 @@ jobs: .split(/^##?#?#?/m) .map((section) => { const [heading, ...body] = section.split("\n"); - return [heading.trim(), body.join("\n").trim()]; + return { heading, body: body.join("\n") }; }); // check version @@ -71,8 +71,8 @@ jobs: // check changelog const newSection = changelog.find( - ([heading, body]) => - heading.includes(newVersion) && heading.includes(newDate) && body + ({ heading, body }) => + heading.includes(newVersion) && heading.includes(newDate) && body.trim() ); if (!newSection) throw Error("Changelog not updated or not valid"); @@ -109,27 +109,21 @@ jobs: .split(/^##?#?#?/m) .map((section) => { const [heading, ...body] = section.split("\n"); - return [heading.trim(), body.join("\n").trim()]; + return { heading, body: body.join("\n") }; }); // find changelog body for version const body = changelog.find( - ([heading]) => heading.includes(version) && heading.includes(date) + ({ heading }) => heading.includes(version) && heading.includes(date) )?.body || ""; return { version, body }; - - name: Create a tag - id: tag - uses: mathieudutour/github-tag-action@v6.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - custom_tag: ${{ fromJson(steps.version.outputs.result).version }} - - - name: Create a GitHub release + - name: Create tag and GitHub release uses: ncipollo/release-action@v1 with: - tag: ${{ fromJson(steps.version.outputs.result).version }} - name: ${{ fromJson(steps.version.outputs.result).version }} + commit: ${{ github.ref }} + tag: v${{ fromJson(steps.version.outputs.result).version }} + name: v${{ fromJson(steps.version.outputs.result).version }} body: ${{ fromJson(steps.version.outputs.result).body }} diff --git a/CHANGELOG.md b/CHANGELOG.md index cc0b7b3ae5..2c941fa8ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,25 @@ Reference: common-changelog.org +## 1.1.0 - 2023-03-17 + +Add alert component, Docker support, accessibility fixes. + +### Changed + +- Fix Lighthouse accessibility issues. +- De-href components when link isn't provided (no hand cursor icon on hover or nav on click). +- In search script, limit highlights by total count instead of char length. +- Grid and link style tweaks. +- Take ORCID icon from Font Awesome. +- Misc bug fixes in tags script, float component. + +### Added + +- Add Docker configuration and scripts for local previewing. +- Add alert component and types. +- Role icon in portrait component hoisted to top left. + ## 1.0.0 - 2023-02-28 First official release. diff --git a/CITATION.cff b/CITATION.cff index 62006acb90..1365e8e624 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,8 +1,8 @@ # citation metadata for the template itself title: "Lab Website Template" -version: 1.0.0 -date-released: 2023-02-28 +version: 1.1.0 +date-released: 2023-03-17 url: "https://github.com/greenelab/lab-website-template" authors: - family-names: "Rubinetti" diff --git a/Gemfile.lock b/Gemfile.lock index cb7453394d..d719aa93fe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,9 +10,11 @@ GEM http_parser.rb (~> 0) eventmachine (1.2.7) ffi (1.15.5) + ffi (1.15.5-x64-mingw-ucrt) forwardable-extended (2.6.0) gemoji (3.0.1) google-protobuf (3.22.0-arm64-darwin) + google-protobuf (3.22.0-x64-mingw-ucrt) http_parser.rb (0.8.0) i18n (1.12.0) concurrent-ruby (~> 1.0) @@ -59,6 +61,10 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) + mini_portile2 (2.8.1) + nokogiri (1.13.10) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) nokogiri (1.13.10-arm64-darwin) racc (~> 1.4) pathutil (0.16.2) @@ -75,6 +81,8 @@ GEM safe_yaml (1.0.5) sass-embedded (1.58.3-arm64-darwin) google-protobuf (~> 3.21) + sass-embedded (1.58.3-x64-mingw-ucrt) + google-protobuf (~> 3.21) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) unicode-display_width (2.4.2) @@ -85,6 +93,7 @@ PLATFORMS linux universal-darwin-21 universal-darwin-22 + x64-mingw-ucrt x64-mingw32 x64-unknown x86_64-linux @@ -99,4 +108,4 @@ DEPENDENCIES webrick (~> 1.7) BUNDLED WITH - 2.4.7 + 2.4.7 diff --git a/README.md b/README.md index d8bac4da8b..29bf9a24af 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Spend less time worrying about managing a website and citations, and more time r 👇👇 **Get Started** 👇👇 -[**📚 Documentation 📚**](https://greene-lab.gitbook.io/lab-website-template-docs) +[**Documentation**](https://greene-lab.gitbook.io/lab-website-template-docs) ## Key Features diff --git a/_cite/.cache/cache.db b/_cite/.cache/cache.db index 13745ac887..5e29960848 100644 Binary files a/_cite/.cache/cache.db and b/_cite/.cache/cache.db differ diff --git a/_config.yaml b/_config.yaml index a591c3e9a7..050986828a 100644 --- a/_config.yaml +++ b/_config.yaml @@ -12,7 +12,6 @@ links: google-scholar: ETJoidYAAAAJ github: your-lab twitter: YourLabHandle - instagram: YourLabHandle youtube: YourLabChannel ### jekyll settings diff --git a/_data/citations.yaml b/_data/citations.yaml index b433cd7e77..80e8564c01 100644 --- a/_data/citations.yaml +++ b/_data/citations.yaml @@ -54,8 +54,8 @@ plugin: sources.py file: sources.yaml type: paper - description: Lorem ipsum _dolor sit amet_, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. + description: Lorem ipsum _dolor_ **sit amet**, consectetur adipiscing elit, sed + do eiusmod tempor incididunt ut labore et dolore magna aliqua. image: https://journals.plos.org/ploscompbiol/article/figure/image?size=inline&id=info:doi/10.1371/journal.pcbi.1007128.g001&rev=2 buttons: - type: manubot diff --git a/_data/sources.yaml b/_data/sources.yaml index a1ddfed372..62cd922079 100644 --- a/_data/sources.yaml +++ b/_data/sources.yaml @@ -1,6 +1,6 @@ - id: doi:10.1371/journal.pcbi.1007128 type: paper - description: Lorem ipsum _dolor sit amet_, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + description: Lorem ipsum _dolor_ **sit amet**, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. date: 2020-12-4 image: https://journals.plos.org/ploscompbiol/article/figure/image?size=inline&id=info:doi/10.1371/journal.pcbi.1007128.g001&rev=2 buttons: diff --git a/_data/types.yaml b/_data/types.yaml index e733fee37b..2909b0ab1b 100644 --- a/_data/types.yaml +++ b/_data/types.yaml @@ -73,7 +73,7 @@ search: # social media orcid: - icon: orcid.svg + icon: fa-brands fa-orcid text: ORCID tooltip: ORCID link: https://orcid.org/$VALUE @@ -120,6 +120,32 @@ linkedin: tooltip: LinkedIn link: https://www.linkedin.com/in/$VALUE +# alerts + +tip: + icon: fa-solid fa-lightbulb + color: "#d946ef" + +help: + icon: fa-solid fa-circle-question + color: "#6366f1" + +info: + icon: fa-solid fa-circle-info + color: "#0ea5e9" + +success: + icon: fa-solid fa-circle-check + color: "#22c55e" + +warning: + icon: fa-solid fa-circle-exclamation + color: "#F59E0B" + +error: + icon: fa-solid fa-ban + color: "#ef4444" + # publications paper: diff --git a/_includes/alert.html b/_includes/alert.html new file mode 100644 index 0000000000..6fc9878975 --- /dev/null +++ b/_includes/alert.html @@ -0,0 +1,10 @@ +{% assign color = site.data.types[include.type].color | default: "#808080" %} +
+ {% assign icon = site.data.types[include.type].icon + | default: "fa-solid fa-circle-info" + %} + {% include icon.html icon=icon %} +
+ {{ include.content | markdownify }} +
+
diff --git a/_includes/button.html b/_includes/button.html index 913ab811c6..8d1730d739 100644 --- a/_includes/button.html +++ b/_includes/button.html @@ -9,12 +9,11 @@ {% if button.tooltip %} data-tooltip="{{ button.tooltip }}" {% endif %} - {% if include.style %} - data-style="{{ include.style }}" - {% endif %} + data-style="{{ include.style }}" {% if include.flip %} data-flip {% endif %} + aria-label="{{ button.tooltip | default: button.icon | default: "button" }}" > {% include icon.html icon=button.icon %} {% if button.text and button.text != "" %} diff --git a/_includes/card.html b/_includes/card.html index 734782ac78..feb325cb94 100644 --- a/_includes/card.html +++ b/_includes/card.html @@ -1,32 +1,33 @@ -{% if include.link %} - {% assign tag = "a" %} -{% else %} - {% assign tag = "span" %} -{% endif %} - +{{ " " }}
- <{{ tag }} - href="{{ include.link | relative_url }}" + {{ include.title | default: - +
{% if include.title %} - <{{ tag }} - href="{{ include.link | relative_url }}" + {{ include.title }} - + {% endif %} {% if include.subtitle %} diff --git a/_includes/citation.html b/_includes/citation.html index 053b7a0a25..7387d3823a 100644 --- a/_includes/citation.html +++ b/_includes/citation.html @@ -7,9 +7,14 @@