]> granicus.if.org Git - cgit/commit
render: adapt for providing extra filter args for plain
authorAndy Green <andy@warmcat.com>
Mon, 18 Jun 2018 06:25:59 +0000 (14:25 +0800)
committerAndy Green <andy@warmcat.com>
Thu, 28 Jun 2018 23:53:21 +0000 (07:53 +0800)
commit1ef4d396b1043c6b8e871d56bd93a85bc70bd533
treebe5afda5e5c6d7a58209cdf22b1000124dcb0d6b
parent1592728359c15e1a2f481414ae4ccd8d6feb3251
render: adapt for providing extra filter args for plain

This changes the render filter exec part to provide a second
and third argument, which are used by md2html to fix up the url
path for "plain" for the repo, eg, "/cgit/plain/" and
"?h=mybranch", as required by the modifications to md2html in
the previous patches.

The combination means cgit becomes able to serve assets using
markdown urls starting from the repo root dir, without mentioning
any virtual url part specific to a cgit or other web rendering
instance, while respecting the version context.

Eg, continuing the example of the arguments being
"/cgit/plain/" and "?h=mybranch" from above, if the markdown has

![overview](./doc-assets/overview.png)

the img src will be fixed up to

"/cgit/plain/doc-assets/overview.png?h=mybranch"

If the same document is viewed from a different rev in cgit, the
processed markdown url will change to match the cgit context, even
though the markdown relative URL is the same for all versions.

Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: John Keeping <john@keeping.me.uk>
cgitrc.5.txt
filter.c
ui-tree.c