diff --git a/core/builtin.lua b/core/builtin.lua index 05d73fa..1a2dad5 100644 --- a/core/builtin.lua +++ b/core/builtin.lua @@ -1,3 +1,5 @@ +local std = require("core.std") + local M = {} M.__index = M @@ -17,238 +19,181 @@ function M.site_builder(header, footer) version = site_config.version or "", title = site_config.title or "Document", header = header or [[ - + - - - {{TITLE}} + + +{{TITLE}} +strong,b{font-weight:600;color:#f0f6f8} +em,i{font-style:italic} +
@@ -268,44 +213,39 @@ function M:custom(str) return self end -function M:g(str) - self:custom(str) - return self -end - function M:h1(str) str = str or "" - self:custom("

" .. str .. "

") + self:custom(std.h1(str)) return self end function M:h2(str) str = str or "" - self:custom("

" .. str .. "

") + self:custom(std.h2(str)) return self end function M:h3(str) str = str or "" - self:custom("

" .. str .. "

") + self:custom(std.h3(str)) return self end function M:h4(str) str = str or "" - self:custom("

" .. str .. "

") + self:custom(std.h4(str)) return self end function M:h5(str) str = str or "" - self:custom("
" .. str .. "
") + self:custom(std.h5(str)) return self end function M:h6(str) str = str or "" - self:custom("
" .. str .. "
") + self:custom(std.h6(str)) return self end @@ -374,12 +314,6 @@ function M:li(str) end function M:code(str) - str = str or "" - self:custom("" .. str .. "") - return self -end - -function M:pre(str) str = str or "" self:custom("
" .. str .. "
") return self diff --git a/doc/www/index.lua b/doc/www/index.lua index 219a1ac..509e9c7 100644 --- a/doc/www/index.lua +++ b/doc/www/index.lua @@ -13,26 +13,57 @@ note that Fes is not production grade or stable, use at your own caution. ]]) -site:muted("Before reading this you should consult the " .. fes.std.external("https://git.vxserver.dev/fSD/fes", "README")) +site:muted("Before reading this you should consult the " .. +fes.std.external("https://git.vxserver.dev/fSD/fes", "README")) local docs = {} local template = [[ -%s %s +%s +
+ Expand description + %s +
+ %s +
]] -function docs:func(fn, desc) - table.insert(self, string.format(template, fn, desc)) +function docs:func(fn, signature, desc) + table.insert(self, string.format(template, fn, signature, desc)) return self end -docs:func("fes.site_builder", "returns a site object, a required element for this framework.") -docs:func("site:h1", "adds a h1 to the site object.") -docs:func("site:h2", "adds a h2 to the site object.") -docs:func("site:h3", "adds a h3 to the site object.") -docs:func("site:h4", "adds a h4 to the site object.") -docs:func("site:h5", "adds a h5 to the site object.") -docs:func("site:h6", "adds a h6 to the site object.") +docs:func("site_builder", "fes.site_builder()", "returns a site object, a required element for this framework.") +docs:func("custom", "site:custom(content)", "adds a raw string into the site object") +docs:func("h1", "site:h1(content)", "adds a h1 tag to the site object.") +docs:func("h2", "site:h2(content)", "adds a h2 tag to the site object.") +docs:func("h3", "site:h3(content)", "adds a h3 tag to the site object.") +docs:func("h4", "site:h4(content)", "adds a h4 tag to the site object.") +docs:func("h5", "site:h5(content)", "adds a h5 tag to the site object.") +docs:func("h6", "site:h6(content)", "adds a h6 tag to the site object.") +docs:func("p", "site:p(content)", "adds a paragraph tag to the site object.") +docs:func("note", "site:note(content)", "adds a fes note to the site object. A note is a box used for important information or emphasis.") +docs:func("muted", "site:muted(content)", "adds a fes muted block to the site object. A muted block makes text smaller and less noticable, it is useful for small usage notes.") +docs:func("a", "site:a(link, content)", "adds an anchor tag to the site object. By default, if no 'content' is passed is just displays the link") +docs:func("external", "site:external(link, content)", "similarly to 'site:a', it adds an anchor tag to the site object but opens it in a new tab. By default, if no 'content' is passed is just displays the link") +docs:func("ul", "site:ul(items)", "creates an unordered list from passed table, usally 'std.li()'.") +docs:func("ol", "site:ol(items)", "creates an ordered list from passed table, usally 'std.li()'.") +docs:func("li", "site:li(content)", "adds a list entry to the site object") +docs:func("code", "site:code(content)", "adds a code block to the site object.") +docs:func("blockquote", "site:blockquote(content)", "adds a block quote to the site object.") +docs:func("hr", "site:hr()", "adds a horizontal line to the site object.") +docs:func("divider", "site:divider()", "adds a divider to the site object.") +docs:func("img", "site:img(src, alt)", "adds an image to the site object.") +docs:func("table", "site:table(headers, rows)", "adds a table to the site object.") +docs:func("div", "site:div(content, classs)", "adds a custom div to the site object. Custom classes are to be defined in the .css file pointed to by the CUSTOM_CSS variable in Fes.toml") +docs:func("span", "site:span(content, classs)", "adds a custom span to the site object. Custom classes are to be defined in the .css file pointed to by the CUSTOM_CSS variable in Fes.toml") +docs:func("strong", "site:strong(content)", "adds bold text to the site object.") +docs:func("em", "site:em(content)", "adds italicized text to the site object.") +docs:func("br", "site:br()", "adds a break into the document") +docs:func("links", "site:links(link_list)", "adds a formated list of links into the site object.") +docs:func("lead", "site:lead(content)", "adds an instance of the lead class into the site object. This is used in combonation with 'site:note' to create a heading within it.") +docs:func("small", "site:small(content)", "adds a div with class 'small'. The small class changed the size of text within.") +docs:func("highlight", "site:highlight(content)", "adds an instance of the 'highlight' class into the site object. Text with the 'highlight' class will be emphasized") -site:note(table.concat(docs, "\n

\n")) +site:note(table.concat(docs, "")) return site