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
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src/resources/formats/revealjs/plugins/line-highlight/line-highlight.js
src/resources/formats/revealjs/plugins/menu/menu.js
src/resources/formats/revealjs/plugins/menu/quarto-menu.js
src/resources/formats/revealjs/plugins/multiplex/multiplex.js
src/resources/formats/revealjs/plugins/multiplex/socket.io.js
src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js
src/resources/formats/revealjs/plugins/support/support.js
src/resources/formats/revealjs/plugins/tone/tone.js
2 changes: 1 addition & 1 deletion configuration
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export CLIPBOARD_JS=2.0.11
export TIPPY_JS=6.3.7
export PDF_JS=2.8.335
# Using commit to fix https://github.com/quarto-dev/quarto-cli/issues/2430 - revert to using a release tag when included
export REVEAL_JS=e281b3234e7991283ce4dcca705dd9a6a9ebe5d2
export REVEAL_JS=e281b3234e7991283ce4dcca705dd9a6a9ebe5d2
export REVEAL_JS_MENU=2.1.0
export REVEAL_JS_CHALKBOARD=a88c134e2cf3c7780448db003e7329c3cbd8cfb4
export REVEAL_JS_PDFEXPORT=2.0.1
Expand Down
4 changes: 2 additions & 2 deletions package/src/bld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { configure } from "./common/configure.ts";
import { mainRunner } from "../../src/core/main.ts";

