From 7ab0b3e13f6d3e6ff1c6fd4c4966293789dfc258 Mon Sep 17 00:00:00 2001 From: pho4cexa Date: Sun, 8 Jan 2023 11:55:19 -0800 Subject: [PATCH] add to readme: all predefined template variables --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c08fdcc..097e892 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,25 @@ If you use the `include` directive in your modified `default.html` template file, `repo2html` will look for the templates to be included in that same specified directory, where your `default.html` template lives. +The following variables are available to templates: + +- source_files_list: a list of all the files in the repo. +- repository_description: a short description of the repo, if provided. See configuration. +- repository_name: the name of the repo. See configuration. +- repository_path: the URL path from the forge root to the repo. +- repository_path_parent: repository_path without the repo itself. +- repository_ancestors: a list of each path element in repository_path_parent +- readme_file: the filename of the README file, if any. used for the "about" link. +- license_file: the filename of the LICENSE file, if any. used for the "license" link. +- issues_file: if any files exist in ISSUES/, this will be set to "ISSUES". +- repo2html_version: the blob hash of main.scm in this repository. +- source_file: the filename of the file being rendered. +- root: always "" (TODO: omit this?) +- elements: a list of each path element leading to the file being rendered +- basename: the filename being rendered, with one extension removed +- extension: the extension removed in basename +- relative_root: "html/" if the current file is "/index.html" otherwise "" + ## Configuration `repo2html` understands the following configuration settings. @@ -200,10 +219,10 @@ Third-party-hosted services that will host browsable code repositories. - [Codeberg](https://codeberg.org/) - [sourcehut](https://sourcehut.org/) - [GitLab](https://gitlab.com/) -- [Bitbucket](https://bitbucket.org/product/) - [SourceForge](https://sourceforge.net/) -- GitHub -- [pagure](https://pagure.io/pagure) +- Red Hat [pagure](https://pagure.io/pagure) +- Atlassian Bitbucket +- Microsoft GitHub ## Todos