-
Notifications
You must be signed in to change notification settings - Fork 432
feat(equations.lua): support alt attribute for cross-referenced equations #13889
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
+293
−46
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cbf0e22
feat(equations.lua): support alt attribute for cross-referenced equat…
mcanouil 45f314b
fix: wrong order
mcanouil 43e6342
Merge branch 'main' into feat/typst-math-alt-text
mcanouil 4691866
test: add attribute with spaces in equation label
mcanouil 8aecde1
fix: normalise attributes string to ensure proper parsing by Pandoc
mcanouil 242bf75
test: add actual spaces around equal sign in alt attribute
mcanouil 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
104 changes: 104 additions & 0 deletions
104
tests/docs/smoke-all/crossrefs/equations/equations-alt.qmd
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,104 @@ | ||
| --- | ||
| title: Equation Alt-Text Test | ||
| format: | ||
| html: default | ||
| typst: | ||
| keep-typ: true | ||
| pdf: | ||
| keep-tex: true | ||
| _quarto: | ||
| tests: | ||
| html: | ||
| ensureHtmlElements: | ||
| - | ||
| - "span#eq-display-math > span.math" | ||
| - "span#eq-display-alt > span.math" | ||
| - "span#eq-single-quote > span.math" | ||
| - "span#eq-double-quote > span.math" | ||
| - "span#eq-mixed-quotes > span.math" | ||
| - "span#eq-single-quote-alt > span.math" | ||
| - "a.quarto-xref[href='#eq-display-math']" | ||
| - "a.quarto-xref[href='#eq-display-alt']" | ||
| - "a.quarto-xref[href='#eq-single-quote']" | ||
| - "a.quarto-xref[href='#eq-double-quote']" | ||
| - "a.quarto-xref[href='#eq-mixed-quotes']" | ||
| - "a.quarto-xref[href='#eq-single-quote-alt']" | ||
| - [] | ||
| pdf: | ||
| ensureLatexFileRegexMatches: | ||
| - | ||
| - "\\\\begin\\{equation\\}\\\\protect\\\\phantomsection\\\\label\\{eq-display-math\\}" | ||
| - "\\\\begin\\{equation\\}\\\\protect\\\\phantomsection\\\\label\\{eq-display-alt\\}" | ||
| - "\\\\begin\\{equation\\}\\\\protect\\\\phantomsection\\\\label\\{eq-single-quote\\}" | ||
| - "\\\\begin\\{equation\\}\\\\protect\\\\phantomsection\\\\label\\{eq-double-quote\\}" | ||
| - "\\\\begin\\{equation\\}\\\\protect\\\\phantomsection\\\\label\\{eq-mixed-quotes\\}" | ||
| - "\\\\begin\\{equation\\}\\\\protect\\\\phantomsection\\\\label\\{eq-single-quote-alt\\}" | ||
| typst: | ||
| ensureTypstFileRegexMatches: | ||
| - | ||
| - "#math\\.equation\\(block: true, numbering: \"\\(1\\)\", \\[ \\$ E = m c\\^2 \\$ \\]\\)<eq-display-math>" | ||
| - "#math\\.equation\\(block: true, numbering: \"\\(1\\)\", alt: \"Einsteins mass-energy equivalence equation\", \\[ \\$ E = m c\\^2 \\$ \\]\\)<eq-display-alt>" | ||
| - "#math\\.equation\\(block: true, numbering: \"\\(1\\)\", alt: \"Newton's second law of motion\", \\[ \\$ F = m a \\$ \\]\\)<eq-single-quote>" | ||
| - "#math\\.equation\\(block: true, numbering: \"\\(1\\)\", alt: \"The \\\\\"Pythagorean\\\\\" theorem\", \\[ \\$ a\\^2 \\+ b\\^2 = c\\^2 \\$ \\]\\)<eq-double-quote>" | ||
| - "#math\\.equation\\(block: true, numbering: \"\\(1\\)\", alt: \"This is using \\\\\"quotes\\\\\" but I'm sure it works\", \\[ \\$ x \\+ y = z \\$ \\]\\)<eq-mixed-quotes>" | ||
| - "#math\\.equation\\(block: true, numbering: \"\\(1\\)\", alt: \"This is using 'single quotes' around the \\\\\"quotes\\\\\" but I'm sure it works\", \\[ \\$ x \\+ y = z \\$ \\]\\)<eq-single-quote-alt>" | ||
| - [] | ||
| --- | ||
|
|
||
| ## Inline Math (no label) | ||
|
|
||
| This is an inline equation: $E = mc^2$. | ||
|
|
||
| ## Display Math (no label) | ||
|
|
||
| $$ | ||
| a^2 + b^2 = c^2 | ||
| $$ | ||
|
|
||
| ## Display Math (with label, no alt) | ||
|
|
||
| $$ | ||
| E = mc^2 | ||
| $$ {#eq-display-math} | ||
|
|
||
| See @eq-display-math. | ||
|
|
||
| ## Display Math (with label and alt) | ||
|
|
||
| $$ | ||
| E = mc^2 | ||
| $$ {#eq-display-alt alt="Einsteins mass-energy equivalence equation"} | ||
|
|
||
| See @eq-display-alt. | ||
|
|
||
| ## Display Math (with single quote in alt) | ||
|
|
||
| $$ | ||
| F = ma | ||
| $$ {#eq-single-quote alt="Newton's second law of motion"} | ||
|
|
||
| See @eq-single-quote. | ||
|
|
||
| ## Display Math (with double quotes in alt) | ||
|
|
||
| $$ | ||
| a^2 + b^2 = c^2 | ||
| $$ {#eq-double-quote alt='The "Pythagorean" theorem'} | ||
|
|
||
| See @eq-double-quote. | ||
|
|
||
| ## Display Math (with mixed quotes in alt) | ||
|
|
||
| $$ | ||
| x + y = z | ||
| $$ {#eq-mixed-quotes alt="This is using \"quotes\" but I'm sure it works"} | ||
|
|
||
| See @eq-mixed-quotes. | ||
|
|
||
| ## Display Math (with single quotes in and around alt) | ||
|
|
||
| $$ | ||
| x + y = z | ||
| $$ {#eq-single-quote-alt alt='This is using \'single quotes\' around the "quotes" but I\'m sure it works'} | ||
|
|
||
| See @eq-single-quote-alt. |
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.