Parse render filters from the config
Render filters will be used to present rendered content in the tree
view, for example to display Markdown source rendered as HTML.
We will add support for using these from the tree view in the following
commits.
AG: adapted so render.= can be used to specify the filter for files
without any suffix
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index f6f6502..34b6186 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -342,6 +342,18 @@
"-1" uses the compiletime value in git (for further info, look at
`man git-diff`). Default value: "-1".
+render.<ext>::
+ Specifies a command which will be invoked to render files with the
+ extension `.<ext>`. The command will get the blob content on its STDIN
+ and the name of the blob as its only command line argument. The STDOUT
+ from the command will be included verbatim in the page content. If no
+ render filter is available for a given file extension but the mimetype
+ is specified then the content will be included as an iframe, otherwise
+ the normal source rendering will be used. Note <ext> may be empty, in
+ which case the render filter is used on files with no suffix.
++
+Default value: none. See also: "FILTER API".
+
repository-sort::
The way in which repositories in each section are sorted. Valid values
are "name" for sorting by the repo name or "age" for sorting by the
@@ -705,6 +717,13 @@
standard input and the filter is expected to write to standard
output. The output is included in the Owner column.
+render filter::
+ This filter is given a single parameter: the filename of the source
+ file to render. The filter can use the filename to determine (for
+ example) the syntax highlighting mode. The contents of the file that
+ is to be rendered is available on standard input and the rendered
+ content is expected on standard output.
+
source filter::
This filter is given a single parameter: the filename of the source
file to filter. The filter can use the filename to determine (for