{"id":23150988,"url":"https://github.com/coatless-quarto/dependson","last_synced_at":"2025-04-04T14:44:06.633Z","repository":{"id":196812257,"uuid":"696650927","full_name":"coatless-quarto/dependson","owner":"coatless-quarto","description":"R\u0026D Quarto extension to explore working with Dependency among Quarto Extensions and Lua Filters","archived":false,"fork":false,"pushed_at":"2024-04-23T00:10:44.000Z","size":304,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-10T00:39:05.494Z","etag":null,"topics":["experiment","lua","lua-filter","pandoc","pandoc-filter","quarto","quarto-extension"],"latest_commit_sha":null,"homepage":"http://quarto.thecoatlessprofessor.com/dependson/","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coatless-quarto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["coatless"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-09-26T07:11:31.000Z","updated_at":"2024-04-23T00:05:27.000Z","dependencies_parsed_at":"2024-04-23T01:30:37.320Z","dependency_job_id":"7617e8bf-9307-48e4-bf03-17c9bd670c14","html_url":"https://github.com/coatless-quarto/dependson","commit_stats":null,"previous_names":["coatless-quarto/dependon"],"tags_count":0,"template":false,"template_full_name":"coatless-devcontainer/quarto-extension-dev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fdependson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fdependson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fdependson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-quarto%2Fdependson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coatless-quarto","download_url":"https://codeload.github.com/coatless-quarto/dependson/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247198431,"owners_count":20900079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["experiment","lua","lua-filter","pandoc","pandoc-filter","quarto","quarto-extension"],"created_at":"2024-12-17T18:19:42.724Z","updated_at":"2025-04-04T14:44:06.613Z","avatar_url":"https://github.com/coatless-quarto.png","language":"Lua","funding_links":["https://github.com/sponsors/coatless"],"categories":[],"sub_categories":[],"readme":"# dependson: A Quarto Experiment on Dependencies\n\nThe `dependson` extension is an experiment designed to explore variables and functions between Lua filters in the Quarto document generation system. This functionality can be useful within a single extension or even across different extensions.\n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/coatless-quarto/dependson)\n\n## Usage\n\nIt's important to note that the `dependson` extension doesn't introduce any significant improvements to your document content. Instead, it serves as a valuable example of how to reuse code and share variables and functions between different Lua filters.\n\n## Installation\n\nTo install the `dependson` extension, open your terminal and execute the following command:\n\n```bash\nquarto add coatless-quarto/dependson\n```\n\nThis command will download and install the extension under the `_extensions` subdirectory of your Quarto project. If you're using version control, make sure to include this directory in your repository.\n\n\n## Nesting Extensions\n\nLet's explore a folder structure that demonstrates the versatility of the `dependson` extension:\n\n```sh\n.\n├── example.qmd\n├── _extensions\n│   └── dependson\n│       ├── dependson.lua\n│       ├── _extensions\n│       │   └── coatless-quarto\n│       │       └── thedependency\n│       │           ├── _extension.yml\n│       │           └── thedependency.lua\n│       ├── _extension.yml\n│       ├── next-level\n│       │   └── nested.lua\n│       └── same-directory.lua\n└── README.md\n```\n\nIn this directory structure:\n\n1. The `dependson` extension consists of multiple Lua files located in different directories.\n2. We have an extension called `thedependency` nested within the main `dependson` extension.\n\nNow, let's see how we can retrieve values from the `next-level/nested.lua` module and the `thedependency` extension.\n\n### Retrieving Values from Lua Modules\n\nTo retrieve global variables (excluding those declared with the `local` keyword), you can use the `require` function to load the lua file containing the variable. In this example, the `dependson.lua` extension loads the `same-level.lua` module with `require(\"same-level\")` and the `nested.lua` module using `require(\"next-level/nested.lua\")`. This makes available the globally defined variables for output.\n\n```lua\n-- Check global variable definitions (e.g. no local prefixed to variable)\n\n-- Check to see if the nested value is present in the global space\nlocal my_level = require(\"same-directory\")\n\n-- Check to see if the same value is present\nquarto.log.output(same_level_value)\n```\n\n### Retrieving Values from Extensions\n\nFor extensions, you can access functions as follows:\n\n```lua\n-- Store function calls in a table value\nlocal dependency = require(\"_extensions.coatless-quarto.thedependency.thedependency\")\n\n-- Call the function defined in the separate Lua file\ndependency.check_function()\n```\n\nThis code demonstrates how to import and use functions defined in the `thedependency` extension within your Lua code.\n\n\n# Fin\n\nBy using these techniques, you can efficiently share code and data between different parts of your Quarto extensions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-quarto%2Fdependson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoatless-quarto%2Fdependson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-quarto%2Fdependson/lists"}