Repository
https://github.com/LIKO-12/API-Documentation
New Features
- What feature(s) did you add?
I have added features to the system used to generate markdown docs from JSON files. The system is split into three files; verify, analyze, and generate. Verify, makes sure the JSON does't have any errors, analyze lists stats of the data, and generate actually makes the docs.
I have made three changes. First of all, I moved all the functions that appeared in all three files, to one common file, that is loaded by all three. Secondly, I changed the files to use a more modular system, allowing for doing only some parts. For example, verify could check for JSON syntax, but not check that it includes all the required data. And finally, I added some command line options, such as custom JSON source path, and verbose. - How did you implement it/them?
- Common file: Added this by moving: log, clog (color log), and loaddirectory to docscripts, passing those functions as returns at the end (https://github.com/LIKO-12/API-Documentation/blob/d55f82b6e23168e816042bc97f1c7a3a62623337/LIKO_Scripts/docscripts.lua#L82), and importing them in all three files, for example in generate, (https://github.com/LIKO-12/API-Documentation/blob/d55f82b6e23168e816042bc97f1c7a3a62623337/LIKO_Scripts/generate.lua#L2).
- Plugin system: This was implemented in analyze, by creating a table (https://github.com/LIKO-12/API-Documentation/blob/d55f82b6e23168e816042bc97f1c7a3a62623337/LIKO_Scripts/analyze.lua#L9), then adding into it, the functions, for example (https://github.com/LIKO-12/API-Documentation/blob/d55f82b6e23168e816042bc97f1c7a3a62623337/LIKO_Scripts/analyze.lua#L11), and finally looping through the table, and doing each function on the data (https://github.com/LIKO-12/API-Documentation/blob/d55f82b6e23168e816042bc97f1c7a3a62623337/LIKO_Scripts/analyze.lua#L42). It is done the same in verify
- Command line options: command line options are parsed by a simple parser in docscripts (https://github.com/LIKO-12/API-Documentation/blob/d55f82b6e23168e816042bc97f1c7a3a62623337/LIKO_Scripts/docscripts.lua#L70). Which returns the path and whether to use verbose, this is called by each script with its own arguments.