add to readme: all predefined template variables

This commit is contained in:
pho4cexa 2023-01-08 11:55:19 -08:00
parent b26b6eea15
commit 7ab0b3e13f
1 changed files with 22 additions and 3 deletions

View File

@ -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