Skip to content

Commit 6c0e8fd

Browse files
authored
Merge pull request #698 from asherber/get-metadata
Rewrite metadata parser in Lua
2 parents 23edcd0 + 3abf7d1 commit 6c0e8fd

File tree

7 files changed

+16191
-13104
lines changed

7 files changed

+16191
-13104
lines changed

.github/actions/get-metadata/README.md

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Get metadata
22

3-
This action gets the metadata for each JW Lua script and writes it to a JSON file. This way, users can easily find scripts that they'd like to use. This action creates the metadata for the [docs](https://jw-lua-scripts-docs.vercel.app/) website.
3+
This action gets the metadata for each Lua script and writes it to a JSON file. This way, users can easily find scripts that they'd like to use. This action creates the metadata for the [docs](https://finalelua.com/) website.
44

55
## Format
66

@@ -18,7 +18,7 @@ Each script is represented as a JSON object with the following properties:
1818
- `categories (string[])`: An array of categories for the script
1919
- `date (string)`: The date the script was created in the format `YYYY-MM-DD` ([ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html))
2020
- `notes (string)`: Longer description of the plug-in and user instructions, can contain multiple lines
21-
- `revisionNotes (string[])`: Revision history text that might be of interest to an end user, can contain multiple lines
21+
- `revisionNotes (string[])`: Revision **history** text that might be of interest to an end user, can contain multiple lines
2222
- `authorUrl (string)`: The author's URL
2323
- `authorEmail (string)`: The author's email
2424
- `id (string)`: The ID of the script
@@ -32,3 +32,22 @@ This is the author data from the script. It contains the following properties:
3232
- `name (string)`: The name of the author
3333
- `website (string)`: The author's website
3434
- `email (string)`: The author's email
35+
36+
## How it works
37+
38+
- Loop through all the `lua` files in the `src` folder
39+
- Load the text of each file
40+
- Extract the contents of the `plugindef` function with a regular expression
41+
- Pass the `plugindef` function to the Lua interpreter, along with Lua code that
42+
invokes the function and grabs its return values and the values from the
43+
`finaleplugin` table
44+
- Return the captured data as a JSON object
45+
- Perform some manipulation on the JSON (dates, string arrays, etc.)
46+
- Build an array of the returned JSON and save to a file
47+
48+
## Caution
49+
50+
`MinJWLuaVersion` and `MaxJWLuaVersion` Min/MaxJWLuaVersion are defined as numbers in Lua,
51+
but they're expected to have two decimal places -- v0.70 is not v0.7. A function in `parse.ts`
52+
ensures that the values will display with two decimal places. If there's eveer a case where
53+
the input value has more or fewer decimal places (e.g., v0.100), this will need to be revisited.

0 commit comments

Comments
 (0)