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

2018-06-20 Thread Andy Green
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 --- ui-shar

[PATCH 1/2] config: add root-desc-html and repo.desc-html

2018-06-20 Thread Andy Green
These are optional, default-empty raw html strings that are emitted after the corresponding text-only versions root-desc and repo.desc when they are used in the header area. This provides a flexible way to place buttons or links in the header region for both the repo index page and for repos indiv

[PATCH 1/3] ui-shared: introduce line range highlight javascript

2018-06-20 Thread Andy Green
This adds a small css class and a function in ui-shared that emits canned javascript to interpret the # part of the URL on the client, and apply a highlight to filtered source. Unlike blame highlight boxes which use generated divs, this applied a computed absolute, transparent highlight over the a

[PATCH 3/3] ui-blame: use the line range highlight script

2018-06-20 Thread Andy Green
This allows it to work on /blame/ URLs. Blame has an extra layer of parent elements which has to be taken into account by the JS when finding the highlight width, hence the 1 arg to the emit function. Signed-off-by: Andy Green --- ui-blame.c |1 + 1 file changed, 1 insertion(+) diff --git

[PATCH 2/3] ui-tree: use the line range highlight script

2018-06-20 Thread Andy Green
This allows it to work in /tree/ and /source/ URLs. Signed-off-by: Andy Green --- ui-tree.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/ui-tree.c b/ui-tree.c index e4cb558..b66cabe 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -226,6 +226,8 @@ static void print_object(const struct objec

[PATCH] noheader: place branch combo on tabs if no header

2018-06-20 Thread Andy Green
noheader=1 stops the static page header from being emitted by cgit, but along with that, the small form that lets the user change branch context on the page is also lost. This isn't actually static since it contains a dynamic list of branches; it can't be reproduced on the user's external header s

Re: [PATCH v4 15/16] render: adapt for providing extra filter args for plain

2018-06-20 Thread Andy Green
On 06/20/2018 06:13 PM, Andy Green wrote: diff --git a/ui-tree.c b/ui-tree.c index 6ffd4dd..2e94755 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -102,16 +102,23 @@ static void print_buffer(const char *basename, char *buf, unsigned long size) } static void render_buffer(struct cgit_filter

[PATCH v4 15/16] render: adapt for providing extra filter args for plain

2018-06-20 Thread Andy Green
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

[PATCH v4 12/16] md2html: add asset postfix arg

2018-06-20 Thread Andy Green
Extend md2html with an optional third argument for URL postfix, like "?h=mybranch" Signed-off-by: Andy Green --- filters/html-converters/md2html | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/filters/html-converters/md2html b/filters/html-converters/m

[PATCH v4 16/16] md2html: change css name to not conflict with highlight

2018-06-20 Thread Andy Green
md2html gets pygments to define the css for "highlight", making display of the blame view fragile against pygments version. On Fedora 28 / python3-pygments-2.2.0-10.fc28.noarch, "highlight" gets redefined so it no longer displays at the top of its parent. This patch changes the css class name use

[PATCH v4 09/16] config: add repo inline-readme list

2018-06-20 Thread Andy Green
This allows the user to choose to override any global inline-readme list for a specific repo, using the same kind of semantics as the other repo overrides. Signed-off-by: Andy Green Reviewed-by: John Keeping --- cgit.c |7 ++- cgit.h |1 + cgitrc.5.txt | 10 ++

[PATCH v4 06/16] ui-tree: use render filters to display content

2018-06-20 Thread Andy Green
From: John Keeping This allows applying filters to files in the repository, for example to render Markdown or AsciiDoc as HTML. Signed-off-by: John Keeping --- cgit.css |5 +++ cmd.c |4 +- ui-tree.c | 104 + ui-tree.h |

[PATCH v4 13/16] ui-shared: deduplicate some code in repolink

2018-06-20 Thread Andy Green
8 lines of code are duplicated in repolink, clean it so the common code appears once Signed-off-by: Andy Green Reviewed-by: John Keeping --- ui-shared.c | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/ui-shared.c b/ui-shared.c index d2985c8..21

[PATCH v4 11/16] md2html: add asset mapping

2018-06-20 Thread Andy Green
From: John Keeping This remaps the "src" attribute on elements according to a second command line argument, you can try it out with: md2html --- filters/html-converters/md2html | 50 ++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git

[PATCH v4 14/16] ui-shared: add helper for generating non-urlencoded links

2018-06-20 Thread Andy Green
We are going to have to produce plain links in the next patch. But depending on config, the links are not simple. Reproduce the logic in repolink() to generate correctly- formatted links in a strbuf, without urlencoding, in a reusable helper cgit_repo_create_url(). Signed-off-by: Andy Green ---

[PATCH v4 05/16] ui-tree: split out buffer printing

2018-06-20 Thread Andy Green
From: John Keeping Signed-off-by: John Keeping --- ui-tree.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ui-tree.c b/ui-tree.c index e6b3074..d26e35e 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -84,6 +84,20 @@ static void print_binary_buffer(c

[PATCH v4 07/16] ui-tree: ls_tail: add walk table param

2018-06-20 Thread Andy Green
Arrange that walk_tree_ctx is available in ls_tail, we will make use of it shortly. Signed-off-by: Andy Green Reviewed-by: John Keeping --- ui-tree.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-tree.c b/ui-tree.c index 721c812..1ccbb22 100644 --- a/ui-tree.c

[PATCH v4 10/16] ui-tree: render any matching README file in tree view

2018-06-20 Thread Andy Green
While listing the items in tree view, if we spot a filename matching any inline-readme entries from the config file, we stash the first one into walk_tree_context. After the tree view has been shown, if there is a stashed inline-readme we render it inline. Signed-off-by: Andy Green Reviewed-by:

[PATCH v4 08/16] config: add global inline-readme list

2018-06-20 Thread Andy Green
Allows the user to specify a list of filenames that should be rendered inline with tree view, if present in the directory. Signed-off-by: Andy Green --- cgit.c |5 - cgit.h |1 + cgitrc.5.txt | 10 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git

[PATCH v4 04/16] Parse render filters from the config

2018-06-20 Thread Andy Green
From: John Keeping 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 fi

[PATCH v4 03/16] Add source page

2018-06-20 Thread Andy Green
From: John Keeping We are about to introduce rendering of content for the tree view. This source page will allow bypassing the renderer and accessing the content of the current tree view. Signed-off-by: John Keeping --- cmd.c |6 ++ ui-shared.c | 14 ++ ui-shared.h

[PATCH v4 01/16] manpage: fix sorting order

2018-06-20 Thread Andy Green
You maybe didn't know you had OCD until you saw an alpha sorted list that has stuff out of order in it. Signed-off-by: Andy Green Reviewed-by: John Keeping --- cgitrc.5.txt | 176 +- 1 file changed, 88 insertions(+), 88 deletions(-) diff

[PATCH v4 02/16] Use string list strdup_strings for mimetypes

2018-06-20 Thread Andy Green
From: John Keeping There's no need to do this manually with the string list API will do it for us. Signed-off-by: John Keeping --- cgit.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cgit.c b/cgit.c index 223dfc8..0c9f3e9 100644 --- a/cgit.c +++ b/cgit.c @@ -23,7

[PATCH v4 00/16] Render READMEs inline in tree view

2018-06-20 Thread Andy Green
The following series adds config to allow rendering of selected READMEs inline after the tree view, where present in the directory being viewed. Particularly you can use completely relative markdown to inline pictures served from the current repo rev context, eg, ![overview](./doc-assets/overview

Highlighting lines or line ranges in tree view

2018-06-20 Thread Andy Green
Hi - It's convenient to be able to provide a URL that points to a specific line in tree view. cgit provides links on the line numbers it produces to facilitate that, eg https://libwebsockets.org/git/libwebsockets/tree/minimal-examples/ws-server/minimal-ws-server-echo/minimal-ws-server-echo.c

repo.desc as raw html?

2018-06-20 Thread Andy Green
Hi - I want to put a repo-specific link to my project mailing list in the header area. But there doesn't seem to be a way to do it. noheader=1 also removes functionality for branch switching UI, which is not desirable. There's a "homepage" link concept but a) that's positioned in the wrong

Re: cache-size implementation downsides

2018-06-20 Thread Christian Hesse
John Keeping on Wed, 2018/06/20 08:44: > On Wed, Jun 20, 2018 at 08:01:11AM +0200, Christian Hesse wrote: > > John Keeping on Sat, 2018/06/16 16:46: > > > -- >8 -- > > > Subject: [PATCH] cache: close race window when unlocking slots > > > > You should add a "From:" line for easy git-am.

Re: cache-size implementation downsides

2018-06-20 Thread John Keeping
On Wed, Jun 20, 2018 at 08:01:11AM +0200, Christian Hesse wrote: > John Keeping on Sat, 2018/06/16 16:46: > > -- >8 -- > > Subject: [PATCH] cache: close race window when unlocking slots > > You should add a "From:" line for easy git-am. ;) "git am --scissors" will pick it up from the message h