Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/unit/pandoc.test.ts
6449 views
1
/*
2
* pandoc.test.ts
3
*
4
* Copyright (C) 2020-2022 Posit Software, PBC
5
*
6
*/
7
import { assert, assertEquals } from "testing/asserts";
8
import { getenv } from "../../src/core/env.ts";
9
import { parsePandocTitle } from "../../src/core/pandoc/pandoc-partition.ts";
10
import { pandocBinaryPath, resourcePath } from "../../src/core/resources.ts";
11
import { unitTest } from "../test.ts";
12
13
// RStudio Workbench {{< var buildType >}} {{< var version >}}
14
// ### Prerequisites
15
// Administrative Dashboard [PRO]{.pro-header}
16
// Customizing the Sign-In Page
17
// # /etc/rstudio/rserver.conf
18
// ## R Versions {.pro-header}
19
20
unitTest(
21
"pandoc",
22
//deno-lint-ignore require-await
23
async () => {
24
const title = parsePandocTitle("# RStudio Server [PRO]{.cool-item}");
25
assert(title.heading === "RStudio Server [PRO]{.cool-item}");
26
27
const title2 = parsePandocTitle(
28
"# RStudio Server [PRO]{.cool-item} {.foobar}",
29
);
30
assert(title2.heading === "RStudio Server [PRO]{.cool-item}");
31
assert(title2.attr?.classes.includes("foobar"));
32
33
const title3 = parsePandocTitle(
34
"# What is up dog?",
35
);
36
assert(title3.heading === "What is up dog?");
37
38
const title4 = parsePandocTitle(
39
"# What is up dog? {.section-heading}",
40
);
41
assert(title4.heading === "What is up dog?");
42
assert(
43
title4.attr?.classes.length === 1 &&
44
title4.attr.classes.includes("section-heading"),
45
);
46
},
47
);
48
49