[RFC/PATCH 0/5] Add render filter

John Keeping john at keeping.me.uk
Sat Sep 3 20:29:31 CEST 2016


This is an initial attempt at implementing a mechanism for rendering
text documents as HTML in the tree view (Markdown, ReStructuredText,
etc.).  Filters are specified by file extension in the same way as MIME
type mappings, but I have not added support for overriding these in
per-repository configuration.  This makes it like MIME type mapping but
unlike the source filter, which can be specific per-repository.

A new "source" view is introduced to get back to the source, as it is
currently displayed, when a renderer is available and is being used by
default.

The tree view changes so that if a render filter is specified in the
configuration, the rendered content is used.  As an additional
enhancement, if a MIME type is specified, the content is included inline
served via the "plain" page.  This allows displaying images inline
without needing to fork a filter process just to write an HTML wrapper.

The stylesheet probably needs some work, any suggestions or follow up
patches will be gratefully received.

John Keeping (5):
  Use string list strdup_strings for mimetypes
  Add "source" page
  Parse render filters from the config
  ui-tree: split out buffer printing
  ui-tree: use render filters to display content

 cgit.c       |  19 ++++++++-
 cgit.css     |   5 +++
 cgit.h       |   4 +-
 cgitrc.5.txt |  18 +++++++++
 cmd.c        |   8 +++-
 filter.c     |   1 +
 shared.c     |  21 ++++++++++
 ui-shared.c  |  10 +++++
 ui-shared.h  |   3 ++
 ui-tree.c    | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 ui-tree.h    |   2 +-
 11 files changed, 196 insertions(+), 19 deletions(-)

-- 
2.10.0.rc0.142.g1e9f63b



More information about the CGit mailing list