last doc gen update before I do the changes
This commit is contained in:
parent
1c925ea1fb
commit
043cfc033c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/fennel-ls
|
/fennel-ls
|
||||||
/result
|
/result
|
||||||
|
/lua*.html
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
(let [begin-index (assert (html:find "<h2>.%.1 – <a name=\".%.1\">Basic Functions.-\n") "no basic functions?")
|
(let [begin-index (assert (html:find "<h2>.%.1 – <a name=\".%.1\">Basic Functions.-\n") "no basic functions?")
|
||||||
end-index (assert (html:find "<h1>. – <a name=\".\".-\n" begin-index))
|
end-index (assert (html:find "<h1>. – <a name=\".\".-\n" begin-index))
|
||||||
stdlib (html:sub begin-index (- end-index 1))
|
stdlib (html:sub begin-index (- end-index 1))
|
||||||
|
last-update (html:match "Last update:\n(.-)\n")
|
||||||
fields []
|
fields []
|
||||||
modules []]
|
modules []]
|
||||||
(fn loop [prev]
|
(fn loop [prev]
|
||||||
@ -28,7 +29,7 @@
|
|||||||
(table.insert fields section)))
|
(table.insert fields section)))
|
||||||
(when header (loop header))))
|
(when header (loop header))))
|
||||||
(loop (stdlib:find "<hr><h3>.-\n"))
|
(loop (stdlib:find "<hr><h3>.-\n"))
|
||||||
(values modules fields)))
|
(values modules fields last-update)))
|
||||||
|
|
||||||
(fn html-to-markdown [str]
|
(fn html-to-markdown [str]
|
||||||
(let [str
|
(let [str
|
||||||
@ -56,9 +57,9 @@
|
|||||||
(: :gsub "[ \n]%(see <a href=\"#[^\"]+\">[^<]+</a>%)." "")
|
(: :gsub "[ \n]%(see <a href=\"#[^\"]+\">[^<]+</a>%)." "")
|
||||||
(: :gsub "[ \n]%(<a href=\"#[^\"]+\">[^<]+</a>%)." "")
|
(: :gsub "[ \n]%(<a href=\"#[^\"]+\">[^<]+</a>%)." "")
|
||||||
;; code blocks
|
;; code blocks
|
||||||
(: :gsub "<pre>\n?([^<]+)\n?</pre>" "```lua\n%1\n```")
|
(: :gsub "<pre>\n?([^<]-)\n?</pre>" "```lua\n%1\n```")
|
||||||
;; list items to indented * thingies
|
;; list items to indented * thingies
|
||||||
(: :gsub "<li>([^<]+)</li>" #(.. "* " ($:gsub "\n" "\n ")))
|
(: :gsub "<li>([^<]+)</li>" #(.. "* " (: ($:match "^\n*(.-)\n*$") :gsub "\n" "\n ")))
|
||||||
(: :gsub "</?ul>" ""))
|
(: :gsub "</?ul>" ""))
|
||||||
;; check to ensure that all the tags have been defeated
|
;; check to ensure that all the tags have been defeated
|
||||||
tag (str:match "<[^>]+>[^>]+>")]
|
tag (str:match "<[^>]+>[^>]+>")]
|
||||||
@ -156,10 +157,10 @@
|
|||||||
|
|
||||||
(fn main []
|
(fn main []
|
||||||
(each [_ version (ipairs [:5.1 :5.2 :5.3 :5.4])]
|
(each [_ version (ipairs [:5.1 :5.2 :5.3 :5.4])]
|
||||||
(let [infile (open-file-cached
|
(let [local-filename (.. "lua" version ".html")
|
||||||
(.. "lua" version ".html")
|
url (.. "https://www.lua.org/manual/" version "/manual.html")
|
||||||
(.. "https://www.lua.org/manual/" version "/manual.html"))
|
infile (open-file-cached local-filename url)
|
||||||
(modules module-items) (parse-html (infile:read :a))
|
(modules module-items last-update) (parse-html (infile:read :a))
|
||||||
docs
|
docs
|
||||||
(collect [_ module (ipairs modules)]
|
(collect [_ module (ipairs modules)]
|
||||||
(parse-h2-section module))]
|
(parse-h2-section module))]
|
||||||
@ -177,6 +178,8 @@
|
|||||||
(let [outfile (io.open (.. "src/fennel-ls/docs/lua" (version:gsub "%." "") ".fnl") :w)]
|
(let [outfile (io.open (.. "src/fennel-ls/docs/lua" (version:gsub "%." "") ".fnl") :w)]
|
||||||
(local {: view : sym : list} (require :fennel))
|
(local {: view : sym : list} (require :fennel))
|
||||||
(outfile:write
|
(outfile:write
|
||||||
|
";; Generated by make-docs.fnl. Contents come from " url "\n"
|
||||||
|
";; This lua manual was last updated " last-update "\n"
|
||||||
(view (list (sym :local) (sym :docs) docs))
|
(view (list (sym :local) (sym :docs) docs))
|
||||||
"\n"
|
"\n"
|
||||||
"(set docs._G.fields docs)\n"
|
"(set docs._G.fields docs)\n"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user