~technomancy/fennel

Add REPL for tag docs v1 PROPOSED

Christoph Frick
Christoph Frick: 1
 Add REPL for tag docs

 4 files changed, 28 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~technomancy/fennel/patches/8699/mbox | git am -3
Learn more about email & git

[PATCH] Add REPL for tag docs Export this patch

Christoph Frick
- 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]]))
                 version-links)

               [: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> 
<noscript>
<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> 
</noscript>
<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>
</div>
<div class="code code-flex" id="lua-pane"><code id="compiled-lua"></code></div>
</div>
-- 
2.23.0
Christoph Frick <cf@ofnir.net> writes:
View this thread in the archives