Skip to content

Commit c639a58

Browse files
authored
Merge branch 'main' into brand/bootstrap-parts
2 parents b65f9ac + 73f8183 commit c639a58

File tree

38 files changed

+330
-399
lines changed

38 files changed

+330
-399
lines changed

news/changelog-1.6.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ All changes included in 1.6:
3838
- ([#10761](https://github.com/quarto-dev/quarto-cli/issues/10761)): Add support for `licence: CC0` to automatically link to Creative Commons licence [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/).
3939
- ([#10817](https://github.com/quarto-dev/quarto-cli/issues/10817)): Ensure that user provided SCSS has precedent over quarto generated scss also for dark theme.
4040
- ([#11124](https://github.com/quarto-dev/quarto-cli/pull/11124)): Use stable order of GLightbox options
41+
- ([#11401](https://github.com/quarto-dev/quarto-cli/issues/11401)): Use EJS comment syntax to hide internal TODO notes from the output.
4142

4243
## `revealjs` Format
4344

package/launcher/src/main.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,9 @@ fn main() {
8787
String::from("--no-config"),
8888
String::from("--cached-only"),
8989
String::from("--no-lock"),
90-
String::from("--allow-read"),
91-
String::from("--allow-write"),
92-
String::from("--allow-run"),
93-
String::from("--allow-env"),
94-
String::from("--allow-net"),
95-
String::from("--allow-ffi"),
90+
// Using --allow-all as there is otherwise an issue in Deno 1.46.3 with --allow-read and --allow-write with network drives
91+
// https://github.com/quarto-dev/quarto-cli/issues/11332
92+
String::from("--allow-all"),
9693
];
9794

9895
// # --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737

package/scripts/common/quarto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ fi
169169
export DENO_TLS_CA_STORE=system,mozilla
170170
export DENO_NO_UPDATE_CHECK=1
171171
# Be sure to include any already defined QUARTO_DENO_OPTIONS
172-
QUARTO_DENO_OPTIONS="--unstable-ffi --unstable-kv --no-config --no-lock ${QUARTO_CACHE_OPTIONS} --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi ${QUARTO_DENO_OPTIONS}"
172+
## Using --allow-all as there is otherwise an issue in Deno 1.46.3 with --allow-read and --allow-write with network drives
173+
## https://github.com/quarto-dev/quarto-cli/issues/11332
174+
QUARTO_DENO_OPTIONS="--unstable-ffi --unstable-kv --no-config --no-lock ${QUARTO_CACHE_OPTIONS} --allow-all ${QUARTO_DENO_OPTIONS}"
173175

174176
# --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737
175177
if [ "$QUARTO_DENO_V8_OPTIONS" != "" ]; then

package/scripts/windows/quarto.cmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ IF NOT DEFINED QUARTO_DENO (
105105

106106
SET "DENO_TLS_CA_STORE=system,mozilla"
107107
SET "DENO_NO_UPDATE_CHECK=1"
108-
SET "QUARTO_DENO_OPTIONS=--unstable-kv --unstable-ffi --no-config --no-lock --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi !QUARTO_DENO_OPTIONS!"
108+
REM Using --allow-all as there is otherwise an issue in Deno 1.46.3 with --allow-read and --allow-write with network drives
109+
REM https://github.com/quarto-dev/quarto-cli/issues/11332
110+
SET "QUARTO_DENO_OPTIONS=--unstable-kv --unstable-ffi --no-config --no-lock --allow-all !QUARTO_DENO_OPTIONS!"
109111

110112
REM Add expected V8 options to QUARTO_DENO_V8_OPTIONS
111113
IF DEFINED QUARTO_DENO_V8_OPTIONS (

package/src/common/compile-quarto-latexmk.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,18 @@ export function compileQuartoLatexmkCommand() {
6868
});
6969
}
7070

71+
// Using --allow-all as there is otherwise an issue in Deno 1.46.3 with --allow-read and --allow-write with network drives
72+
// https://github.com/quarto-dev/quarto-cli/issues/11332
73+
/*
7174
const kFlags = [
7275
"--allow-read",
7376
"--allow-write",
7477
"--allow-run",
7578
"--allow-env",
7679
"--allow-net",
7780
];
81+
*/
82+
const kFlags = ["--allow-all"];
7883

7984
export async function installQuartoLatexmk(
8085
config: Configuration,

package/src/quarto-bld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export DENO_NO_UPDATE_CHECK=1
1717

1818
# TODO: Consider generating a source map or something to get a good stack
1919
# Create the Deno bundle
20-
"$QUARTO_DENO" run --no-check --unstable-kv --unstable-ffi --allow-env --allow-read --allow-write --allow-run --allow-net --allow-ffi --v8-flags=--stack-trace-limit=100 --importmap="${SCRIPT_PATH}/../../src/import_map.json" "$SCRIPT_PATH/bld.ts" $@
20+
"$QUARTO_DENO" run --no-check --unstable-kv --unstable-ffi --allow-all --v8-flags=--stack-trace-limit=100 --importmap="${SCRIPT_PATH}/../../src/import_map.json" "$SCRIPT_PATH/bld.ts" $@

package/src/quarto-bld.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ if NOT DEFINED QUARTO_DENO (
99
SET "RUST_BACKTRACE=full"
1010
SET "DENO_NO_UPDATE_CHECK=1"
1111

12-
"%QUARTO_DENO%" run --unstable-kv --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi --importmap=%~dp0\..\..\src\dev_import_map.json %~dp0\bld.ts %*
12+
"%QUARTO_DENO%" run --unstable-kv --unstable-ffi --allow-all --importmap=%~dp0\..\..\src\dev_import_map.json %~dp0\bld.ts %*

src/command/render/pandoc-html.ts

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {
1414
kQuartoCssVariables,
1515
kTextHighlightingMode,
1616
SassBundle,
17+
SassBundleWithBrand,
18+
SassLayer,
1719
} from "../../config/types.ts";
1820
import { ProjectContext } from "../../project/types.ts";
1921

@@ -39,6 +41,7 @@ import { kSassBundles } from "../../config/types.ts";
3941
import { md5HashBytes } from "../../core/hash.ts";
4042
import { InternalError } from "../../core/lib/error.ts";
4143
import { writeTextFileSyncPreserveMode } from "../../core/write.ts";
44+
import { assert } from "testing/asserts";
4245

4346
// The output target for a sass bundle
4447
// (controls the overall style tag that is emitted)
@@ -57,12 +60,12 @@ export async function resolveSassBundles(
5760
) {
5861
extras = cloneDeep(extras);
5962

60-
const mergedBundles: Record<string, SassBundle[]> = {};
63+
const mergedBundles: Record<string, SassBundleWithBrand[]> = {};
6164

6265
// groups the bundles by dependency name
6366
const group = (
64-
bundles: SassBundle[],
65-
groupedBundles: Record<string, SassBundle[]>,
67+
bundles: SassBundleWithBrand[],
68+
groupedBundles: Record<string, SassBundleWithBrand[]>,
6669
) => {
6770
bundles.forEach((bundle) => {
6871
if (!groupedBundles[bundle.dependency]) {
@@ -82,19 +85,37 @@ export async function resolveSassBundles(
8285
let defaultStyle: "dark" | "light" | undefined = undefined;
8386
for (const dependency of Object.keys(mergedBundles)) {
8487
// compile the cssPath
85-
const bundles = mergedBundles[dependency];
88+
const bundlesWithBrand = mergedBundles[dependency];
89+
// first, pull out the brand-specific layers
90+
//
91+
// the brand bundle itself doesn't have any 'brand' entries;
92+
// those are used to specify where the brand-specific layers should be inserted
93+
// in the final bundle. We filter
94+
const brandLayersMaybeBrand = bundlesWithBrand.find((bundle) =>
95+
bundle.key === "brand"
96+
)?.user || [];
97+
assert(!brandLayersMaybeBrand.find((v) => v === "brand"));
98+
const brandLayers = brandLayersMaybeBrand as SassLayer[];
99+
const bundles: SassBundle[] = bundlesWithBrand.filter((bundle) =>
100+
bundle.key !== "brand"
101+
).map((bundle) => {
102+
const userBrand = bundle.user?.findIndex((layer) => layer === "brand");
103+
if (userBrand && userBrand !== -1) {
104+
bundle = cloneDeep(bundle);
105+
bundle.user!.splice(userBrand, 1, ...brandLayers);
106+
}
107+
return bundle as SassBundle;
108+
});
86109

87110
// See if any bundles are providing dark specific css
88111
const hasDark = bundles.some((bundle) => bundle.dark !== undefined);
89-
defaultStyle = bundles.some((bundle) =>
90-
bundle.dark !== undefined && bundle.dark.default
91-
)
92-
? "dark"
93-
: "light";
94-
112+
defaultStyle =
113+
bundles.some((bundle) => bundle.dark !== undefined && bundle.dark.default)
114+
? "dark"
115+
: "light";
95116
const targets: SassTarget[] = [{
96117
name: `${dependency}.min.css`,
97-
bundles,
118+
bundles: (bundles as any),
98119
attribs: {
99120
"append-hash": "true",
100121
},
@@ -119,7 +140,7 @@ export async function resolveSassBundles(
119140
});
120141
targets.push({
121142
name: `${dependency}-dark.min.css`,
122-
bundles: darkBundles,
143+
bundles: darkBundles as any,
123144
attribs: {
124145
"append-hash": "true",
125146
...attribForThemeStyle("dark", defaultStyle),
@@ -141,6 +162,9 @@ export async function resolveSassBundles(
141162
// it can happen that processing generate an empty css file (e.g quarto-html deps with Quarto CSS variables)
142163
// in that case, no need to insert the cssPath in the dependency
143164
if (!cssPath) continue;
165+
if (Deno.readTextFileSync(cssPath).length === 0) {
166+
continue;
167+
}
144168

145169
// Process attributes (forward on to the target)
146170
for (const bundle of target.bundles) {

src/config/types.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,28 @@ export interface SassLayer {
305305
rules: string;
306306
}
307307

308+
export interface SassBundleLayersWithBrand {
309+
key: string;
310+
user?: (SassLayer | "brand")[];
311+
quarto?: SassLayer;
312+
framework?: SassLayer;
313+
loadPaths?: string[];
314+
}
315+
316+
export interface SassBundleWithBrand extends SassBundleLayersWithBrand {
317+
dependency: string;
318+
dark?: {
319+
user?: (SassLayer | "brand")[];
320+
quarto?: SassLayer;
321+
framework?: SassLayer;
322+
default?: boolean;
323+
};
324+
attribs?: Record<string, string>;
325+
}
326+
308327
export interface SassBundleLayers {
309328
key: string;
310-
user?: SassLayer;
329+
user?: SassLayer[];
311330
quarto?: SassLayer;
312331
framework?: SassLayer;
313332
loadPaths?: string[];
@@ -316,7 +335,7 @@ export interface SassBundleLayers {
316335
export interface SassBundle extends SassBundleLayers {
317336
dependency: string;
318337
dark?: {
319-
user?: SassLayer;
338+
user?: SassLayer[];
320339
quarto?: SassLayer;
321340
framework?: SassLayer;
322341
default?: boolean;
@@ -376,7 +395,7 @@ export interface FormatExtras {
376395
templateContext?: FormatTemplateContext;
377396
html?: {
378397
[kDependencies]?: FormatDependency[];
379-
[kSassBundles]?: SassBundle[];
398+
[kSassBundles]?: SassBundleWithBrand[];
380399
[kBodyEnvelope]?: BodyEnvelope;
381400
[kHtmlPostprocessors]?: Array<HtmlPostProcessor>;
382401
[kHtmlFinalizers]?: Array<

src/core/css.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ export function asCssFont(value: unknown): string | undefined {
9090
.split(",")
9191
.map((font) => {
9292
font = font.trim();
93-
if (font.includes(" ")) {
93+
if (
94+
font.includes(" ") && !font.startsWith('"') && !font.startsWith("'")
95+
) {
9496
font = `"${font}"`;
9597
}
9698
return font;

0 commit comments

Comments
 (0)