diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh index 77c697aa..efe40476 100755 --- a/.docker/entrypoint.sh +++ b/.docker/entrypoint.sh @@ -1,10 +1,8 @@ #! /bin/bash # print folder contents for debugging -echo "Contents:" -echo "" +printf "\n\nContents:\n\n" ls -echo "" # run cite process python3 _cite/cite.py diff --git a/.github/DISCUSSION_TEMPLATE/general.yaml b/.github/DISCUSSION_TEMPLATE/general.yaml new file mode 100644 index 00000000..66b2c499 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/general.yaml @@ -0,0 +1,35 @@ +body: + - type: checkboxes + attributes: + label: Checks + options: + - label: I have searched **[the docs](https://greene-lab.gitbook.io/lab-website-template-docs)**, [existing issues](https://github.com/greenelab/lab-website-template/issues), and [existing discussions](https://github.com/greenelab/lab-website-template/discussions) for answers first. + required: true + + - type: input + id: repo + attributes: + label: Link to your website repo + description: "In almost all cases, **we cannot help you if you don't provide this**." + placeholder: ex. https://github.com/greenelab/greenelab.com + validations: + required: true + + - type: input + id: version + attributes: + label: Version of Lab Website Template you are using + description: See your `CITATION.cff` file. + placeholder: ex. 1.0.0 + validations: + required: true + + - type: textarea + id: description + attributes: + label: Description + description: | + Describe your issue in as much detail as possible. For example: What happened? What did you expect to happen? How can we reproduce the problem? What browser are you seeing the problem in? + placeholder: Description + validations: + required: true diff --git a/.github/DISCUSSION_TEMPLATE/q-a.yaml b/.github/DISCUSSION_TEMPLATE/q-a.yaml new file mode 100644 index 00000000..66b2c499 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/q-a.yaml @@ -0,0 +1,35 @@ +body: + - type: checkboxes + attributes: + label: Checks + options: + - label: I have searched **[the docs](https://greene-lab.gitbook.io/lab-website-template-docs)**, [existing issues](https://github.com/greenelab/lab-website-template/issues), and [existing discussions](https://github.com/greenelab/lab-website-template/discussions) for answers first. + required: true + + - type: input + id: repo + attributes: + label: Link to your website repo + description: "In almost all cases, **we cannot help you if you don't provide this**." + placeholder: ex. https://github.com/greenelab/greenelab.com + validations: + required: true + + - type: input + id: version + attributes: + label: Version of Lab Website Template you are using + description: See your `CITATION.cff` file. + placeholder: ex. 1.0.0 + validations: + required: true + + - type: textarea + id: description + attributes: + label: Description + description: | + Describe your issue in as much detail as possible. For example: What happened? What did you expect to happen? How can we reproduce the problem? What browser are you seeing the problem in? + placeholder: Description + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..7d0b7de5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: true +contact_links: + - name: ๐ฌ Start a discussion + url: https://github.com/greenelab/lab-website-template/discussions + about: I need help, I have a question, or other discussion. + - name: ๐ Docs issue + url: https://github.com/greenelab/lab-website-template-docs/issues + about: I have a question or issue related to the template documentation. diff --git a/.github/ISSUE_TEMPLATE/issue.yaml b/.github/ISSUE_TEMPLATE/issue.yaml new file mode 100644 index 00000000..d8125550 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue.yaml @@ -0,0 +1,38 @@ +name: ๐ Create an issue +description: I think I've discovered a bug, I want to request a feature/change, or other issue. + +body: + - type: checkboxes + attributes: + label: Checks + options: + - label: I have searched **[the docs](https://greene-lab.gitbook.io/lab-website-template-docs)**, [existing issues](https://github.com/greenelab/lab-website-template/issues), and [existing discussions](https://github.com/greenelab/lab-website-template/discussions) for answers first. + required: true + + - type: input + id: repo + attributes: + label: Link to your website repo + description: "In almost all cases, **we cannot help you if you don't provide this**." + placeholder: ex. https://github.com/greenelab/greenelab.com + validations: + required: true + + - type: input + id: version + attributes: + label: Version of Lab Website Template you are using + description: See your `CITATION.cff` file. + placeholder: ex. 1.0.0 + validations: + required: true + + - type: textarea + id: description + attributes: + label: Description + description: | + Describe your issue in as much detail as possible. For example: What happened? What did you expect to happen? How can we reproduce the problem? What browser are you seeing the problem in? + placeholder: Description + validations: + required: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 00a0e711..6aaf76bd 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,13 @@ -This website is based on the Lab Website Template. -See its documentation for working with this site: +STOP!!! -https://greene-lab.gitbook.io/lab-website-template-docs +You are about to open this pull request against THE TEMPLATE ITSELF. You probably meant to open it against your own website repo. + +--- + +FOR THE TEMPLATE MAINTAINER(S) + +New template version checklist: + +- [ ] 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/user_pull_request_template.md b/.github/user_pull_request_template.md new file mode 100644 index 00000000..00a0e711 --- /dev/null +++ b/.github/user_pull_request_template.md @@ -0,0 +1,4 @@ +This website is based on the Lab Website Template. +See its documentation for working with this site: + +https://greene-lab.gitbook.io/lab-website-template-docs diff --git a/.github/workflows/build-preview.yaml b/.github/workflows/build-preview.yaml index 52842860..3ef04044 100644 --- a/.github/workflows/build-preview.yaml +++ b/.github/workflows/build-preview.yaml @@ -22,28 +22,29 @@ jobs: steps: # for debugging - - name: Print contexts - uses: crazy-max/ghaction-dump-context@v1 + - uses: crazy-max/ghaction-dump-context@v2 - name: Checkout branch contents - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} - name: Install Ruby packages if: github.event.action != 'closed' - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@v1.172.0 with: - ruby-version: "3.0" + ruby-version: "3.1" bundler-cache: true - name: Get Pages url if: github.event.action != 'closed' id: pages - uses: actions/configure-pages@v2 - with: - enablement: false + uses: actions/configure-pages@v4 + + # for debugging + - if: runner.debug == '1' + uses: mxschmitt/action-tmate@v3 - name: Build preview version of site if: github.event.action != 'closed' @@ -51,7 +52,7 @@ jobs: 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 + uses: rossjrw/pr-preview-action@v1.4.7 with: source-dir: _site umbrella-dir: ${{ env.PREVIEWS_FOLDER }} diff --git a/.github/workflows/build-site.yaml b/.github/workflows/build-site.yaml index 9b71767f..6194c83b 100644 --- a/.github/workflows/build-site.yaml +++ b/.github/workflows/build-site.yaml @@ -21,30 +21,35 @@ jobs: steps: # for debugging - - name: Print contexts - uses: crazy-max/ghaction-dump-context@v1 + - uses: crazy-max/ghaction-dump-context@v2 - name: Checkout branch contents - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Ruby packages - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@v1.172.0 with: - ruby-version: "3.0" + ruby-version: "3.1" bundler-cache: true - name: Get Pages url id: pages - uses: actions/configure-pages@v2 - with: - enablement: false + uses: actions/configure-pages@v4 + + # for debugging + - if: runner.debug == '1' + uses: mxschmitt/action-tmate@v3 + + - name: Set root url + run: | + printf "\n\nurl: ${{ steps.pages.outputs.origin }}" >> _config.yaml - name: Build live version of site run: | 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 + uses: JamesIves/github-pages-deploy-action@v4.5.0 with: folder: _site clean-exclude: ${{ env.PREVIEWS_FOLDER }} diff --git a/.github/workflows/first-time-setup.yaml b/.github/workflows/first-time-setup.yaml index bf227f7d..415e2842 100644 --- a/.github/workflows/first-time-setup.yaml +++ b/.github/workflows/first-time-setup.yaml @@ -14,21 +14,24 @@ jobs: steps: # for debugging - - name: Print contexts - uses: crazy-max/ghaction-dump-context@v1 + - uses: crazy-max/ghaction-dump-context@v2 - name: Create Pages branch - uses: peterjgrainger/action-create-branch@v2.4.0 + uses: peterjgrainger/action-create-branch@v3.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: branch: "gh-pages" - name: Checkout Pages branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: gh-pages + # for debugging + - if: runner.debug == '1' + uses: mxschmitt/action-tmate@v3 + # clean slate, as if starting from orphan branch - name: Clear Pages branch run: rm -rf * .github .docker .gitignore @@ -38,16 +41,16 @@ jobs: run: touch .nojekyll - name: Make placeholder homepage - run: echo "Placeholder homepage" > index.html + run: printf "Placeholder homepage" > index.html - name: Commit changes to Pages branch - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: branch: gh-pages commit_message: "Clear branch" - name: Checkout main branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Remove files user doesn't need run: | @@ -55,23 +58,24 @@ jobs: CHANGELOG.md \ testbed.md \ .github/ISSUE_TEMPLATE \ + .github/DISCUSSION_TEMPLATE \ .github/workflows/versioning.yaml \ .github/pull_request_template.md \ - + - name: Rename files run: | - mv .github/user_pull_request_template.md .github/pull_request_template.md + mv -f .github/user_pull_request_template.md .github/pull_request_template.md - name: Set vars for personalization run: | user="${{ github.repository_owner }}" description="An engaging 1-3 sentence description of your lab." - echo "USER=${user}" >> $GITHUB_ENV - echo "DESCRIPTION=${description}" >> $GITHUB_ENV + printf "USER=${user}" >> $GITHUB_ENV + printf "DESCRIPTION=${description}" >> $GITHUB_ENV - name: Personalize readme for user run: | - echo " + printf " # ${{ env.USER }}'s Website Visit **[website url](#)** ๐ @@ -80,7 +84,7 @@ jobs: " > README.md - name: Personalize Jekyll config for user - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const { readFileSync, writeFileSync } = require("fs"); @@ -97,7 +101,7 @@ jobs: writeFileSync(file, contents); - name: Personalize homepage for user - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const { readFileSync, writeFileSync } = require("fs"); @@ -109,6 +113,6 @@ jobs: writeFileSync(file, contents); - name: Commit changed files - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "Setup repo" diff --git a/.github/workflows/update-citations.yaml b/.github/workflows/update-citations.yaml index 2bafb552..f6ff6ec2 100644 --- a/.github/workflows/update-citations.yaml +++ b/.github/workflows/update-citations.yaml @@ -29,17 +29,16 @@ jobs: steps: # for debugging - - name: Print contexts - uses: crazy-max/ghaction-dump-context@v1 + - uses: crazy-max/ghaction-dump-context@v2 - name: Checkout branch contents - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.11" cache: "pip" @@ -49,13 +48,17 @@ jobs: run: | python -m pip install --upgrade --requirement ./_cite/requirements.txt + # for debugging + - if: runner.debug == '1' + uses: mxschmitt/action-tmate@v3 + - name: Build updated citations run: python _cite/cite.py timeout-minutes: 15 - name: Check if citations changed id: changed - uses: tj-actions/verify-changed-files@v13 + uses: tj-actions/verify-changed-files@v18 with: files: | _data/citations.yaml @@ -64,7 +67,7 @@ jobs: if: | steps.changed.outputs.files_changed == 'true' && inputs.open-pr != true - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "Update citations" @@ -72,7 +75,7 @@ jobs: if: | steps.changed.outputs.files_changed == 'true' && inputs.open-pr == true - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v6 with: branch: citation-update title: Periodic citation update diff --git a/.github/workflows/update-url.yaml b/.github/workflows/update-url.yaml index 9ccd9a3e..b3573a54 100644 --- a/.github/workflows/update-url.yaml +++ b/.github/workflows/update-url.yaml @@ -20,21 +20,22 @@ jobs: steps: # for debugging - - name: Print contexts - uses: crazy-max/ghaction-dump-context@v1 + - uses: crazy-max/ghaction-dump-context@v2 - name: Get Pages url id: pages - uses: actions/configure-pages@v2 - with: - enablement: false + uses: actions/configure-pages@v4 - name: Checkout branch contents - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + # for debugging + - if: runner.debug == '1' + uses: mxschmitt/action-tmate@v3 # update link to site in readme - name: Update readme - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const { readFileSync, writeFileSync } = require("fs"); @@ -53,14 +54,14 @@ jobs: - name: Check if readme changed id: changed - uses: tj-actions/verify-changed-files@v13 + uses: tj-actions/verify-changed-files@v18 with: files: | README.md - name: Commit changed files if: steps.changed.outputs.files_changed == 'true' - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "Update url" diff --git a/.github/workflows/versioning.yaml b/.github/workflows/versioning.yaml new file mode 100644 index 00000000..e148f366 --- /dev/null +++ b/.github/workflows/versioning.yaml @@ -0,0 +1,135 @@ +name: versioning +run-name: versioning tasks + +on: + pull_request: + branches: + - main + push: + branches: + - main + +permissions: + contents: write + +jobs: + pull-request: + # only run on template itself, not user instance of template + if: | + github.repository == 'greenelab/lab-website-template' && + github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + # for debugging + - uses: crazy-max/ghaction-dump-context@v2 + - if: runner.debug == '1' + uses: mxschmitt/action-tmate@v3 + + - name: Checkout base branch contents + uses: actions/checkout@v4 + with: + ref: main + path: base + + - name: Checkout pr branch contents + uses: actions/checkout@v4 + with: + path: pr + + - name: Install packages + run: npm install yaml semver + + - name: Check version, date, changelog + uses: actions/github-script@v7 + with: + script: | + const { readFileSync } = require("fs"); + const { lte, valid } = require("semver"); + const { parse } = require("yaml"); + + // load and parse file contents + const { version: oldVersion, "date-released": oldDate } = parse( + readFileSync("base/CITATION.cff").toString() + ); + const { version: newVersion, "date-released": newDate } = parse( + readFileSync("pr/CITATION.cff").toString() + ); + const changelog = readFileSync("pr/CHANGELOG.md") + .toString() + .split(/^## /m) + .map((section) => { + const [heading, ...body] = section.split("\n"); + return [heading.trim(), body.join("\n").trim()]; + }); + + // check version + if (!valid(newVersion)) throw Error("Version not valid"); + if (lte(newVersion, oldVersion)) throw Error("Version not updated"); + + // check date + if (new Date(newDate).toISOString().split("T")[0] !== newDate) + throw Error("Date not valid"); + if (new Date(newDate) <= new Date(oldDate)) throw Error("Date not updated"); + + // check changelog + const newSection = changelog.find( + ([heading, body]) => + heading.includes(newVersion) && heading.includes(newDate) && body + ); + if (!newSection) throw Error("Changelog not updated or not valid"); + + push: + # only run on template itself, not user instance of template + if: | + github.repository == 'greenelab/lab-website-template' && + github.event_name == 'push' + runs-on: ubuntu-latest + steps: + # for debugging + - uses: crazy-max/ghaction-dump-context@v2 + + - name: Checkout branch contents + uses: actions/checkout@v4 + + - name: Install packages + run: npm install yaml semver + + # for debugging + - if: runner.debug == '1' + uses: mxschmitt/action-tmate@v3 + + - name: Get version and body + id: version + uses: actions/github-script@v7 + with: + script: | + const { readFileSync } = require("fs"); + const { parse } = require("yaml"); + + // load and parse file contents + const { version, "date-released": date } = parse( + readFileSync("CITATION.cff").toString() + ); + const changelog = readFileSync("CHANGELOG.md") + .toString() + .split(/^## /m) + .map((section) => { + const [heading, ...body] = section.split("\n"); + return [heading.trim(), body.join("\n").trim()]; + }); + + // find changelog body for version + const [, body = ""] = + changelog.find( + ([heading]) => heading.includes(version) && heading.includes(date) + ) || []; + + return { version, body }; + + - name: Create GitHub release + uses: ncipollo/release-action@v1.14.0 + with: + 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 new file mode 100644 index 00000000..fb1f988e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,152 @@ +# Changelog + +Reference: common-changelog.org + +## 1.2.1 - 2024-04-01 + +### Changed + +- Minor bug fixes in cite process and sitemap generation. + +## 1.2.0 - 2024-03-08 + +### Changed + +- Update all GitHub Actions to fix "Node v16 deprecated" warnings. +- Sources that Manubot doesn't know how to cite (e.g. wosuid:12345) are now ignored by default if they're from metasources. +- Fix bug where passing tags to tags component manually doesn't work. +- Fix bug in citation (and other) components when `lookup` is blank. +- Fix nested tables bug. +- Dark mode tweaks. +- Various CSS tweaks and fixes. + +### Added + +- Add `image` param to support blog post thumbnails. +- Add `html-proofer` plugin that checks for broken images/links/etc. +- Add `remove` flag to remove a source from a metasource. + +## 1.1.6 - 2023-10-06 + +### Changed + +- Use latest minor versions of Python packages in auto-cite script. + +## 1.1.5 - 2023-05-19 + +### Changed + +- Fix ORCID plugin bug and other cite process tweaks. + +## 1.1.4 - 2023-04-28 + +### Changed + +- Fix ORCID plugin and other cite process bugs. + +## 1.1.3 - 2023-04-20 + +### Changed + +- Fix first-time-setup mv bug. +- Fix citation, float, and portrait component CSS. +- Filter and trim citation info fields. + +## 1.1.2 - 2023-04-11 + +### Changed + +- Fix first-time-setup rm bug. + +## 1.1.1 - 2023-04-06 + +### Changed + +- Change member profile page from col layout to float. +- Fix first time setup. Preserve config formatting and comments. +- Improve Docker cite process behavior. +- Fix post excerpt component start/end markers and special search attr chars. +- Fix misc CSS. + +### Added + +- Add show-title and show-subtitle site config options. +- Include site subtitle in description meta tag. +- Add user pull request template. +- Add title and link fallbacks to citation component. + +## 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. + +High-level comparison with pre-releases: + +- Simpler configuration. +- More automation, less setup. +- More customization and flexibility. +- Redesigned components. +- New docs. +- Complete rewrite. +- Culmination of years of feedback. + +### Changed + +- Template is no longer limited to GitHub Pages white-listed Jekyll plugins. Any plugins possible. +- Pull request previews happen right within GitHub instead of needing Netlify. +- Better versioning. `CITATION.cff` file now source of truth for version, and tags/releases enforced. +- Citation-related files in `/_data` must now be named prefixed with the cite plugin they are to be run with, e.g. `sources-2020.yaml` or `orcid-students.yaml`. +- Folder renames for clarity and for better separation of template and user content: `/auto-cite` โ `/_cite`, `/css` โ `/_styles`, `/js` โ `/_scripts`. +- Rename "Tools" page to "Projects" to be more clear and general purpose. +- Rename `extra-links` to `buttons` in `sources.yaml` files. +- Rename `theme.scss` to `-theme.scss`. +- Rename/repurpose components: link โ button, two-col โ cols, gallery โ grid. +- Combine "link" and "role" data lists into single `types.yaml` map. +- Redesign components, change parameters and behavior. +- Update Font Awesome icon names from v5 to v6. +- Change placeholder text, images, and other images. +- Use CSS variables instead of Sass variables. +- Simplify caching method in cite process. +- Simplify Liquid code by including custom Ruby plugins. +- Simplify styles and scripts. + +### Added + +- New docs at greene-lab.gitbook.io/lab-website-template-docs. +- Add automations for first time setup and URL change. +- Write PubMed and Google Scholar automatic citation plugins. +- Automatic citations through GitHub Actions should now work from (most) forks. +- Add optional description and type params for citations. +- Add periodic cite process run that opens a pull request. +- List component filters can now accept arbitrary regex. +- Add light/dark mode toggle. +- Pre-install selection of useful Jekyll plugins, namely Jekyll Spaceship. +- Add author portrait and updated date for blog posts. +- Add richer metadata for SEO. +- Google Fonts link determined automatically from theme file. + +### Removed + +- Remove options from `_config.yaml` to simplify configuration: `baseurl`, `auto-cite`, `logo`. +- Remove `/favicons` folder, hardcode files for logo, icon, and share in `/images`. +- Remove `palettes.scss` and `mixins.scss`. +- Remove banner component (same thing can be achieved with full width section and figure components). +- Remove role component. Combine with portrait component. diff --git a/CITATION.cff b/CITATION.cff index 22d406ce..4b875d47 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,8 +1,8 @@ # citation metadata for the template itself title: "Lab Website Template" -version: 1.1.6 -date-released: 2023-10-06 +version: 1.2.1 +date-released: 2024-04-01 url: "https://github.com/greenelab/lab-website-template" authors: - family-names: "Rubinetti" diff --git a/Gemfile b/Gemfile index b39f041e..cbdd53f2 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,8 @@ source "https://rubygems.org" gem "jekyll", "~> 4.3" gem "webrick", "~> 1.7" +gem "html-proofer", "~> 5.0" + # plugins group :jekyll_plugins do gem "jekyll-spaceship" diff --git a/Gemfile.lock b/Gemfile.lock index d719aa93..ee2cb121 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,23 +1,50 @@ GEM remote: https://rubygems.org/ specs: + Ascii85 (1.1.0) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) + afm (0.2.2) + async (2.8.1) + console (~> 1.10) + fiber-annotation + io-event (~> 1.1) + timers (~> 4.1) colorator (1.1.0) concurrent-ruby (1.2.2) + console (1.23.4) + fiber-annotation + fiber-local + json em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) + ethon (0.16.0) + ffi (>= 1.15.0) eventmachine (1.2.7) ffi (1.15.5) ffi (1.15.5-x64-mingw-ucrt) + fiber-annotation (0.2.0) + fiber-local (1.0.0) forwardable-extended (2.6.0) gemoji (3.0.1) + google-protobuf (3.22.0) google-protobuf (3.22.0-arm64-darwin) google-protobuf (3.22.0-x64-mingw-ucrt) + hashery (2.1.2) + html-proofer (5.0.8) + addressable (~> 2.3) + async (~> 2.1) + nokogiri (~> 1.13) + pdf-reader (~> 2.11) + rainbow (~> 3.0) + typhoeus (~> 1.3) + yell (~> 2.0) + zeitwerk (~> 2.5) http_parser.rb (0.8.0) i18n (1.12.0) concurrent-ruby (~> 1.0) + io-event (1.4.4) jekyll (4.3.2) addressable (~> 2.4) colorator (~> 1.0) @@ -52,6 +79,7 @@ GEM rainbow (~> 3.0) jekyll-watch (2.2.1) listen (~> 3.0) + json (2.7.1) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -69,24 +97,41 @@ GEM racc (~> 1.4) pathutil (0.16.2) forwardable-extended (~> 2.6) + pdf-reader (2.12.0) + Ascii85 (~> 1.0) + afm (~> 0.2.1) + hashery (~> 2.0) + ruby-rc4 + ttfunk posix-spawn (0.3.15) public_suffix (5.0.1) racc (1.6.2) rainbow (3.1.1) + rake (13.1.0) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) rexml (3.2.5) rouge (3.30.0) + ruby-rc4 (0.1.5) safe_yaml (1.0.5) + sass-embedded (1.58.3) + google-protobuf (~> 3.21) + rake (>= 10.0.0) 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) + timers (4.3.5) + ttfunk (1.7.0) + typhoeus (1.4.1) + ethon (>= 0.9.0) unicode-display_width (2.4.2) webrick (1.8.1) + yell (2.2.2) + zeitwerk (2.6.13) PLATFORMS aarch64-linux @@ -99,6 +144,7 @@ PLATFORMS x86_64-linux DEPENDENCIES + html-proofer (~> 5.0) jekyll (~> 4.3) jekyll-feed jekyll-last-modified-at @@ -108,4 +154,4 @@ DEPENDENCIES webrick (~> 1.7) BUNDLED WITH - 2.4.7 + 2.5.6 diff --git a/_cite/cite.py b/_cite/cite.py index 5f8d135a..6cd5befc 100644 --- a/_cite/cite.py +++ b/_cite/cite.py @@ -124,6 +124,10 @@ for index, source in enumerate(sources): log(f"Processing source {index + 1} of {len(sources)}, {label(source)}") + # if explicitly flagged, remove/ignore entry + if get_safe(source, "remove", False) == True: + continue + # new citation data for source citation = {} @@ -148,7 +152,7 @@ else: log(e, 3, "WARNING") # discard source from citations - # continue + continue # preserve fields from input source, overriding existing fields citation.update(source) diff --git a/_cite/util.py b/_cite/util.py index 466a7d56..904ff332 100644 --- a/_cite/util.py +++ b/_cite/util.py @@ -7,7 +7,7 @@ import yaml from yaml.loader import SafeLoader from pathlib import Path -from datetime import datetime +from datetime import date, datetime from rich import print from diskcache import Cache @@ -88,15 +88,17 @@ def list_of_dicts(data): return isinstance(data, list) and all(isinstance(entry, dict) for entry in data) -def format_date(date): +def format_date(_date): """ format date as YYYY-MM-DD, or no date if malformed """ - if isinstance(date, int): - return datetime.fromtimestamp(date // 1000.0).strftime("%Y-%m-%d") + if isinstance(_date, int): + return datetime.fromtimestamp(_date // 1000.0).strftime("%Y-%m-%d") + if isinstance(_date, (date, datetime)): + return _date.strftime("%Y-%m-%d") try: - return datetime.strptime(date, "%Y-%m-%d").strftime("%Y-%m-%d") + return datetime.strptime(_date, "%Y-%m-%d").strftime("%Y-%m-%d") except Exception: return "" diff --git a/_includes/card.html b/_includes/card.html index feb325cb..600cc971 100644 --- a/_includes/card.html +++ b/_includes/card.html @@ -35,7 +35,9 @@ {% endif %} {% if include.description %} - {{ include.description | markdownify }} +
+ {{ include.description | markdownify | remove: "
" | remove: "
" }} + {% endif %} {% if include.tags or include.repo %} diff --git a/_includes/citation.html b/_includes/citation.html index ea62b17e..3eb8b2b4 100644 --- a/_includes/citation.html +++ b/_includes/citation.html @@ -1,96 +1,109 @@ -{% assign citation = site.data.citations - | where_exp: "citation", - "citation.id == include.lookup or citation.title contains include.lookup" - | first - | default: include -%} +{% if include.lookup %} + {% assign citation = site.data.citations + | where_exp: "citation", + "citation.id == include.lookup or citation.title contains include.lookup" + | first + %} +{% else %} + {% assign citation = include %} +{% endif %} -" - | remove: "
" - }} -" + | remove: "
" + }} +- {{ excerpt }} -
++ {{ excerpt }} +
+