From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Wed, 27 Jun 2018 20:51:43 +0100 Subject: [PATCH v4 00/16] Render READMEs inline in tree view In-Reply-To: References: <152885510454.7253.3542488576272033383.stgit@mail.warmcat.com> <152948941145.29466.10223016890282865269.stgit@mail.warmcat.com> Message-ID: <20180627195143.GP6584@john.keeping.me.uk> Hi Jason, On Wed, Jun 27, 2018 at 07:18:57PM +0200, Jason A. Donenfeld wrote: > With the current state of this series, cgit would have the following options: > > - render. > - inline-readme > - render-filter This one is only a concept, not a configuration value (just a note since I couldn't remember introducing it!) > - about-filter > - commit-filter > - source-filter > - owner-filter > - readme=file > - readme=:file > > Whoa nelly. Of these, about-filter, commit-filter, source-filter, and > owner-filter all have analogs in the repo.* namespace, which makes > sense; it seems this was omitted from the render-filter introduced by > this series. The thing that unifies about-filter, commit-filter, > source-filter, and owner-filter is that they all modify some aspect of > the rendered output, either via fork/exec or via lua. > > In adding readme files under the tree view, the obvious observation is > that this is pretty much the same type of rendering that we're doing > in about-filter. > > In adding rendering of arbitrary files in blob view, this is > essentially a fancy source view, with the one caveat of our > interesting handling of line numbers. > > So, I'd propose the following re-organization (and after we nail it > down, we can bikeshed about compatibility with old configs, but for > now let's focus on ideal design): I'll comment on the proposals inline below, but before doing that let me try to remember why "render." exists in the first place (it's a couple of years since I wrote that patch so I'm not entirely sure this is the rationale I had at the time!) Thinking though it now, I think about-filter and the render-filter concept are equivalent. And for the purpose of putting an inline directory readme in the tree view, that may be sufficient. However, my series was adding a new UI mode and there are a couple of requirements there that I can't see a way to fix without render. or something equivalent [1]: - It is desirable to have the existing source view in addition to the rendered content, preferably with syntax highlighting via the source filter; for example Markdown, HTML or SVG can be sensibly viewed in both ways - For some content types, the easiest way to render it is to simply include the file with an iframe; this is the case for images and PDFs at the moment Now, if the render filter can say "I don't support this" and can do so reasonably efficiently, we can use that to control whether render mode is enabled and whether we use the "fallback to mimetype" to include an iframe. Or with the asset path extension to the filter arguments, we could have the filter generate the