From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Tue, 3 Jul 2018 20:53:07 +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> <20180627195143.GP6584@john.keeping.me.uk> <20180628082853.GT6584@john.keeping.me.uk> Message-ID: <20180703195307.GY6584@john.keeping.me.uk> On Tue, Jul 03, 2018 at 09:34:26PM +0200, Jason A. Donenfeld wrote: > On Thu, Jun 28, 2018 at 10:29 AM John Keeping wrote: > > Yeah, I don't think there's any way to avoid exec'ing twice in source > > view - we need to run the source filter for output and we need the > > render filter to tell us whether we should output a link to the rendered > > content. > > Let's do it this way then. Since rendering anyway usually amounts to: > > case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in > *.markdown|*.mdown|*.md|*.mkd) exec ./md2html; ;; > *.rst) exec ./rst2html; ;; > *.[1-9]) exec ./man2html; ;; > *.htm|*.html) exec cat; ;; > *.txt|*) exec ./txt2html; ;; > esac > > Then we can just reimplement the dispatcher in Lua, and this whole > issue goes away. That sounds sensible, although the dispatcher will be getting a bit more complicated to support the file formats for which we want to output an or