From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Wed, 27 Jun 2018 21:00:14 +0100 Subject: [PATCH v4 11/16] md2html: add asset mapping In-Reply-To: References: <152948941145.29466.10223016890282865269.stgit@mail.warmcat.com> <152948957470.29466.14608988436277033922.stgit@mail.warmcat.com> Message-ID: <20180627200014.GQ6584@john.keeping.me.uk> On Wed, Jun 27, 2018 at 07:32:56PM +0200, Jason A. Donenfeld wrote: > On Wed, Jun 20, 2018 at 12:13 PM Andy Green wrote: > > > md2html > > > The trailing "/" is important. > > Can we make it not important? That is, if the type is always > explicitly a directory, treat it as such using the usual file name > joining logic. Seems sensible. This was originally posted as a proof of concept, so would benefit from a bit of tidying. I'm not actually sure if it does the right think when cfg.virtual_root is NULL so we may need something a bit more complicated than this (and I can't see a way that doesn't require the filter to handle both types of URL). > Alternatively, and perhaps better, don't introduce a second argument. > Just pass the full file path in the first argument, and have asset > mapping always work it out in the right way. It depends how we think about the first argument. The URL of the "current page" when we call the filter will be something like: /repo/tree/subdir/README.md but the asset path should point to: /repo/plain/subdir/ We could just say it's the URL of the input file, which is actually quite nice if we want the filter to be able to replace the content with an iframe. However, I think there's a big benefit in backwards compatibility if we keep the first argument as a file name and don't change it to a URL. But that doesn't stop us making the new argument into a URL to the file. Regards, John