-
Notifications
You must be signed in to change notification settings - Fork 185
Rendering fixes: math-punctuation, fonts, and a render regression test #1309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7ceae4
Makefile: ensure that changing static files causes them to be re-copied.
daira 77564fd
Correct a CSS comment.
daira a0e3c8b
Update `README.rst` (ZIP 258 `Discussions-To`).
daira a9b838e
Fix the punctuation-after-math problem once and for all.
daira e95c196
style.css: fix Raleway-Italic weight for emphasis and pool names
daira 2b33f26
test: add a render.sh math/CSS regression test, run in CI
daira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #!/bin/bash | ||
| # Regression test for render.sh's math-punctuation rewriting and stylesheet ordering. | ||
| # | ||
| # For each fixture under test/render/, render it via the Makefile (capturing render.sh's | ||
| # post-sed, pre-renderer stream through RENDER_INTERMEDIATE) and compare that intermediate | ||
| # against the checked-in golden. Also check, in the rendered HTML, that our style.css loads | ||
| # after the KaTeX CSS (so our `.katex .*` font overrides win the cascade). | ||
| # | ||
| # Update goldens after an intended render.sh change with: | ||
| # RENDER_INTERMEDIATE=test/render/<stem>.intermediate make rendered/test/<stem>.html | ||
| set -euo pipefail | ||
|
|
||
| cd "$(dirname "$0")/.." # repo root | ||
|
|
||
| # `.Makefile.uptodate` runs `make clean` (which removes temp/), so create temp/ after it. | ||
| make .Makefile.uptodate >/dev/null | ||
| mkdir -p temp | ||
| # Clean up our own intermediates on exit, so we don't leave files that would trip | ||
| # update_check.sh's `rmdir temp` (it shares temp/ but expects to empty it). | ||
| trap 'rm -f temp/test-render-*.intermediate' EXIT | ||
|
|
||
| status=0 | ||
|
|
||
| check() { | ||
| stem="$1" | ||
| html="rendered/test/${stem}.html" | ||
| golden="test/render/${stem}.intermediate" | ||
| got="temp/${stem}.intermediate" | ||
|
|
||
| rm -f "$html" | ||
| RENDER_INTERMEDIATE="$got" make "$html" >/dev/null | ||
|
|
||
| if diff -u "$golden" "$got"; then | ||
| echo "PASS intermediate ${stem}" | ||
| else | ||
| echo "FAIL intermediate ${stem} (diff above: golden vs actual)" | ||
| status=1 | ||
| fi | ||
|
|
||
| # Our style.css must load after the KaTeX CSS, else our `.katex .*` overrides lose. | ||
| katex_line="$(grep -n 'katex\.min\.css' "$html" | head -1 | cut -d: -f1 || true)" | ||
| style_line="$(grep -n 'href="css/style\.css"' "$html" | head -1 | cut -d: -f1 || true)" | ||
| if [ -n "$katex_line" ] && [ -n "$style_line" ] && [ "$style_line" -gt "$katex_line" ]; then | ||
| echo "PASS css-order ${stem} (style.css@${style_line} after katex@${katex_line})" | ||
| else | ||
| echo "FAIL css-order ${stem} (katex=${katex_line:-none} style=${style_line:-none})" | ||
| status=1 | ||
| fi | ||
| } | ||
|
|
||
| check test-render-rst | ||
| check test-render-md | ||
|
|
||
| if [ "$status" -eq 0 ]; then | ||
| echo "render tests: PASS" | ||
| else | ||
| echo "render tests: FAIL" | ||
| fi | ||
| exit "$status" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| Title: Render test (Markdown) | ||
|
|
||
| Trailing period: $x\kern-0.05em\textsf{.}$ | ||
|
|
||
| Comma then space: $a\kern-0.05em\textsf{,}$ then. | ||
|
|
||
| Hyphen after span: $n\kern-0.15em$ -bit. | ||
|
|
||
| Threshold: $t\kern-0.15em$ -of-$n\kern-0.05em\textsf{.}$ | ||
|
|
||
| Close paren: (see $i\kern-0.15em$ ). | ||
|
|
||
| Em-dash directly after: $x\kern-0.15em$ —note. | ||
|
|
||
| Leading minus preserved: $-x$ stays. | ||
|
|
||
| Leading minus then period: $-y\kern-0.05em\textsf{.}$ | ||
|
|
||
| Punctuation mid-token unchanged: $x$.5 here. | ||
|
|
||
| Plain span: $z$ here. | ||
|
|
||
| Escaped dollars: \$5 and \$10. | ||
|
|
||
| Multi-line span left alone: $a + | ||
| b$. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| Title: Render test (Markdown) | ||
|
|
||
| Trailing period: $x$. | ||
|
|
||
| Comma then space: $a$, then. | ||
|
|
||
| Hyphen after span: $n$-bit. | ||
|
|
||
| Threshold: $t$-of-$n$. | ||
|
|
||
| Close paren: (see $i$). | ||
|
|
||
| Em-dash directly after: $x$—note. | ||
|
|
||
| Leading minus preserved: $-x$ stays. | ||
|
|
||
| Leading minus then period: $-y$. | ||
|
|
||
| Punctuation mid-token unchanged: $x$.5 here. | ||
|
|
||
| Plain span: $z$ here. | ||
|
|
||
| Escaped dollars: \$5 and \$10. | ||
|
|
||
| Multi-line span left alone: $a + | ||
| b$. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| .. Title: Render test (rst) | ||
|
|
||
| Trailing period: :math:`x\kern-0.03em\textsf{.}` | ||
|
|
||
| Comma then space: :math:`a\kern-0.03em\textsf{,}` then. | ||
|
|
||
| Hyphen after span: :math:`n\kern-0.15em` -bit. | ||
|
|
||
| Threshold: :math:`t\kern-0.15em` -of-:math:`n\kern-0.03em\textsf{.}` | ||
|
|
||
| Close paren: (see :math:`i\kern-0.15em` ). | ||
|
|
||
| Em-dash directly after: :math:`x\kern-0.15em` —note. | ||
|
|
||
| Leading minus preserved: :math:`-x` stays. | ||
|
|
||
| Leading minus then period: :math:`-y\kern-0.03em\textsf{.}` | ||
|
|
||
| Punctuation mid-token unchanged: :math:`x`.5 here. | ||
|
|
||
| Plain span: :math:`z` here. | ||
|
|
||
| Escaped dollars: $5 and $10. | ||
|
|
||
| Multi-line span left alone: $a + | ||
| b$. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| .. Title: Render test (rst) | ||
|
|
||
| Trailing period: $x$. | ||
|
|
||
| Comma then space: $a$, then. | ||
|
|
||
| Hyphen after span: $n$-bit. | ||
|
|
||
| Threshold: $t$-of-$n$. | ||
|
|
||
| Close paren: (see $i$). | ||
|
|
||
| Em-dash directly after: $x$—note. | ||
|
|
||
| Leading minus preserved: $-x$ stays. | ||
|
|
||
| Leading minus then period: $-y$. | ||
|
|
||
| Punctuation mid-token unchanged: $x$.5 here. | ||
|
|
||
| Plain span: $z$ here. | ||
|
|
||
| Escaped dollars: \$5 and \$10. | ||
|
|
||
| Multi-line span left alone: $a + | ||
| b$. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.