import { prepareDist } from "./common/prepare-dist.ts";
import { updateHtmlDepedencies } from "./common/update-html-dependencies.ts";
import { updateHtmlDependencies } from "./common/update-html-dependencies.ts";
import { makeInstallerDeb } from "./linux/installer.ts";
import { makeInstallerMac } from "./macos/installer.ts";
import {
Expand Down Expand Up @@ -64,7 +64,7 @@ function getCommands() {
),
);
commands.push(
packageCommand(updateHtmlDepedencies)
packageCommand(updateHtmlDependencies)
.name("update-html-dependencies")
.description(
"Updates Bootstrap, themes, and JS/CSS dependencies based upon the version in configuration",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From cdf668f9b164dca04eece54c88eaed4541211335 Mon Sep 17 00:00:00 2001
From: Christophe Dervieux <christophe.dervieux@gmail.com>
Date: Tue, 7 Mar 2023 16:12:53 +0100
Subject: [PATCH] Patch PdfExport RevealJS plugin to export toggle function

This will enable toggling PDF export mode using API
---
src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js b/src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js
index c399fa9de..bf9104c8e 100644
--- a/src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js
+++ b/src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js
@@ -101,6 +101,9 @@ var PdfExport = ( function( _Reveal ){
Reveal = _Reveal;
install();
};
+ Plugin.togglePdfExport = function () {
+ togglePdfExport();
+ };
}

return Plugin;
--
2.39.2.windows.1

27 changes: 23 additions & 4 deletions package/src/common/update-html-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { info } from "log/mod.ts";
import { dirname, extname, join } from "path/mod.ts";
import { lines } from "../../../src/core/text.ts";
import { runCmd } from "../util/cmd.ts";
import { Repo, withRepo } from "../util/git.ts";
import { applyGitPatches, Repo, withRepo } from "../util/git.ts";

import { download, unzip } from "../util/utils.ts";
import { Configuration } from "./config.ts";
import { visitLines } from "../../../src/core/file.ts";
import { copyMinimal } from "../../../src/core/copy.ts";

export async function updateHtmlDepedencies(config: Configuration) {
export async function updateHtmlDependencies(config: Configuration) {
info("Updating Bootstrap with version info:");

// Read the version information from the environment
Expand Down Expand Up @@ -57,6 +57,18 @@ export async function updateHtmlDepedencies(config: Configuration) {
"dist",
);

// For applying git patch to what we retreive
const patchesDir = join(
config.directoryInfo.pkg,
"src", "common", "patches"
)

function resolvePatches (patches: string[]) {
return patches.map(patch => {
return join(patchesDir, patch)
})
}

// Anchor
const anchorJs = join(formatDir, "anchor", "anchor.min.js");
await updateUnpkgDependency(
Expand Down Expand Up @@ -360,6 +372,7 @@ export async function updateHtmlDepedencies(config: Configuration) {
"plugins",
"pdfexport",
);

await updateGithubSourceCodeDependency(
"reveal-pdfexport",
"McShelby/reveal-pdfexport",
Expand All @@ -374,7 +387,10 @@ export async function updateHtmlDepedencies(config: Configuration) {
return Promise.resolve();
},
false, // not a commit
false, // no v prefix
false, // no v prefix,
resolvePatches([
"0001-Patch-PdfExport-RevealJS-plugin-to-export-toggle-fun.patch"
])
);

// Github CSS (used for GFM HTML preview)
Expand Down Expand Up @@ -492,6 +508,7 @@ export async function updateHtmlDepedencies(config: Configuration) {
info(
"\n** Done- please commit any files that have been updated. **\n",
);

}

async function updatePdfJs(
Expand Down Expand Up @@ -786,9 +803,10 @@ async function updateGithubSourceCodeDependency(
onDownload: (dir: string, version: string) => Promise<void>,
commit = false, // set to true when commit is used instead of a tag
vPrefix = true, // set to false if github tags don't use a v prefix
patches?: string[]
) {
info(`Updating ${name}...`);
const version = Deno.env.get(versionEnvVar);
const version = Deno.env.get(versionEnvVar)?.trim();
if (version) {
const fileName = `${name}.zip`;
const distUrl = join(
Expand All @@ -805,6 +823,7 @@ async function updateGithubSourceCodeDependency(
await unzip(zipFile, working);

await onDownload(working, version);
if (patches) await applyGitPatches(patches)
} else {
throw new Error(`${versionEnvVar} is not defined`);
}
Expand Down
24 changes: 24 additions & 0 deletions package/src/util/git.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { join } from "path/mod.ts";
import { info } from "log/mod.ts";
import * as colors from "fmt/colors.ts";

export interface Repo {
dir: string;
Expand Down Expand Up @@ -87,3 +88,26 @@ async function clone(workingDir: string, url: string) {
throw Error("No output from git clone");
}
}


export async function applyGitPatches(patches: string[]) {
if (!patches) return undefined
info(`Applying Git patches...`);
Promise.all(
patches.map( async (patch) => {
info(` - patch ${colors.blue(patch)}`)
const gitCmd: string[] = [];
gitCmd.push("git");
gitCmd.push("apply");
gitCmd.push(patch);
const p = Deno.run({
cmd: gitCmd,
stderr: "piped",
});
const status = await p.status();
if (status.code !== 0) {
throw Error("Failed to apply patch");
}
})
)
}
2 changes: 1 addition & 1 deletion src/format/reveal/format-reveal-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ function revealMenuTools(format: Format) {
{
title: "PDF Export Mode",
key: "e",
handler: "overview",
handler: "togglePdfExport",
},
];
if (format.metadata[kRevealChalkboard]) {
Expand Down
3 changes: 3 additions & 0 deletions src/resources/formats/revealjs/plugins/menu/quarto-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ window.RevealMenuToolHandlers = {
downloadDrawings: revealMenuToolHandler(function () {
RevealChalkboard.download();
}),
togglePdfExport: revealMenuToolHandler(function () {
PdfExport.togglePdfExport();
}),
};
3 changes: 3 additions & 0 deletions src/resources/formats/revealjs/plugins/pdfexport/pdfexport.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ var PdfExport = ( function( _Reveal ){
Reveal = _Reveal;
install();
};
Plugin.togglePdfExport = function () {
togglePdfExport();
};
}

return Plugin;
Expand Down