Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bundle/latex2html5.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,7 @@ var LaTeX2HTML5 = (() => {
return "</div>";
}
var Functions2 = {
bq: () => '<p class="quotation">',
bq: () => '<blockquote class="quotation">',
claim(m) {
return headed("Claim", "claim", this, m);
},
Expand Down Expand Up @@ -2267,7 +2267,7 @@ var LaTeX2HTML5 = (() => {
endproblem: () => closed(),
endsolution: () => closed(),
endtheorem: () => closed(),
eq: () => "</p>",
eq: () => "</blockquote>",
example(m) {
return headed("Example", "example", this, m);
},
Expand Down Expand Up @@ -4603,7 +4603,7 @@ var LaTeX2HTML5 = (() => {
* @returns the lines with runs of text wrapped in paragraphs
*/
paragraphize(lines) {
const isBlock = (l) => /^\s*<(h[1-6]|ul|ol|li|p|div|table|blockquote|pre|figure)\b/i.test(l);
const isBlock = (l) => /^\s*<\/?(h[1-6]|ul|ol|li|p|div|table|blockquote|pre|figure)\b/i.test(l);
const mathEnvBegin = /\\begin\{(align\*?|alignat\*?|equation\*?|eqnarray\*?|gather\*?|multline\*?)\}/;
const out = [];
let para = [];
Expand Down
2 changes: 1 addition & 1 deletion bundle/latex2js.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ span.tt {
font-family: courier;
}

p.quotation {
blockquote.quotation {
padding: 0 0 0 15px;
margin: 0 0 20px;
font-size: 10pt;
Expand Down
2 changes: 1 addition & 1 deletion packages/css/latex2js.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ span.tt {
font-family: courier;
}

p.quotation {
blockquote.quotation {
padding: 0 0 0 15px;
margin: 0 0 20px;
font-size: 10pt;
Expand Down
2 changes: 1 addition & 1 deletion packages/latex2js/latex2js.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ span.tt {
font-family: courier;
}

p.quotation {
blockquote.quotation {
padding: 0 0 0 15px;
margin: 0 0 20px;
font-size: 10pt;
Expand Down
4 changes: 2 additions & 2 deletions packages/latex2js/src/lib/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function closed(): string {
}

export const Functions = {
bq: () => '<p class="quotation">',
bq: () => '<blockquote class="quotation">',
claim(this: any, m?: any) { return headed('Claim', 'claim', this, m); },
corollary(this: any, m?: any) { return headed('Corollary', 'corollary', this, m); },
definition(this: any, m?: any) { return headed('Definition', 'definition', this, m); },
Expand All @@ -96,7 +96,7 @@ export const Functions = {
endproblem: () => closed(),
endsolution: () => closed(),
endtheorem: () => closed(),
eq: () => '</p>',
eq: () => '</blockquote>',
example(this: any, m?: any) { return headed('Example', 'example', this, m); },
problem(this: any, m?: any) { return headed('Problem', 'problem', this, m); },
proof: () => '<div class="theorem-env theorem-env--proof"><h4 class="theorem-head">Proof</h4> ',
Expand Down
2 changes: 1 addition & 1 deletion packages/latex2js/src/lib/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ class Parser {
*/
paragraphize(lines: string[]): string[] {
const isBlock = (l: string) =>
/^\s*<(h[1-6]|ul|ol|li|p|div|table|blockquote|pre|figure)\b/i.test(l);
/^\s*<\/?(h[1-6]|ul|ol|li|p|div|table|blockquote|pre|figure)\b/i.test(l);
// Display-math environments MathJax recognizes in running text. One is a
// single unit however many lines it spans: splitting it across paragraph
// elements breaks the begin/end into separate text nodes, and MathJax can
Expand Down
15 changes: 15 additions & 0 deletions packages/latex2js/test/math-env-paragraphs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,19 @@ After.
expect(paras.some((l: string) => l.includes('Before.'))).toBe(true);
expect(paras.some((l: string) => l.includes('After.'))).toBe(true);
});

it('nests quotation paragraphs inside the quotation wrapper', () => {
const parsed = latex.parse(`
\\begin{quotation}
Quoted text.
\\end{quotation}
`);
const math = parsed.find((el: any) => el.type === 'math');
const output = math.lines.join('\n');

expect(output).toContain('<blockquote class="quotation">');
expect(output).toContain('<p class="para">Quoted text.');
expect(output).toMatch(/<p class="para">Quoted text\.<\/p>\s*<\/blockquote>/);
expect(output).not.toContain('<blockquote class="quotation">\n</blockquote>');
});
});
Loading