This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] Add REPL for tag docs

Christoph Frick
Message ID
DKIM signature
Download raw message
Patch: +28 -4
- make the links to the docs like directories, so relative links work
- generate the files used in the REPL for the tag dirs
 head.html |  2 ++
 main.fnl  |  2 +-
 makefile  | 11 ++++++++---
 repl.md   | 17 +++++++++++++++++
 4 files changed, 28 insertions(+), 4 deletions(-)
 create mode 100644 repl.md

diff --git a/head.html b/head.html
index 78c09ad..0ecc3bc 100644
--- a/head.html
+++ b/head.html
@@ -1,3 +1,5 @@
    <link rel="stylesheet" href="/fennel.css"></link>
    <link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css"/>
    <script type="text/javascript" src="/fengari-web.js"></script>
    <script type="application/lua" src="init.lua" async></script>
    <title>the Fennel programming language</title>
diff --git a/main.fnl b/main.fnl
index 426b41f..a43ac63 100644
--- a/main.fnl
+++ b/main.fnl
@@ -104,7 +104,7 @@
               [:p {} "Looking for other versions?  Docs are generated for:"]
               (let [version-links [:ul {:id "versions"}]]
                 (each [i v (ipairs arg)]
                   (table.insert version-links [:li {} [:a {:href v} v]]))
                   (table.insert version-links [:li {} [:a {:href (.. "/" v "/")} v]]))

               [:h2 {} "Development"]
diff --git a/makefile b/makefile
index 7c11ad0..02bff83 100644
--- a/makefile
+++ b/makefile
@@ -23,15 +23,20 @@ generate.lua: fennel/generate.fnl ; fennel/fennel --compile $^ > $@
# there might be time, when we have "generations" of fennel
# TODO: dedupe v% and master setup here
%/tag-intro.md: ; fennel/fennel tag-intro.fnl $@ > $@
%/repl.md: repl.md ; cp $^ $@
%/init.lua: init.lua ; cp $^ $@
%/repl.fnl: repl.fnl ; cp $^ $@
%/fennelview.lua: %/fennel/fennelview.fnl ; $*/fennel/fennel --compile $^ > $@
%/generate.lua: %/fennel/generate.fnl ; $*/fennel/fennel --compile $^ > $@
v%/fennel: ; git clone --branch $* fennel $@
v%/index.html: v%/tag-intro.md $(foreach md, $(TAGSOURCES), v%/fennel/${md}.md); $(PANDOC) -o $@ $^
v%/index.html: v%/tag-intro.md v%/repl.md $(foreach md, $(TAGSOURCES), v%/fennel/${md}.md); $(PANDOC) -o $@ $^
master/fennel: ; git clone --branch master fennel $@
master/index.html: master/tag-intro.md $(foreach md, $(TAGSOURCES), master/fennel/${md}.md); $(PANDOC) -o $@ $^ && rm master/tag-intro.md
master/index.html: master/tag-intro.md master/repl.md $(foreach md, $(TAGSOURCES), master/fennel/${md}.md); $(PANDOC) -o $@ $^ && rm master/tag-intro.md

tagdirs: ; $(foreach tagdir, $(TAGDIRSS), mkdir -p ${tagdir})
cleantagdirs: ; $(foreach tagdir, $(TAGDIRS), rm -rf ${tagdir})
tags: tagdirs $(foreach tagdir, $(TAGDIRS), ${tagdir}/fennel)
TAGDOCS := $(foreach tagdir, $(TAGDIRS), $(addprefix ${tagdir}/, index.html))
TAGDOCS := $(foreach tagdir, $(TAGDIRS), $(foreach file, index.html init.lua repl.fnl fennelview.lua generate.lua, ${tagdir}/${file}))

build: html lua tagdocs
html: $(HTML) index.html
diff --git a/repl.md b/repl.md
new file mode 100644
index 0000000..62d14ec
--- /dev/null
+++ b/repl.md
@@ -0,0 +1,17 @@
# Online REPL using Fengari

<div class="outputs">
<div class="code code-flex">
<code id="fengari-console"></code> 
<span>There's supposed to be an interactive REPL here but it needs  scripting to be enabled. 
You can install Fennel with git if  you'd rather not enable scripting; it's cool.</span> 
<div class="fengari-input-container">
<label for="fengari-input" id="fengari-prompt">&gt; </label> 
<textarea class="lua" placeholder="Type code here..." rows="1" id="fengari-input"></textarea>
<button id="toggle-compiled-code">Toggle Lua code</button>
<div class="code code-flex" id="lua-pane"><code id="compiled-lua"></code></div>
Message ID
<20191015112907.76782-1-cf@ofnir.net> (view parent)
DKIM signature
Download raw message
Christoph Frick <cf@ofnir.net> writes:

> - make the links to the docs like directories, so relative links work
> - generate the files used in the REPL for the tag dirs

Sorry for the delay on this; it looks good. Thanks for submitting. I've
pushed it out. It'll be super handy for testing to be able to
immediately run repls on old Fennel versions; that was a really nice touch.

Review patch Export thread (mbox)