Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ho-man-chan committed Sep 28, 2021
2 parents 9cb23ee + de6987b commit c5f596e
Show file tree
Hide file tree
Showing 55 changed files with 6,942 additions and 6,928 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ on:
jobs:
tests:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php: [ 7.3 ]
os: [ ubuntu-18.04 ]
wordpress: [ 5.8, latest]

wordpress: [5.8, latest]
experimental: [false]
include:
- php: 7.4
os: ubuntu-20.04
wordpress: latest
experimental: true
name: Test - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}

env:
Expand Down Expand Up @@ -44,24 +51,38 @@ jobs:
path: vendor
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}

- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: phpcs, composer:v1
coverage: pcov

- name: Install dependencies
- name: Install Node dependencies
run: |
node -v
npm install -g lerna
npm install
npm run bootstrap
if: matrix.experimental == false

- name: Install PHP dependencies
run: |
export PATH="$HOME/.composer/vendor/bin:$PATH"
composer install --no-interaction
composer global require "phpunit/phpunit:7.5.20"
- name: Run Lint
run: npm run lint
if: matrix.experimental == false

- name: Run PHP CodeSniffer
run: composer standards

- name: Install WP tests
Expand All @@ -74,9 +95,10 @@ jobs:
run: |
npm run test
lerna run test
if: matrix.experimental == false

- name: Run PHP Tests
run: vendor/bin/phpunit
run: composer test

- name: Upload Coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This theme is named after Canadian media theorist Marshall McLuhan, who coined t

* PHP >= 7.3
* WordPress >= 5.8
* Pressbooks >= 5.26.0
* Pressbooks >= 5.27.0

## Installation

Expand All @@ -41,7 +41,7 @@ Then, from the GitHub Updater interface, navigate to the "Install Theme" tab. En

## Changelog

### 2.12.0
### 2.13.0

