On 06/19/2018 03:25 AM, John Keeping wrote:
On Mon, Jun 18, 2018 at 10:58:31AM +0800, Andy Green wrote:
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.
static void render_buffer(struct cgit_filter *render, const char *name,
- char *buf, unsigned long size)
+ char *buf, unsigned long size)
{
char *filter_arg = xstrdup(name);
+ char *repo_url = cgit_repourl(ctx.repo->url);
+ struct strbuf sb_plain = STRBUF_INIT, sb_postfix = STRBUF_INIT;
+
+ strbuf_addf(&sb_plain, "%splain/", repo_url);
This doesn't always work (if we don't have cfg.virtual_root set it's
wrong).
I see, thanks.
The logic in ui-shared.c::reporevlink() does the right thing, and it
might be possible to extract a helper function but we may just have to
replicate it since that version generates the URL as an HTML attribute
value.
OK... I studied it... first what's in repolink has some duplication of
code that I added a patch to clean out.
In a second patch I added a helper cgit_repo_create_url() that does the
core function without urlencode into a pair of strbufs, one for before
any ? and one including the ? and anything after. They can point to the
same strbuf if the caller doesn't care.
-Andy
_______________________________________________
CGit mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/cgit