~technomancy/fennel-lang.org

ref: cee977505e43f03a3c1bdb6adb5259136043a3b2 fennel-lang.org/main.fnl -rw-r--r-- 6.7 KiB
cee97750Phil Hagelberg Update setup guide; link there instead of git install instructions. 1 year, 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
;; static HTML generator for the page
(local html (require "html"))

(print "<!DOCTYPE html>")
(print (html [:html {:lang "en"}
              [:head {}
               [:meta {:charset "UTF-8"}]
               [:script {:src "/fengari-web.js"}]
               [:script {:type "application/lua" :src "/init.lua" :async true}]
               [:link {:rel "stylesheet" :href "/fennel.css"}]
               [:link {:rel "stylesheet"
                       :href "https://code.cdn.mozilla.net/fonts/fira.css"}]
               [:title {} "the Fennel programming language"]]
              [:body {}
               [:h1 {} "Fennel"]
               [:p {} "Fennel is a programming language that brings together "
                "the speed, simplicity, and reach of"
                [:a {:href "https://www.lua.org"} "Lua"]
                " with the flexibility of a "
                [:a {:href (.. "https://en.wikipedia.org/wiki/"
                               "Lisp_(programming_language)")}
                 "lisp syntax and macro system."]]

               [:ul {}
                [:li {} [:b {} "Full Lua compatibility:"] "Easily call any Lua "
                 "function or library from Fennel and vice-versa."]
                [:li {} [:b {} "Zero overhead:"] "Compiled code should be just "
                 "as or more efficient than hand-written Lua."]
                [:li {} [:b {} "Compile-time macros:"]
                 "Ship compiled code with no runtime dependency on Fennel."]
                [:li {} [:b {} "Embeddable:"] "Fennel is a one-file library as "
                 "well as an executable. Embed it in other programs to support "
                 "runtime extensibility and interactive development."]]

               [:p {} "Anywhere you can run Lua code, you can run Fennel code."]

               [:ul {:id "where"}
                [:li {} [:a {:href "https://minetest.net/"} "video"]
                 [:a {:href "https://love2d.org"} "games"]]
                [:li {} [:a {:href "https://awesomewm.org/"} "window managers"]]
                [:li {} [:a {:href "https://openresty.org/en/"} "web"]
                 [:a {:href "https://github.com/bakpakin/moonmint"} "servers"]]
                [:li {} [:a {:href "https://github.com/pllua/pllua"} "data"]
                 [:a {:href "https://redis.io/commands/eval"} "bases"]]
                [:li {} [:a {:href "https://fengari.io"} "web"]]
                [:li {} [:a {:href "https://github.com/luakit/luakit"} "browsers"]]
                [:li {} [:a {:href "https://github.com/whitecatboard/Lua-RTOS-ESP32/"}
                         "$8 microcontrollers"]]]

               ;; TODO: add multiple selection of snippets like python.org
               ;; maybe we can show lua output for each; see "modal" on
               ;; http://youmightnotneedjs.com/
               [:NO-ESCAPE (let [f (io.open "sample.html" "r")
                                 sample (: f :read "*all")]
                             (: f :close)
                             sample)]

               [:h2 {} "Usage"]

               [:p {} "See the "
                [:a {:href (.. "https://fennel-lang.org/setup"
                               "#downloading-and-installing-fennel")}
                 "install instructions"] "in the setup guide."]

               [:h3 {} "That's too much work!"]
               [:p {} "Fine, you can use Fennel right here without installing"
                " anything:"]

               [:div {:class "outputs"}
                [:div {:class "code code-flex"}
                 [:code {:id "fengari-console"}]
                  [:noscript {}
                   "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."]
                  [:div {:class "fengari-input-container"}
                   [:label {:id "fengari-prompt" :for "fengari-input"} "> "]
                   [:textarea {:class "lua" :id "fengari-input" :rows 1
                               :placeholder "Type code here..."}]
                   [:button {:id "toggle-compiled-code"}
                    "Toggle Lua code"]]]
                [:div {:class "code code-flex" :id "lua-pane"}
                 [:code {:id "compiled-lua"}]]]

               [:h2 {} "Documentation"]
               [:ul {}
                [:li {} "The" [:a {:href "/setup"} "Setup guide"]
                 "is a good place to start."]
                [:li {} "The" [:a {:href "/tutorial"} "Tutorial"]
                 "teaches you the basics of the language."]
                [:li {} "The" [:a {:href "/lua-primer"} "Lua primer"]
                 "will catch you up if you don't already know Lua."]
                [:li {} "The" [:a {:href "/reference"} "Reference"] "lists "
                 "out all built-in special forms and what they're for."]
                [:li {} "The" [:a {:href "/api"} "API listing"]
                 "explains how to embed Fennel into a Lua program."]
                [:li {} "The" [:a {:href "/changelog"} "Changelog"]
                 "describes how Fennel has evolved with time."]]

               [: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]]))
                 version-links)

               [:h2 {} "Development"]
               [:p {} "Fennel's repository is on "
                [:a {:href "https://github.com/bakpakin/Fennel"} "GitHub"]
                ", and discussion occurs on "
                [:a {:href "https://lists.sr.ht/%7Etechnomancy/fennel"}
                 "the mailing list"]
                " and the #fennel channel"
                [:a {:href "https://webchat.freenode.net/"} "on Freenode"]
                " and "
                [:a {:href "https://matrix.to/#/!rnpLWzzTijEUDhhtjW:matrix.org"}
                 "on Matrix"] "."
                [:a {:href "https://github.com/bakpakin/Fennel/issues"}
                 "Bug reports"] "are tracked in the GitHub issue system."]
               [:p {} "There is also"
                [:a {:href "https://github.com/bakpakin/Fennel/wiki"} "a wiki"]
                " for collecting ideas."]

               [:hr {}]
               [:p {} "Fennel is copyright © 2016-2020 Calvin Rose and "
                [:a {:href "https://github.com/bakpakin/Fennel/graphs/contributors"}
                 "contributors."] "released under the MIT/X11 license. "
                "This website is under the same terms and also stored on"
                [:a {:href "https://git.sr.ht/~technomancy/fennel-lang.org"}
                 "sourcehut."]]]]))