diff --git a/bundle/latex2html5.bundle.js b/bundle/latex2html5.bundle.js index 2567407..0b608e7 100644 --- a/bundle/latex2html5.bundle.js +++ b/bundle/latex2html5.bundle.js @@ -2222,7 +2222,7 @@ var LaTeX2HTML5 = (() => { return ""; } var Functions2 = { - bq: () => '

', + bq: () => '

', claim(m) { return headed("Claim", "claim", this, m); }, @@ -2267,7 +2267,7 @@ var LaTeX2HTML5 = (() => { endproblem: () => closed(), endsolution: () => closed(), endtheorem: () => closed(), - eq: () => "

", + eq: () => "
", example(m) { return headed("Example", "example", this, m); }, @@ -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 = []; diff --git a/bundle/latex2js.css b/bundle/latex2js.css index a08c09d..708d61c 100644 --- a/bundle/latex2js.css +++ b/bundle/latex2js.css @@ -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; diff --git a/packages/css/latex2js.css b/packages/css/latex2js.css index a08c09d..708d61c 100644 --- a/packages/css/latex2js.css +++ b/packages/css/latex2js.css @@ -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; diff --git a/packages/latex2js/latex2js.css b/packages/latex2js/latex2js.css index a08c09d..708d61c 100644 --- a/packages/latex2js/latex2js.css +++ b/packages/latex2js/latex2js.css @@ -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; diff --git a/packages/latex2js/src/lib/headers.ts b/packages/latex2js/src/lib/headers.ts index b644ee0..bb89333 100644 --- a/packages/latex2js/src/lib/headers.ts +++ b/packages/latex2js/src/lib/headers.ts @@ -71,7 +71,7 @@ function closed(): string { } export const Functions = { - bq: () => '

', + bq: () => '

', 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); }, @@ -96,7 +96,7 @@ export const Functions = { endproblem: () => closed(), endsolution: () => closed(), endtheorem: () => closed(), - eq: () => '

', + eq: () => '
', example(this: any, m?: any) { return headed('Example', 'example', this, m); }, problem(this: any, m?: any) { return headed('Problem', 'problem', this, m); }, proof: () => '

Proof

', diff --git a/packages/latex2js/src/lib/parser.ts b/packages/latex2js/src/lib/parser.ts index c4ff288..5696e6d 100644 --- a/packages/latex2js/src/lib/parser.ts +++ b/packages/latex2js/src/lib/parser.ts @@ -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 diff --git a/packages/latex2js/test/math-env-paragraphs.test.ts b/packages/latex2js/test/math-env-paragraphs.test.ts index f7ea1af..65f78b0 100644 --- a/packages/latex2js/test/math-env-paragraphs.test.ts +++ b/packages/latex2js/test/math-env-paragraphs.test.ts @@ -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('
'); + expect(output).toContain('

Quoted text.'); + expect(output).toMatch(/

Quoted text\.<\/p>\s*<\/blockquote>/); + expect(output).not.toContain('

\n
'); + }); });