[PATCH 2/2] ui-shared: emit root-desc-html and repo.desc-html after their text counterparts

John Keeping john at keeping.me.uk
Sat Jun 23 12:28:38 CEST 2018


On Thu, Jun 21, 2018 at 02:46:47PM +0800, Andy Green wrote:
> Where root-desc and repo.desc are used in the header region, also
> emit their html counterparts afterwards if they are defined.
> 
> Where root-desc are repo.desc are used outside the header,
> eg in the repo list, leave it as it is without adding any
> related html.
> 
> Signed-off-by: Andy Green <andy at warmcat.com>
> ---

I think this should be squashed with the previous patch since it makes
it easier to see what's going on.

When I read your initial email on this, I thought we could introduce a
new HTML version of the description and use that *instead of* the plain
text one if the HTML variant is available.

Having looked at the current implementation of repo->desc, I think
that's desirable because the reason we don't have a null-check for that
in the context below is that it will be set to "[no description]" if no
other value is provided.  If a user has set repo->desc_html, I don't
think we want to print "[no description]" before showing the HTML
description!

>  ui-shared.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/ui-shared.c b/ui-shared.c
> index c8f4d8f..a9ec430 100644
> --- a/ui-shared.c
> +++ b/ui-shared.c
> @@ -1013,11 +1013,15 @@ static void print_header(void)
>  	html("<tr><td class='sub'>");
>  	if (ctx.repo) {
>  		html_txt(ctx.repo->desc);
> +		if (ctx.repo->desc_html)
> +			html(ctx.repo->desc_html);
>  		html("</td><td class='sub right'>");
>  		html_txt(ctx.repo->owner);
>  	} else {
>  		if (ctx.cfg.root_desc)
>  			html_txt(ctx.cfg.root_desc);
> +		if (ctx.cfg.root_desc_html)
> +			html(ctx.cfg.root_desc_html);
>  	}
>  	html("</td></tr></table>\n");
>  }


More information about the CGit mailing list