Skip to content

Commit

Permalink
add modded CSS from basic theme for footnotes/citations (#313)
Browse files Browse the repository at this point in the history
* fix eslint errors in search.ts
* fix CI not doing `npm run check`
* use CSS grid
  • Loading branch information
2bndy5 authored Mar 30, 2024
1 parent d965e31 commit 63a80bb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ jobs:
strategy:
fail-fast: false
matrix:
nox-sessions:
- 'black check_yaml check_json check_toml check_eof check_trailing_space check_lf'
python-version: ['3.x']
node-version: ['16.x']
include:
- nox-sessions: 'black check_yaml check_json check_toml check_eof check_trailing_space check_lf'
python-version: '3.x'
node-version: '16.x'
- nox-sessions: 'mypy pylint'
python-version: '3.8'
- nox-sessions: 'mypy pylint'
Expand All @@ -37,7 +36,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
if: contains(matrix, 'node-version')
if: matrix.node-version
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
Expand All @@ -47,23 +46,23 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Cache node.js modules
if: contains(matrix, 'node-version')
if: matrix.node-version
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Cache nox environments
if: contains(matrix, 'node-version')
uses: actions/cache@v4
if: matrix.node-version
with:
path: |
.nox/black
.nox/check_*
key: nox-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('requirements/dev-black.txt', 'requirements/dev-pre_commit_hooks.txt') }}
- run: npm install
if: contains(matrix, 'node-version')
if: matrix.node-version
- run: npm run check
if: contains(matrix, 'node-version')
if: matrix.node-version
- run: pipx run nox -s ${{ matrix.nox-sessions }}

build:
Expand Down
12 changes: 6 additions & 6 deletions src/assets/javascripts/sphinx_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,12 @@ export async function getResults(query: string): Promise<SearchResultStream> {
const objectterms = []

for (let origTerm of splitQuery(query)) {
let negative = false;
if (origTerm[0] === '-') {
negative = true;
origTerm = origTerm.substr(1);
let negative = false
if (origTerm[0] === "-") {
negative = true
origTerm = origTerm.substr(1)
}
let lowerTerm = origTerm.toLowerCase()
const lowerTerm = origTerm.toLowerCase()
if (lowerTerm.length === 0) {
continue
}
Expand All @@ -725,7 +725,7 @@ export async function getResults(query: string): Promise<SearchResultStream> {
// by special characters like [-._]. Split them up and treat each
// as a separate search term.
for (const wordMatch of lowerTerm.matchAll(/\w+/g)) {
const subTerm = wordMatch[0];
const subTerm = wordMatch[0]
if (stopwords.indexOf(subTerm) !== -1) {
// skip this "word"
continue
Expand Down
38 changes: 38 additions & 0 deletions src/assets/stylesheets/main/_sphinx.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,42 @@
div.line-block div.line-block {
margin-left: 1.5em;
}

// display of footnotes and citations
aside.footnote,
div.citation {
display: grid;
grid-auto-columns: minmax(auto, max-content);

> span {
&.label {
grid-column: 1;
}

&.backrefs {
grid-column: 2;
}

&:last-of-type {
padding-right: 0.5em;
}
}

> :not(span.backrefs, span.label) {
grid-column: 3;

&:first-of-type {
margin-top: 0;
}

&:last-child {
margin-bottom: 0;

&::after {
clear: both;
content: "";
}
}
}
}
}

0 comments on commit 63a80bb

Please sign in to comment.