diff --git a/lib/fes.lua b/lib/fes.lua index f4cd0a3..d6a476b 100644 --- a/lib/fes.lua +++ b/lib/fes.lua @@ -167,11 +167,11 @@ end function M:build() if self.proto == "http" then - local header = self.header:gsub("{{TITLE}}", self.title or "Document") + local header = self.default_header:gsub("{{TITLE}}", self.title or "Document") local favicon_html = self.favicon or '' header = header:gsub("{{FAVICON}}", favicon_html) - local footer = self.footer:gsub("{{COPYRIGHT}}", self.copyright or symbol.legal.copyright .. "The Copyright Holder") - return header .. table.concat(self.parts, "\n") .. footer + local footer = self.default_footer:gsub("{{COPYRIGHT}}", self.copyright or symbol.legal.copyright .. "The Copyright Holder") + return header .. table.concat(self.parts, "\n") .. default_footer end return table.concat(self.parts, "\n") end diff --git a/modules/new/new.go b/modules/new/new.go index c1937ac..2ae216c 100644 --- a/modules/new/new.go +++ b/modules/new/new.go @@ -74,14 +74,9 @@ local site = fes.fes() -- site.copyright = fes.util.copyright("https://example.com", "%s") -site:h1("Hello, World!") +site:h(1, "Hello, World!") return site`, name) - write("Fes.toml", `[app] - -name = "%s" -version = "0.0.1" -authors = ["%s"]`, dir, name) write("README.md", strings.ReplaceAll(`# %s $$$$$$ diff --git a/test/archive_test/Fes.toml b/test/archive_test/Fes.toml deleted file mode 100644 index 82c5002..0000000 --- a/test/archive_test/Fes.toml +++ /dev/null @@ -1,5 +0,0 @@ -[app] - -name = "archive" -version = "0.0.1" -authors = ["vx-clutch"] \ No newline at end of file diff --git a/test/archive_test/README.md b/test/archive_test/README.md deleted file mode 100644 index 0b7aab4..0000000 --- a/test/archive_test/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# archive - -This example demonstrates the archive feature of Fes it is useful for file -sharing purposes. diff --git a/test/archive_test/archive/facts/seals/seals.txt b/test/archive_test/archive/facts/seals/seals.txt deleted file mode 100644 index 4637e63..0000000 --- a/test/archive_test/archive/facts/seals/seals.txt +++ /dev/null @@ -1,22 +0,0 @@ -Pinnipeds [2] are the seals and their relatives, a group of semi-aquatic marine -mammals. The Pinnipedia is in the Order Carnivora. There are three seal -families: Odobenidae (walruses), Otariidae (eared seals, including sea lions -and fur seals), and Phocidae (true seals).[3] - -Seals are sleek-bodied and barrel-shaped. Their bodies are well adapted to the -aquatic habitat where they spend most of their lives. Pinnipeds have flippers -for hands, big bulky bodies, doggish faces, and big eyes. Unlike cetaceans, -pinnipeds have their noses on their faces, and each nostril of the nose closes -when the pinniped goes underwater. Like cetaceans, pinnipeds have a thick layer -of blubber (fat) just under their skin: this blubber keeps them warm in cold -waters and keeps them fed during times when food is not easily found. When they -cannot find food, they live off the fat in the blubber. - -Pinnipeds are carnivorous. This means they eat only meat (such as fish or -squid) and not plants. However, almost all pinnipeds can be eaten by polar -bears, sharks and killer whales. - -Seals are often trained in zoos or aquariums to put on shows. However, in -Sweden, it is illegal to train a seal to balance a ball on its nose.[4] - -From [Pinniped Wikipedia](https://simple.wikipedia.org/wiki/Pinniped) diff --git a/test/archive_test/archive/seal.png b/test/archive_test/archive/seal.png deleted file mode 100644 index 74634c2..0000000 Binary files a/test/archive_test/archive/seal.png and /dev/null differ diff --git a/test/archive_test/www/index.lua b/test/archive_test/www/index.lua deleted file mode 100644 index 6a96cd7..0000000 --- a/test/archive_test/www/index.lua +++ /dev/null @@ -1,10 +0,0 @@ -local fes = require("fes") -local site = fes.fes() - -site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") - -site:h1("Hello, World!") - -site:a("/archive", fes.std.h2("To the file room!")) - -return site diff --git a/test/basic_hello_world/Fes.toml b/test/basic_hello_world/Fes.toml deleted file mode 100644 index 31606c1..0000000 --- a/test/basic_hello_world/Fes.toml +++ /dev/null @@ -1,5 +0,0 @@ -[app] - -name = "hello" -version = "0.0.1" -authors = ["vx-clutch"] \ No newline at end of file diff --git a/test/basic_hello_world/README.md b/test/basic_hello_world/README.md deleted file mode 100644 index fd8567d..0000000 --- a/test/basic_hello_world/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# hello - -This is a very simple hello world program, the only difference between this and -default is this README. diff --git a/test/basic_hello_world/www/index.lua b/test/basic_hello_world/www/index.lua deleted file mode 100644 index 12a2a55..0000000 --- a/test/basic_hello_world/www/index.lua +++ /dev/null @@ -1,8 +0,0 @@ -local fes = require("fes") -local site = fes.fes() - -site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") - -site:h1("Hello, World!") - -return site diff --git a/test/complex_sample_project/Fes.toml b/test/complex_sample_project/Fes.toml deleted file mode 100644 index 38a5e3d..0000000 --- a/test/complex_sample_project/Fes.toml +++ /dev/null @@ -1,5 +0,0 @@ -[app] - -name = "best" -version = "0.0.1" -authors = ["vx-clutch"] \ No newline at end of file diff --git a/test/complex_sample_project/README.md b/test/complex_sample_project/README.md deleted file mode 100644 index 93a79a3..0000000 --- a/test/complex_sample_project/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# best - -This is an example of best practices for the Fes framework. - -## Parts - -With best practice we can break our sites into a few parts. - -## Index - -The main page of the site loads in the header and the footer, as well as shows -some core information - -## Include - -Within include the header and footer are defined. - -* **Header:** Site navigation and name display -* **Footer:** Extra and external information. - -## Static - -This is where we store our favicon. diff --git a/test/complex_sample_project/include/footer.lua b/test/complex_sample_project/include/footer.lua deleted file mode 100644 index cfd0ed9..0000000 --- a/test/complex_sample_project/include/footer.lua +++ /dev/null @@ -1,13 +0,0 @@ -local footer = {} - -footer.render = function(std) - return table.concat({ - std.h2("Other resources"), - std.tl({ - std.external("https://git.vxserver.dev/fSD/fes", "Fes source"), - std.external("https://docs.vxserver.dev/static/fes.html", "Documentation"), - }), -}) -end - -return footer diff --git a/test/complex_sample_project/include/header.lua b/test/complex_sample_project/include/header.lua deleted file mode 100644 index 4a60a1e..0000000 --- a/test/complex_sample_project/include/header.lua +++ /dev/null @@ -1,7 +0,0 @@ -local header = {} - -header.render = function(std) - return std.center(std.ha("/", std.h1("Best Practices"))) -end - -return header diff --git a/test/complex_sample_project/static/favicon.ico b/test/complex_sample_project/static/favicon.ico deleted file mode 100644 index 9db4ded..0000000 Binary files a/test/complex_sample_project/static/favicon.ico and /dev/null differ diff --git a/test/complex_sample_project/www/index.lua b/test/complex_sample_project/www/index.lua deleted file mode 100644 index 96af136..0000000 --- a/test/complex_sample_project/www/index.lua +++ /dev/null @@ -1,20 +0,0 @@ -local fes = require("fes") -local std = fes.std -local u = fes.util - -local site = fes.fes() - -site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") -site.title = "Best practices" -site.favicon = "/static/favicon.ico" - -site:banner(fes.app.header.render(std)) - -site:note(u.cc { - std.h2("Hello, World!"), - std.p("This is an example of the best practices/canonical Fes site.") -}) - -site:note(fes.app.footer.render(std)) - -return site diff --git a/test/default_project/README.md b/test/default/README.md similarity index 100% rename from test/default_project/README.md rename to test/default/README.md diff --git a/test/default/www/index.lua b/test/default/www/index.lua new file mode 100644 index 0000000..e828f38 --- /dev/null +++ b/test/default/www/index.lua @@ -0,0 +1,8 @@ +local fes = require("fes") +local site = fes.fes() + +-- site.copyright = fes.util.copyright("https://example.com", "vx-clutch") + +site:h(1, "Hello, World!") + +return site \ No newline at end of file diff --git a/test/default_project/Fes.toml b/test/default_project/Fes.toml deleted file mode 100644 index 44e865c..0000000 --- a/test/default_project/Fes.toml +++ /dev/null @@ -1,5 +0,0 @@ -[app] - -name = "default" -version = "0.0.1" -authors = ["vx-clutch"] \ No newline at end of file diff --git a/test/default_project/www/index.lua b/test/default_project/www/index.lua deleted file mode 100644 index 12a2a55..0000000 --- a/test/default_project/www/index.lua +++ /dev/null @@ -1,8 +0,0 @@ -local fes = require("fes") -local site = fes.fes() - -site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") - -site:h1("Hello, World!") - -return site diff --git a/test/error/README.md b/test/error/README.md new file mode 100644 index 0000000..8acd1c3 --- /dev/null +++ b/test/error/README.md @@ -0,0 +1,7 @@ +# error + +This is expected to return the following error: + +``` +Error loading page: www/index.lua line:6(column:6) near 'return': syntax error +``` diff --git a/test/error/www/index.lua b/test/error/www/index.lua new file mode 100644 index 0000000..68a918e --- /dev/null +++ b/test/error/www/index.lua @@ -0,0 +1,6 @@ +local fes = require("fes") +local site = fes.fes() + +site. + +return site diff --git a/test/expected_error/Fes.toml b/test/expected_error/Fes.toml deleted file mode 100644 index 9cd794b..0000000 --- a/test/expected_error/Fes.toml +++ /dev/null @@ -1,5 +0,0 @@ -[app] - -name = "error" -version = "0.0.1" -authors = ["vx-clutch"] \ No newline at end of file diff --git a/test/expected_error/README.md b/test/expected_error/README.md deleted file mode 100644 index c11361a..0000000 --- a/test/expected_error/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# error - -This shows what a Lua error looks like to the user. Lua errors are the most -common and the most critical so that is why they are shown to the user. Other, -lesser errors, are only shown to the developer because of their different -nature. diff --git a/test/expected_error/www/index.lua b/test/expected_error/www/index.lua deleted file mode 100644 index 77aaecf..0000000 --- a/test/expected_error/www/index.lua +++ /dev/null @@ -1,10 +0,0 @@ -local fes = require("fes") -local site = fes.fes() - -site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") - -This is what an error looks like - -site:h1("Hello, World!") - -return site diff --git a/test/markdown_render/Fes.toml b/test/markdown_render/Fes.toml deleted file mode 100644 index f800d4d..0000000 --- a/test/markdown_render/Fes.toml +++ /dev/null @@ -1,5 +0,0 @@ -[app] - -name = "markdown" -version = "0.0.1" -authors = ["vx-clutch"] \ No newline at end of file diff --git a/test/markdown_render/README.md b/test/markdown_render/README.md deleted file mode 100644 index 98d5834..0000000 --- a/test/markdown_render/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# markdown - -This example demonstrate Fes's ability to handle markdown routes. diff --git a/test/markdown_render/www/index.md b/test/markdown_render/www/index.md deleted file mode 100644 index 846dbbd..0000000 --- a/test/markdown_render/www/index.md +++ /dev/null @@ -1,3 +0,0 @@ -# Markdown! - -**Fes** also supports markdown routes! diff --git a/test/minimal_return/Fes.toml b/test/minimal_return/Fes.toml deleted file mode 100644 index b3008f5..0000000 --- a/test/minimal_return/Fes.toml +++ /dev/null @@ -1,5 +0,0 @@ -[app] - -name = "simple" -version = "0.0.1" -authors = ["vx-clutch"] \ No newline at end of file diff --git a/test/minimal_return/README.md b/test/minimal_return/README.md deleted file mode 100644 index 70e9d20..0000000 --- a/test/minimal_return/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# simple - -This simple example shows the extensibility of the Fes framework. It shows the -you do not necessarily need to use the site object (although it is recommended) -you can define your own site, similar to how Lisps do things. diff --git a/test/minimal_return/www/index.lua b/test/minimal_return/www/index.lua deleted file mode 100644 index 5e0506d..0000000 --- a/test/minimal_return/www/index.lua +++ /dev/null @@ -1 +0,0 @@ -return "Hello, World!"