Add Love2D API generation flag option to make docs target

This commit is contained in:
Emma 2024-09-07 12:33:57 -04:00
parent 0e0121825d
commit f0c512575e
4 changed files with 22 additions and 7 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/result
/lua*.html
/build
/src/fennel-ls/docs/generated/love2d.fnl

View File

@ -30,7 +30,7 @@ repl:
$(FENNEL) $(FENNELFLAGS)
docs:
$(FENNEL) $(FENNELFLAGS) tools/get-docs.fnl
$(FENNEL) $(FENNELFLAGS) tools/get-docs.fnl $(GET_DOCS_FLAGS)
rm-docs:
rm -rf src/fennel-ls/docs/

View File

@ -21,6 +21,17 @@ $ make rm-docs
$ make docs
```
## Including LÖVE documentation
Due to license incompatibility between fennel-ls and the official LÖVE
documentation, this repository cannot include the LÖVE documentation by
default. It must be generated manually.
This can be done by passing a flag to the `docs` target.
```sh
$ make docs GET_DOCS_FLAGS=--generate-love2d
```
## Vendored Dependencies
The vendored dependencies are very easy to solve. You delete the dependency
files by running `make rm-deps`.

View File

@ -27,9 +27,9 @@
(fn main []
(sh :mkdir :-p :build/)
(sh :mkdir :-p :src/fennel-ls/docs/generated/)
(let [{:convert lua-manual} (require :tools.get-docs.lua-manual)
{:convert tic80-manual} (require :tools.get-docs.tic80)
{:convert download-and-convert-love2d-manual!} (require :tools.get-docs.love2d)]
(let [generate-love2d-docs? (case arg [:--generate-love2d] true _ false)
{:convert lua-manual} (require :tools.get-docs.lua-manual)
{:convert tic80-manual} (require :tools.get-docs.tic80)]
(derive-docs-from-url "https://www.lua.org/manual/5.1/manual.html"
:lua51.fnl lua-manual)
(derive-docs-from-url "https://www.lua.org/manual/5.2/manual.html"
@ -39,8 +39,11 @@
(derive-docs-from-url "https://www.lua.org/manual/5.4/manual.html"
:lua54.fnl lua-manual)
(derive-docs-from-url "https://tic80.com/learn" :tic80.fnl tic80-manual)
(write-doc-file! :love2d.fnl
"https://github.com/love2d-community/love-api/"
(download-and-convert-love2d-manual!))))
(when generate-love2d-docs?
(let [{:convert download-and-convert-love2d-manual!} (require :tools.get-docs.love2d)]
(print "generating Love2D docs...")
(write-doc-file! :love2d.fnl
"https://github.com/love2d-community/love-api/"
(download-and-convert-love2d-manual!))))))
(main)