~technomancy/fennel-lang.org

10f792ada196126be96b60e609bc7d6f28ad95ba — Christoph Frick 5 months ago 7f10a4f
Add REPL for tag docs

- make the links to the docs like directories, so relative links work
- generate the files used in the REPL for the tag dirs
4 files changed, 28 insertions(+), 4 deletions(-)

M head.html
M main.fnl
M makefile
A repl.md
M head.html => head.html +2 -0
@@ 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>

M main.fnl => main.fnl +1 -1
@@ 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"]

M makefile => makefile +8 -3
@@ 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

A repl.md => repl.md +17 -0
@@ 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>