* See: https://github.com/pressbooks/pressbooks-book/releases/tag/2.12.0
* See: https://github.com/pressbooks/pressbooks-book/releases/tag/2.13.0
* Full release history available at: https://github.com/pressbooks/pressbooks-book/releases
19 changes: 18 additions & 1 deletion assets/src/scripts/collapse-sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,24 @@ document.addEventListener( 'DOMContentLoaded', function () {
elem.nextElementSibling &&
elem.nextElementSibling.tagName !== 'H1' &&
! elem.nextElementSibling.classList.contains( 'nav-reading--page' ) &&
! ( elem.nextElementSibling.tagName === 'DIV' && elem.nextElementSibling.className === 'glossary' )
! (
(
elem.nextElementSibling.tagName === 'DIV' &&
(
elem.nextElementSibling.className === 'glossary' ||
elem.nextElementSibling.className === 'contributors' ||
elem.nextElementSibling.className === 'footnotes' ||
elem.nextElementSibling.classList.contains( 'media-attributions' )
)
) ||
(
elem.nextElementSibling.tagName === 'HR' &&
(
elem.nextElementSibling.classList.contains( 'before-footnotes' ) ||
elem.nextElementSibling.classList.contains( 'before-contributors' )
)
)
)
) {
elems.push( elem.nextElementSibling );
elem = elem.nextElementSibling;
Expand Down
3 changes: 1 addition & 2 deletions assets/src/scripts/routes/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,13 @@ export default {
( function () {
// Get all the part titles
const entityTitles = document.querySelectorAll(
'.toc__part--full > .toc__title, .toc__chapter--full > .toc__title, .toc__front-matter--full > .toc__title, .toc__back-matter--full > .toc__title'
'.toc__part--full > .toc__title__container, .toc__chapter--full > .toc__title__container, .toc__front-matter--full > .toc__title__container, .toc__back-matter--full > .toc__title__container'
);

// Determine whether or not we are on the home page
const isHome = document.body.classList.contains( 'home' );

Array.prototype.forEach.call( entityTitles, entityTitle => {

// Give each part title a toggle button child
let ariaExpanded = ( ( isHome && entityTitle.parentNode.classList.contains( 'toc__part' ) ) || ( ! isHome && entityTitle.parentNode.classList.contains( 'toc__parent' ) ) ) ? true : false;
let ariaLabel = `${pressbooksBook.toggle_contents} '${entityTitle.innerText}'`;
Expand Down
2 changes: 1 addition & 1 deletion assets/src/styles/components/_diff.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "~spinkit/scss/spinners/2-double-bounce.scss";
@import "~spinkit/spinkit.min.css";

.block-reading-meta__compare {
margin-bottom: 2rem;
Expand Down
29 changes: 18 additions & 11 deletions assets/src/styles/components/_toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ $light: #eee;
float: right;
}

.toc__title button {
.toc__title__container button {
background: $lighter;
text-align: center;
}

.toc__part > .toc__title button {
.toc__part > .toc__title__container button {
background: $light;
}

Expand All @@ -50,8 +50,9 @@ $light: #eee;
width: 1rem;
}

.toc [class*="--full"] > .toc__title > span,
.toc [class*="--empty"] > .toc__title {
.toc [class*="--full"] > .toc__title__container > span,
.toc [class*="--full"] > .toc__title__container > p > span,
.toc [class*="--empty"] > .toc__title__container {
background: $lighter;
padding: 0.25rem 0.5rem;
display: inline-block;
Expand All @@ -66,7 +67,8 @@ $light: #eee;
min-height: 2.25rem;
}

.toc [class*="--full"] > .toc__title > span {
.toc [class*="--full"] > .toc__title__container > span,
.toc [class*="--full"] > .toc__title__container > p > span {
width: calc(100% - 2.75rem);
text-indent: -1.18rem;
padding-left: 1.68rem;
Expand All @@ -77,22 +79,27 @@ $light: #eee;
margin-left: 1.25rem;
}

.toc [class*="--empty"] > .toc__title {
.toc [class*="--empty"] > .toc__title__container {
width: 100%;
text-indent: -1.18rem;
padding-left: 1.68rem;
}

.toc__title {
.toc__title__container .toc__title {
margin-bottom: 0;
}

.toc__part > .toc__title {
.toc__title__container .toc__author {
margin: 0 0 0 .75rem;
text-indent: 0;
}

.toc__part > .toc__title__container {
font-weight: 600;
}

.toc .toc__part--full > .toc__title span,
.toc .toc__part--empty > .toc__title {
.toc .toc__part--full > .toc__title__container span,
.toc .toc__part--empty > .toc__title__container {
background: $light;
}

Expand Down Expand Up @@ -159,6 +166,6 @@ $light: #eee;
}
}

.toc__selected .toc__title a {
.toc__selected .toc__title__container a {
text-decoration: underline;
}
12 changes: 3 additions & 9 deletions bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SKIP_DB_CREATE=${6-false}

TMPDIR=${TMPDIR-/tmp}
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")

WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}

Expand All @@ -25,15 +26,8 @@ download() {
fi
}

if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then
WP_TESTS_TAG="branches/$WP_VERSION"
elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then
# version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x
WP_TESTS_TAG="tags/${WP_VERSION%??}"
else
WP_TESTS_TAG="tags/$WP_VERSION"
fi
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
WP_TESTS_TAG="tags/$WP_VERSION"
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
WP_TESTS_TAG="trunk"
else
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@
],
"scripts": {
"test": [
"vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml",
"@standards"
"vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml"
],
"standards": [
"vendor/bin/phpcs --standard=phpcs.ruleset.xml inc partials *.php"
],
"fix": [
"vendor/bin/phpcbf --standard=phpcs.ruleset.xml inc partials *.php"
],
"localize": [
"wp-pot -o=languages/pressbooks-book.pot -d=pressbooks-book -t 'Pressbooks (Book Oven Inc.) <[email protected]>' -s '*.php'"
],
Expand Down
8 changes: 4 additions & 4 deletions dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"/scripts/book.js": "/scripts/book.js?id=f97a2577f4e0b419ab12",
"/scripts/book.js": "/scripts/book.js?id=e66e96b2f7d5e73debc8",
"/scripts/pane.js": "/scripts/pane.js?id=7e5b385cb135973c79f7",
"/scripts/collapse-sections.js": "/scripts/collapse-sections.js?id=83a9f50d491bda850fbc",
"/scripts/collapse-sections.js": "/scripts/collapse-sections.js?id=b902d882dd21410b4387",
"/scripts/lightbox.js": "/scripts/lightbox.js?id=cb2b7b2a5fb303c3095d",
"/styles/book.css": "/styles/book.css?id=f47ba7caaba9ec75c5f3",
"/styles/web-house-style.css": "/styles/web-house-style.css?id=f2ec506de7eae2e9ddc5",
"/styles/book.css": "/styles/book.css?id=987a2acb6f08d2e3b567",
"/scripts/sharer.js": "/scripts/sharer.js?id=40da80ac58b2606eaedf",
"/scripts/sharer.js": "/scripts/sharer.js?id=3ac949166b7d8d866f7a",
"/scripts/lity.js": "/scripts/lity.js?id=b91ed0405760d2e124c1",
"/scripts/details-element-polyfill.js": "/scripts/details-element-polyfill.js?id=60ad7c2161011e153d53",
"/styles/lity.css": "/styles/lity.css?id=2b05d25ddc82cd96736b",
Expand Down
2 changes: 1 addition & 1 deletion dist/scripts/book.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/scripts/collapse-sections.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c5f596e

Please sign in to comment.