git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Petr Baudis <pasky@suse.cz>
Cc: Wincent Colaiuta <win@wincent.com>, git@vger.kernel.org
Subject: Re: [RFC] gitweb wishlist and TODO list (templating)
Date: Tue, 30 Sep 2008 14:45:26 +0200	[thread overview]
Message-ID: <200809301445.28025.jnareb@gmail.com> (raw)
In-Reply-To: <20080925171029.GQ10360@machine.or.cz>

On Thu, 25 Sep 2008, Petr Baudis wrote:
> On Thu, Sep 25, 2008 at 06:52:22PM +0200, Jakub Narebski wrote:

> > I think that making gitweb use something like Gitweb::Template, where
> > action appearance is governed by templates, be it something like
> > git-for-each-ref --format or StGit *.tmpl files, or XSLT / XSL,
> > could be a good idea.  But I think _that_ would require almost writing
> > from scratch, certainly making it long-term gitweb fork, perhaps even
> > with different name (and not residing inside git.git repository).
> > 
> > We can discuss this idea here in this subthread.  For example: do
> > create Gitweb::Template like HTML::Template or use Template Toolkit;
> > which parts put in template and which in "gitweb" driver, etc.
> 
> Actually, my implementation works quite differently - the idea of the
> templates is that you just specify data from which files to show and
> whether to take them right away or tabulate them in some way - so it is
> something very abstract, and agnostic to _presentation_ layer, which is
> still provided by gitweb. An example of made-up template configuration
> file would look something like:
> 
> [action "summary"]
> 	sections = metadata overview README shortlog forks
> 
> [section "overview"]
> 	type = csv
> 	row = Project Title,(info.txt:title)
> 	row = Project Authors,(info.txt:authors)
> 	row = Bussiness Impact,(info.txt:bizimpact)
> 	row = Base Equation,[formula.png]
> 
> [section "README"]
> 	type = html
> 	content = (README.html)
> 
> (where info.txt is another gitconfig-ish file in tree root, one that
> the user actually touches).
> 
> When I post the patch, I will probably apply it to repo.or.cz too so
> that I can show-case this in practice.

After reading above I'm not sure if what you think about as templating
system for gitweb is the same as I am talking about when thinking about
something like Gitweb::Template.

It looks like you are thinking about having templating system inside
gitweb, with templates describing page layout and view.  Reusing git
ini-like config syntax as (from what I understand) a kind of declarative
layout language (like for example Metafont and MetaPost used in TeX)
would be not that bad idea then; it certainly would avoid adding extra
dependencies on additional Perl modules, and reduce a bit size of code
to be added to deal with templating... if only git config syntax was
not such _limited_ language.  Git ini-like syntax is domain-specific
language meant for storing 2-level and 3+-level hierarchical
configuration; abusing it for templating system would be like writing
A.I. in COBOL.  Also to write all this constraint declarative part
of templating language would be lot of work, I'm not sure if more
work than implementing simple templating system from scratch.

I am thinking about something which would be rather alternate to
gitweb, rather than expanding it.  Gitweb started as simple single-file
CGI script to view and browse git repositories on the web; it is not
modular, and not much embeddable.  But it is easy to install; somewhat
harder than when it was single file (now there is script itself, CSS
and images), but in some parts easier (you don't have to edit file by
hand to make it find repositories and git binary, and to configure it).
Nevertheless easy installation is one of its advantages 
(see also git-instaweb).

Currently (after a bit of research and asking on #perl) I am thinking
about having it either as Template Toolkit[1] plugin (Template::Git or
Template::Plugin::Git) for getting data from git repositories, used
in place of usual DBI/database access module, and as Template Toolkit
filter (Template::Plugin::Gitweb or something like that) for massaging
output, like for example relative/absolute date formats and such,
or as plugin for Catalyst[2] MVC framework.  (Well TT (Template Toolkit)
can be used by Catalyst, so if it is TT module it can be used in
Catalyst).

But this won't be gitweb; more like GitHub.


For example if there was 'gitweb' Template Toolkit the 'shortlog' view
could look like this:

  [% USE Git(projectroot,project) %]
  [% INCLUDE header project=project %]
  ...
  [% FOREACH commit IN repo.log %]
  ...
  [% END %]

Note: I do not know TT, so there might be glaring errors there


References:
===========
[1] http://template-toolkit.org
[2] http://www.catalystframework.org/

P.S. Do anybody know any declarative (constraints based) templating
engine (templating system)? Preferably in Perl...
-- 
Jakub Narebski
Poland

  parent reply	other threads:[~2008-09-30 12:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 10:30 [RFC] gitweb wishlist and TODO list Jakub Narebski
2008-09-25 11:08 ` Pedro Melo
2008-09-25 12:23   ` Jakub Narebski
2008-09-25 14:45     ` Pedro Melo
2008-09-25 21:23       ` Jakub Narebski
2008-09-25 13:19 ` Wincent Colaiuta
2008-09-25 13:33   ` Petr Baudis
2008-09-25 16:52     ` [RFC] gitweb wishlist and TODO list (templating) Jakub Narebski
2008-09-25 17:10       ` Petr Baudis
2008-09-25 22:16         ` Jakub Narebski
2008-09-30 12:45         ` Jakub Narebski [this message]
2008-09-25 15:41   ` [RFC] gitweb wishlist and TODO list Jakub Narebski
2008-09-28 10:01 ` Jakub Narebski
2008-09-28 21:18   ` Petr Baudis
2008-10-01  8:40 ` Ask Bjørn Hansen
2008-10-01  9:52   ` [RFC] gitweb wishlist and TODO list (profiling gitweb) Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200809301445.28025.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pasky@suse.cz \
    --cc=win@wincent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).