diff --git a/README.md b/README.md index 413c97c..9f74e19 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ ccbr_tools --help Commands: send-email Send an email (works on biowulf) - quarto-add Add a quarto extension + quarto-add Add a quarto extension from the CCBR GitHub organization. install Install a specific version of a CCBR software package,... cite Print the citation in the desired format version Print the version of ccbr_tools diff --git a/src/ccbr_tools/__main__.py b/src/ccbr_tools/__main__.py index 95e931a..35f67f9 100755 --- a/src/ccbr_tools/__main__.py +++ b/src/ccbr_tools/__main__.py @@ -13,7 +13,7 @@ CustomClickGroup, ) from .send_email import send_email_msg -from .templates import use_quarto_ext, get_quarto_extensions +from .templates import use_quarto_ext from .software import install as install_software @@ -136,7 +136,7 @@ def send_email(to_address, text, subject, attach_html, from_addr, debug): send_email_msg(to_address, text, subject, attach_html, from_addr, debug) -@click.command(epilog=f"Available extensions: {', '.join(get_quarto_extensions())}") +@click.command() @click.argument( "ext_name", type=str, @@ -144,11 +144,13 @@ def send_email(to_address, text, subject, attach_html, from_addr, debug): ) def quarto_add(ext_name): """ - Add a quarto extension + Add a quarto extension from the CCBR GitHub organization. + + Runs `quarto use template CCBR/quarto-{ext_name}`. \b Arguments: - ext_name The name of the extension in ccbr_tools + ext_name The name of the extension (e.g. "fnl" for CCBR/quarto-fnl) \b Examples: diff --git a/src/ccbr_tools/templates/__init__.py b/src/ccbr_tools/templates/__init__.py index 4161175..a2dec04 100755 --- a/src/ccbr_tools/templates/__init__.py +++ b/src/ccbr_tools/templates/__init__.py @@ -13,7 +13,7 @@ Quarto HTML format with FNL branding guidelines -First run `ccbr_tools quarto-add fnl`, then modify your `_quarto.yml` file with the following: +First run `ccbr_tools quarto-add fnl` (which runs `quarto use template CCBR/quarto-fnl`), then modify your `_quarto.yml` file with the following: ```yaml website: @@ -30,8 +30,7 @@ """ import importlib.resources -import pathlib -import shutil +import subprocess def read_template(template_name): @@ -98,22 +97,20 @@ def get_quarto_extensions(): def use_quarto_ext(ext_name): """ - Use a Quarto extension + Use a Quarto extension from the CCBR GitHub organization. + + Runs `quarto use template CCBR/quarto-{ext_name}`. Args: - ext_name (str): The name of the extension in ccbr_tools + ext_name (str): The name of the Quarto extension (e.g. "fnl" for CCBR/quarto-fnl). + + Raises: + subprocess.CalledProcessError: If the quarto command fails. Examples: >>> use_quarto_ext("fnl") """ - ext_dir = importlib.resources.files(__package__) / "_extensions" - template_dir = ext_dir / ext_name - if not template_dir.exists() and not (template_dir / "_extension.yml").is_file(): - raise FileNotFoundError( - f"{ext_name} does not exist. Available extensions: {', '.join(get_quarto_extensions())}" - ) - out_dir = pathlib.Path("_extensions") - if not out_dir.exists(): - out_dir.mkdir() - shutil.copytree(template_dir, out_dir / ext_name, dirs_exist_ok=True) - print(f"Copied {ext_name} to {out_dir}") + subprocess.run( + ["quarto", "use", "template", f"CCBR/quarto-{ext_name}"], + check=True, + ) diff --git a/src/ccbr_tools/templates/_extensions/__init__.py b/src/ccbr_tools/templates/_extensions/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/ccbr_tools/templates/_extensions/fnl/__init__.py b/src/ccbr_tools/templates/_extensions/fnl/__init__.py deleted file mode 100644 index 64660e6..0000000 --- a/src/ccbr_tools/templates/_extensions/fnl/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -""" -Quarto HTML format with FNL branding guidelines - -First run `ccbr_tools quarto-add fnl`, then modify the `_quarto.yml` file with the following: - -```yaml -website: - ... - page-footer: - background: black - foreground: white - center: | - Created by the - [CCR Collaborative Bioinformatics Resource](https://github.com/CCBR) - -format: fnl-html -``` -""" diff --git a/src/ccbr_tools/templates/_extensions/fnl/_extension.yml b/src/ccbr_tools/templates/_extensions/fnl/_extension.yml deleted file mode 100644 index fd0e589..0000000 --- a/src/ccbr_tools/templates/_extensions/fnl/_extension.yml +++ /dev/null @@ -1,14 +0,0 @@ -title: fnl -author: Kelly Sovacool -version: 0.1.3 -quarto-required: ">=1.5.0" -contributes: - formats: - html: - theme: - dark: [darkly, fnl-dark.scss] - light: [flatly, fnl-light.scss] - toc: true - code-fold: show - revealjs: - theme: fnl-light-revealjs.scss diff --git a/src/ccbr_tools/templates/_extensions/fnl/fnl-dark.scss b/src/ccbr_tools/templates/_extensions/fnl/fnl-dark.scss deleted file mode 100644 index af1ba6e..0000000 --- a/src/ccbr_tools/templates/_extensions/fnl/fnl-dark.scss +++ /dev/null @@ -1,51 +0,0 @@ -// override select variables from fnl-light.scss -/*-- scss:defaults --*/ - -// branding guidelines -// https://nih.sharepoint.com/:b:/r/sites/NCI-Fred/Communications/Shared%20Documents/Branding%20guidelines%20LIVE.pdf?csf=1&web=1&e=e9PrVO - -// primary colors -$black: #000000; -$white: #ffffff; -$lime: #7cc349; -$teal: #296b7f; - -//secondary colors -$teal-light: #4e9db5; -$teal-dark: #19424e; -$almost-black: #03191f; -$lime-light: #b1ee85; -$lime-dark: #528230; -$orange: #ecba4c; - -// set colors -$primary: $teal; -$secondary: $lime; - -$body-bg: $almost-black; -$link-color: $lime; - -$navbar-bg: $teal-dark; -$navbar-hl: $lime-light; -$footer-bg: $black; -$footer-fg: $white; -$footer-hl: $lime-light; -$sidebar-hl: $lime-light; - -$code-block-bg-alpha: -0.8; -$code-bg-alpha: -0.8; -$code-alpha: 0.9; -$code-bg: $teal-dark; -$code-color: $orange; - -$callout-color-tip: $lime; -$callout-color-note: $teal-light; -$callout-color-caution: $orange; -$callout-color-warning: $orange; - -// font -$font-family-sans-serif: "Roboto", Helvetica, "Source Sans Pro", sans-serif; -$font-family-monospace: - "Roboto Mono", - "Andale Mono" "Source Code Pro", - monospace; diff --git a/src/ccbr_tools/templates/_extensions/fnl/fnl-light-revealjs.scss b/src/ccbr_tools/templates/_extensions/fnl/fnl-light-revealjs.scss deleted file mode 100644 index 07bd85f..0000000 --- a/src/ccbr_tools/templates/_extensions/fnl/fnl-light-revealjs.scss +++ /dev/null @@ -1,153 +0,0 @@ -/*-- scss:defaults --*/ - -// branding guidelines -// https://nih.sharepoint.com/:b:/r/sites/NCI-Fred/Communications/Shared%20Documents/Branding%20guidelines%20LIVE.pdf?csf=1&web=1&e=e9PrVO - -// primary colors -$black: #000000; -$white: #ffffff; -$lime: #7cc349; -$teal: #296b7f; - -//secondary colors -$teal-light: #4e9db5; -$teal-dark: #19424e; -$almost-black: #03191f; -$lime-light: #b1ee85; -$lime-dark: #528230; -$orange: #ecba4c; - -// set colors -$primary: $teal-dark; -$secondary: $lime; -$success: $lime-dark; -$warning: $orange; -$info: $teal-light; - -$link-color: $teal; - -$footer-bg: $black; -$footer-fg: $white; - -$code-color: $lime-dark; - -$callout-color-tip: $lime-dark; -$callout-color-note: $teal-light; -$callout-color-caution: $orange; -$callout-color-warning: $orange; - -// font -$font-family-sans-serif: "Roboto", Helvetica, "Source Sans Pro", sans-serif; -$font-family-monospace: - "Roboto Mono", - "Andale Mono" "Source Code Pro", - monospace; - -$presentation-font-size-root: 32px; -$presentation-heading-color: $teal; -$body-color: $black; - -/*-- scss:rules --*/ - -.reveal .slide blockquote { - border-left: 3px solid $teal !important; - padding-left: 0.5em !important; -} - -.reveal .slide-logo { - bottom: 10px !important; - right: 20px !important; - height: 65px !important; - width: auto !important; - max-width: unset !important; - max-height: unset !important; - position: fixed; -} - -.reveal .subtitle { - color: $presentation-heading-color !important; - font-size: $presentation-h3-font-size !important; -} -/* can't figure out how to override author class? -.reveal .author { - color: $body-color !important; -} -*/ -.reveal .date { - color: $body-color !important; -} - -.small-text { - font-size: small !important; -} - -.smaller-text { - font-size: smaller !important; -} - -.x-small-text { - font-size: x-small !important; -} - -.medium-text { - font-size: medium !important; -} - -.large-text { - font-size: large !important; -} - -.color-muted { - color: $text-muted !important; -} - -.big-center { - font-size: 60px !important; - color: $lime-dark !important; - text-align: center !important; - vertical-align: middle !important; - padding: 200px 0; -} - -.align-center { - text-align: center !important; -} - -.align-right { - text-align: right !important; -} - -.big-middle { - font-size: xxx-large !important; - color: $lime-dark !important; - vertical-align: middle !important; - padding: 70px !important; -} - -.frame-box { - border: 3px solid $lime-dark !important; - border-radius: 5px !important; - padding: 0.5em !important; -} - -.filled-box { - border: 5px solid $lime-dark !important; - border-radius: 5px !important; - padding: 1px !important; - background: $lime-dark !important; - color: $white !important; -} - -.black-frame { - border: 2px solid $black !important; - border-radius: 2px !important; -} -.narrow-frame { - border: 1.5px solid !important; - border-radius: 2px !important; - //padding: 0.5px !important; - text-align: center !important; - font-size: large !important; - background: #cccccc !important; - color: $body-color !important; -} diff --git a/src/ccbr_tools/templates/_extensions/fnl/fnl-light.scss b/src/ccbr_tools/templates/_extensions/fnl/fnl-light.scss deleted file mode 100644 index b93f509..0000000 --- a/src/ccbr_tools/templates/_extensions/fnl/fnl-light.scss +++ /dev/null @@ -1,46 +0,0 @@ -/*-- scss:defaults --*/ - -// branding guidelines -// https://nih.sharepoint.com/:b:/r/sites/NCI-Fred/Communications/Shared%20Documents/Branding%20guidelines%20LIVE.pdf?csf=1&web=1&e=e9PrVO - -// primary colors -$black: #000000; -$white: #ffffff; -$lime: #7cc349; -$teal: #296b7f; - -//secondary colors -$teal-light: #4e9db5; -$teal-dark: #19424e; -$almost-black: #03191f; -$lime-light: #b1ee85; -$lime-dark: #528230; -$orange: #ecba4c; - -// set colors -$primary: $teal-dark; -$secondary: $lime; -$success: $lime-dark; -$warning: $orange; -$info: $teal-light; - -$link-color: $teal; - -$footer-bg: $black; -$footer-fg: $white; - -$code-color: $lime-dark; - -$callout-color-tip: $lime-dark; -$callout-color-note: $teal-light; -$callout-color-caution: $orange; -$callout-color-warning: $orange; - -// font -$font-family-sans-serif: "Roboto", Helvetica, "Source Sans Pro", sans-serif; -$font-family-monospace: - "Roboto Mono", - "Andale Mono" "Source Code Pro", - monospace; - -/*-- scss:rules --*/ diff --git a/src/ccbr_tools/templates/_extensions/fnl/fnl-logo-dark.png b/src/ccbr_tools/templates/_extensions/fnl/fnl-logo-dark.png deleted file mode 100644 index d9b9c7c..0000000 Binary files a/src/ccbr_tools/templates/_extensions/fnl/fnl-logo-dark.png and /dev/null differ diff --git a/src/ccbr_tools/templates/_extensions/fnl/fnl-logo-light.png b/src/ccbr_tools/templates/_extensions/fnl/fnl-logo-light.png deleted file mode 100644 index d6eb422..0000000 Binary files a/src/ccbr_tools/templates/_extensions/fnl/fnl-logo-light.png and /dev/null differ