List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: RFE: .so filters
Date: Fri, 10 Jan 2014 20:36:52 +0000	[thread overview]
Message-ID: <20140110203652.GR7608@serenity.lan> (raw)
In-Reply-To: <52D0572E.7080607@xinu.at>

On Fri, Jan 10, 2014 at 09:25:18PM +0100, Florian Pritz wrote:
> On 10.01.2014 21:11, John Keeping wrote:
> > Forking and using Lua in the child is an interesting idea.
> > 
> > I need to investigate how Lua generally deals with I/O, but it feels
> > like it will be simpler to use a simple function interface than deal
> > with slurping in the input in Lua.
> 
> Looks rather easy to slurp stdin (from http://www.lua.org/pil/21.1.html):

Interesting.  But I think it will be simpler from both side if the
interface is just a function call:

    function filter(value)
        return value .. " some trailing data"
    end

The change on the CGit side is then quite easy, we just change the
switchable value in html.c from htmlfd to html_out_fn which has the same
signature as html_raw (which is the default implementation).  Then we
can collect output in a strbuf until it's time to call the function.

The only thing I'm not sure about is how the specification of the filter
function works, given that I don't think we can call a complete Lua
script as a function.  (I'm also assuming that the Lua script will be in
an external file and not stored inline in the CGit config).


  reply	other threads:[~2014-01-10 20:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 21:34 Jason
2014-01-09 22:29 ` mailings
2014-01-09 22:58 ` john
2014-01-10  1:41   ` Jason
2014-01-10  2:11     ` Jason
2014-01-10  4:26       ` Jason
2014-01-10  9:06       ` john
2014-01-10 15:57         ` Jason
2014-01-10 17:12           ` bluewind
2014-01-10 17:20             ` john
2014-01-10 17:43               ` mricon
2014-01-10 18:00                 ` Jason
2014-01-10 18:00               ` Jason
2014-01-10 17:57             ` Jason
2014-01-10 20:03               ` bluewind
2014-01-10 20:11                 ` john
2014-01-10 20:25                   ` bluewind
2014-01-10 20:36                     ` john [this message]
2014-01-10 20:56                       ` bluewind
2014-01-11  2:37                         ` Jason
2014-01-11  2:34                 ` Jason

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=20140110203652.GR7608@serenity.lan \
    --to=cgit@lists.zx2c4.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).