quarto-dev / quarto-dev/quarto-cli

Expose all LUA variables to Quarto meta shortcode

Open
#4,770 4 comments 5 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Mar 11, 2023.

enhancement lua
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

As originally discussed in #2249, here is a separate issue to discuss exposing LUA variables.

Currently, users do not have access to all LUA variables (from Quarto and Pandoc) which could be useful.
With that in mind I wrote a LUA filter/shortcode (https://github.com/mcanouil/quarto-lua-env) to expose the following objects recursively, or at least the scalar variables.

lua-env:
  quarto: "quarto"
  pandoc:
    PANDOC_STATE: "PANDOC_STATE"
    FORMAT: "FORMAT"
    PANDOC_READER_OPTIONS: "PANDOC_READER_OPTIONS"
    PANDOC_WRITER_OPTIONS: "PANDOC_WRITER_OPTIONS"
    PANDOC_VERSION: "PANDOC_VERSION"
    PANDOC_API_VERSION: "PANDOC_API_VERSION"
    PANDOC_SCRIPT_FILE: "PANDOC_SCRIPT_FILE"

Variables can be accessed using:

  • {{< lua-env pandoc.PANDOC_VERSION >}}
  • {{< meta lua-env.pandoc.PANDOC_VERSION >}}
  • {{< lua-env quarto.doc.input_file >}}
  • {{< meta lua-env.quarto.doc.input_file >}}

This could be integrated into Quarto if deemed useful to have such behaviour as exposing "all" LUA variables to shortcode for use in Quarto document and possibly in code cells in the future.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.