From 94a4b39793110e99a74f24e39226ea63a76239f8 Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Mon, 10 Jun 2024 12:28:31 -0400 Subject: [PATCH] Fix name --- paper/{prepare-myst.ts => export-pdf.ts} | 28 +++++++++++++++++++++++- paper/myst.yml | 22 +++++++++---------- 2 files changed, 37 insertions(+), 13 deletions(-) rename paper/{prepare-myst.ts => export-pdf.ts} (68%) diff --git a/paper/prepare-myst.ts b/paper/export-pdf.ts similarity index 68% rename from paper/prepare-myst.ts rename to paper/export-pdf.ts index cb318ff7..995b35a7 100644 --- a/paper/prepare-myst.ts +++ b/paper/export-pdf.ts @@ -5,6 +5,8 @@ let [frontMatter, raw] = Deno.readTextFileSync("paper.md") .replace("---", "") .split("---"); +let output = Deno.args[0] || "dist/paper.pdf"; + let data = parse(frontMatter); // biome-ignore lint/performance/noDelete: delete data["affiliations"]; @@ -15,6 +17,19 @@ delete data["tags"]; // biome-ignore lint/performance/noDelete: delete data["date"]; +data["exports"] = { + format: "typst", + template: "lapreprint-typst", + output: output, +}; + +data["margin"] = [ + { + "title": "Correspondence to", + "content": "Correspondence: [author-email]", + } +] + let markdown = raw // Replace markdown images with myst images .replace(/!\[(.*?)\]\((.*?)\)/g, (_, alt: string, filepath: string) => { @@ -33,10 +48,21 @@ ${content} .replace("# Overview", "# Project Overview"); Deno.writeTextFileSync( - "main.md", + "tmp.md", `\ --- ${stringify(data)} --- ${markdown}`, ); + +new Deno.Command("myst", { args: ["build", "--pdf", "tmp.md"] }) + .output() + .then((data) => { + console.log(data) + console.log(`PDF saved to ${output}`); + }) + .catch(console.error) + .finally(async () => { + await Deno.remove("tmp.md"); + }); diff --git a/paper/myst.yml b/paper/myst.yml index ad007eb5..8a9f9de2 100644 --- a/paper/myst.yml +++ b/paper/myst.yml @@ -1,34 +1,32 @@ version: 1 project: - title: 'anywidget: reusable widgets for interactive analysis and visualization in computational notebooks' - # Authors should have affiliations, emails and ORCIDs if available authors: - name: Trevor Manz - email: trevor_manz@g.harvard.edu + email: "trevor\_manz@g.harvard.edu" orcid: 0000-0001-7694-5164 affiliations: - - Department of Biomedical Informatics, Harvard Medical School, Boston, MA, USA - corresponding: true + - Department of Biomedical Informatics, Harvard Medical School + corresponding: "trevor\_manz@g.harvard.edu" - name: Nezar Abdennur - email: nezar.abdennur@umassmed.edu + email: "nezar.abdennur@umassmed.edu" orcid: 0000-0001-5814-0864 affiliations: - - Department of Genomics and Computational Biology, UMass Chan Medical School, Worcester, MA, USA - - Department of Systems Biology, UMass Chan Medical School, Worcester, MA, USA + - Department of Genomics and Computational Biology, UMass Chan Medical School + - Department of Systems Biology, UMass Chan Medical School - name: Nils Gehlenborg - email: nils@hms.harvard.edu + email: "nils@hms.harvard.edu" orcid: 0000-0003-0327-8297 affiliations: - - Department of Biomedical Informatics, Harvard Medical School, Boston, MA, USA + - Department of Biomedical Informatics, Harvard Medical School keywords: - Computational notebooks - Jupyter - Widgets - Python + - R - JavaScript - Data visualization - Interactive computing - abbreviations: JCP: Jupyter Compatible Platform AFM: Anywidget Front-End Module @@ -37,4 +35,4 @@ project: subject: Research Article open_access: true license: CC-BY-4.0 - date: 2024-07-10 + date: 2024-06-07