From 0809260a32c6c6affff10ca4b39e0e29f66b84ab Mon Sep 17 00:00:00 2001
From: Nahlee Naria Khan <95993773+renee-k@users.noreply.github.com>
Date: Tue, 9 Jul 2024 19:40:21 -0400
Subject: [PATCH] added another tabular test
---
.../libs/unified-latex-plugin-to-xml-like.ts | 11 +-
.../tests/unified-latex-to-pretext.test.ts | 131 +++++++++++++++++-
2 files changed, 132 insertions(+), 10 deletions(-)
diff --git a/packages/unified-latex-to-pretext/libs/unified-latex-plugin-to-xml-like.ts b/packages/unified-latex-to-pretext/libs/unified-latex-plugin-to-xml-like.ts
index 98143fc8..db03e1da 100644
--- a/packages/unified-latex-to-pretext/libs/unified-latex-plugin-to-xml-like.ts
+++ b/packages/unified-latex-to-pretext/libs/unified-latex-plugin-to-xml-like.ts
@@ -64,11 +64,10 @@ export const unifiedLatexToXmlLike: Plugin<
_environmentReplacements,
options?.environmentReplacements || {}
);
- const producePretextFragment = Object.assign(
- {},
- false,
- options?.producePretextFragment || {}
- );
+ const producePretextFragment = options?.producePretextFragment
+ ? options?.producePretextFragment
+ : false;
+
const isReplaceableMacro = match.createMacroMatcher(macroReplacements);
const isReplaceableEnvironment = match.createEnvironmentMatcher(
environmentReplacements
@@ -136,8 +135,6 @@ export const unifiedLatexToXmlLike: Plugin<
);
}
});
-
- // if (!options.producePretextFragment) {
if (!producePretextFragment) {
// Wrap in enough tags to ensure a valid pretext document
// ...
diff --git a/packages/unified-latex-to-pretext/tests/unified-latex-to-pretext.test.ts b/packages/unified-latex-to-pretext/tests/unified-latex-to-pretext.test.ts
index 0617af2e..8ab05609 100644
--- a/packages/unified-latex-to-pretext/tests/unified-latex-to-pretext.test.ts
+++ b/packages/unified-latex-to-pretext/tests/unified-latex-to-pretext.test.ts
@@ -117,7 +117,7 @@ describe("unified-latex-to-pretext:unified-latex-to-pretext", () => {
html = process(`a\\href{foo.com}{FOO}b`);
expect(normalizeHtml(html)).toEqual(
// normalizeHtml(`aFOOb`)
- normalizeHtml(`a
tag for first two test cases - `
a
b
a
b
a
b
a
b
a
b
a
b
...
tags", () => { + html = process(`a\\par b`); + expect(normalizeHtml(html)).toEqual(normalizeHtml(`a
b
`)); + + html = process(`a\n\n b`); + expect(normalizeHtml(html)).toEqual(normalizeHtml(`a
b
`)); + + html = process(`a\n b\n\nc`); + expect(normalizeHtml(html)).toEqual( + normalizeHtml(`a b
c
`) + ); + html = process(`a\\section{foo} b\n\nc`); + expect(normalizeHtml(html)).toEqual( + normalizeHtml(`a
b
c
`) + ); + html = process(`a\\section{foo} b\\section{bar}\n\nc`); + expect(normalizeHtml(html)).toEqual( + normalizeHtml( + `a
b
c
` + ) + ); + html = process(`a\n \\emph{b}\n\nc`); + expect(normalizeHtml(html)).toEqual( + normalizeHtml(`a b
c
`) + ); + html = process(`a\n b\\begin{foo}x\\end{foo}c\n\nd`); + expect(normalizeHtml(html)).toEqual( + normalizeHtml(`a b
c
d
`) + ); + }); + + // output usedx
y
z
` + // ) + normalizeHtml(`x
y
z
`) + ); + }); + it.skip("Converts tabular environment with same column alignments", () => { + html = process(`\\begin{tabular}{l l}a & b\\\\c & d\\end{tabular}`); + expect(normalizeHtml(html)).toEqual( + // normalizeHtml( + // `a | + //b | + //
c | + //d | + //
...
tags", () => { html = process(`a\\par b`); expect(normalizeHtml(html)).toEqual(normalizeHtml(`a
b
`));