From 78fad78d9e071c51780d8a499609cad20afbee87 Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Fri, 17 Mar 2023 19:56:28 -0400 Subject: [PATCH] v1.1.0 (#166) --- .docker/Dockerfile | 30 ++++ .docker/entrypoint.sh | 24 +++ .docker/run.sh | 37 +++++ .github/pull_request_template.md | 4 +- .github/workflows/build-preview.yaml | 2 +- .github/workflows/build-site.yaml | 2 +- .github/workflows/versioning.yaml | 24 +-- CHANGELOG.md | 19 +++ CITATION.cff | 4 +- Gemfile.lock | 11 +- README.md | 2 +- _cite/.cache/cache.db | Bin 53248 -> 61440 bytes _config.yaml | 1 - _data/citations.yaml | 4 +- _data/sources.yaml | 2 +- _data/types.yaml | 28 +++- _includes/alert.html | 10 ++ _includes/button.html | 5 +- _includes/card.html | 25 +-- _includes/citation.html | 12 +- _includes/content.html | 4 +- _includes/feature.html | 11 +- _includes/figure.html | 12 +- _includes/fonts.html | 2 +- _includes/footer.html | 5 +- _includes/header.html | 6 +- _includes/icon.html | 8 +- _includes/orcid.svg | 7 - _includes/portrait.html | 16 +- _includes/search-box.html | 7 +- _includes/site-search.html | 2 +- _plugins/misc.rb | 2 +- _scripts/anchors.js | 11 +- _scripts/fetch-tags.js | 6 +- _scripts/search.js | 34 ++-- _scripts/tooltip.js | 9 + _styles/alert.scss | 37 +++++ _styles/feature.scss | 10 +- _styles/figure.scss | 4 +- _styles/float.scss | 12 ++ _styles/footer.scss | 1 + _styles/grid.scss | 2 +- _styles/icon.scss | 11 +- _styles/link.scss | 4 + _styles/portrait.scss | 31 +++- contact/index.md | 2 +- team/index.md | 8 +- testbed.md | 236 +++++++++++++++++---------- 48 files changed, 531 insertions(+), 215 deletions(-) create mode 100644 .docker/Dockerfile create mode 100755 .docker/entrypoint.sh create mode 100755 .docker/run.sh create mode 100644 _includes/alert.html delete mode 100644 _includes/orcid.svg create mode 100644 _styles/alert.scss 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 13745ac8873f4b7406db63761eb1543b51c955e0..5e29960848b605d7dad695a45706cc13f2b0990b 100644 GIT binary patch delta 1238 zcmbVLU1%It6ux)vj5FEUnY-CF+5D7twhs~)H`Dz3gSZLkgSJ9Qg)9wrnC_0*X=ZlT znb|hg;%3lbA^YGuh*+cuEp0*4X1$5^G1VurEm)+GzUYHR5FacQ@kQ~@Cb1R!q8H}O zopbK_&UepuX7LlW_yc;cpA!K9xT)mnW^m@ER_P`dAK|F4Z8$QS*ucH=_aGsk1@aa7 zmV90Q5_e(--;&SDcS)bJEZ6s;4C|S17@B3;rawWGJ0z5bMWQV<43EdC zODLPZ$IEmRWzeHZ`aH1YU-bL5vACY#$uO_>jf|tA4)1l#^bO5BQ7M*Pr{dJSbTEc; z?6%*w^{N&zVkwv2U^Hx~{e2@yWwzr*y;!E%^ne1og5mJ0nuaRbR1+9p3V(iX9Il3$ ze0TjaMj7TlIk3`;#+Zk317D=k&{o7YE81%&<=t+`mB{~Zvf%SBl-u$DO%|;8pphN# zQKu%l72VQor(}S&@M^w$j68s**L+7irWb298+;b=yx(NdiWFz@FOd+K#3z2lyCYr1 zPHJKjH60v7EtIm<0$Iw^x!5BK($W;StO$@~PG5#3KfMd?jp2Jh!utWPwCK zg3sdycCmpA_#?cZraq3PIO5^t=H73=n-h(hE?l#230qXyR z;07Muf~ZFj1E~mtH0ldV4Dr)I`b|8;Pq&%_EEzwy3z4;N4zT3Rr)8EM1?*_6nPp%2 z@Wmts!IZ%ByZ{6UR$`0X2Q$$<>1s@?WydyDw^pebu6o>Y=T%ETk~?l3@#s9|e8a9< zx^ILhp5K?=Emq|gy8?`V}Mh{+|KJWkS@BjRtclaY5 z9)owPC^rDWn+-Uy*4g_zr z>76h{YSKlKm!+hnM{OgQ7y1c7H5A?B;$S76lr&A$oCucF2}#$Stlbm{*4za{gkZ>W ziFNB9b33e|^;i!tDRFVgYldKm*7TSzX}Tn6ws%<*5tp<+zF!jhWU<1mtAc+he1A&S zRY8@h3Uj{|2?rW$VS`H>kR@H@wF`=nNU4fyXnu1aJV37N$z-gbFC-%E36VGa?GtS_z2#Do=!_|oGDh8$bcKCFaIjxA|7 zvw>%R*igDjN(z5ol1uJjrl9{F7EG7J0~`8gSn#w0Hg2fBs==g`n9L{DxCowD^ATUu z)E2jxp{x90OfZZjm@MS{{p{c|Wv@-5uXY7q?1_Ft+c>*rkX_tfySON~a}IdGO+c@> zf6&(~Hh&4%cP}|`*Q+xmNnZwC+3abHTaX*j6mZ!D06b;3(!?+|a-w(yAag8yN)uCB zcu-OVF=d>S6j9eDYvAZ1n!DI5i_KBM<&5#4 + {% 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 @@