A Python tool for Game Maker developers to convert JSDoc comments from GML files to JSON.
Project description
jsdoc2json
jsdoc2json is a Python tool designed for Game Maker developers. It serves to convert JSDoc comments from Game Maker Language (GML) files into a structured JSON format. With jsdoc2json, you can easily extract and transform JSDoc comments, making it easier to analyze and integrate their code documentation into other systems or workflows.
Table of Contents
Installation
Install jsdoc2json using the following command:
pip install jsdoc2json
Usage
Usage:
python -m jsdoc2json (-file FILE_PATH | -folder FOLDER_PATH) -output OUTPUT_PATH [-debug]
Example
Single File Conversion
To convert a single GML file "Player.gml" and save it as "Player.json":
python -m jsdoc2json -file Player.gml -output ./documentation_folder
Input: Player.gml
/**
* @function player_move
* @description Move the player in the given direction
* @param {Real} a The speed of the player
* @param {Real} b The direction of the player
* @return {Array<Real>} The new coordinates
*/
function player_move(speed, direction) {
player.x += speed * cos(player.direction);
player.y += speed * sin(player.direction);
return [player.x, player.y];
}
Output: Player.json
{
"jsdoc": [
{
"function_tag": {
"description": "player_move"
},
"description_tag": {
"description": "Move the player in the given direction"
},
"param_tags": [
{
"name": "a",
"type": "Real",
"description": "The speed of the player"
},
{
"name": "b",
"type": "Real",
"description": "The direction of the player"
}
],
"return_tag": {
"type": "Array Real",
"description": "The new coordinates"
}
}
]
}
Folder Conversion
To convert all GML files within a Game Maker project "My_project":
python -m jsdoc2json -folder ./My_project -output ./documentation_folder
Project Structure
The jsdoc2json project directory structure:
jsdoc2json/
│
├── main.py
│
├── modules/
│ ├── jsdoc_data.py
│ ├── lexical_parser.py
│ ├── lexical_regex.py
│ ├── lexical_tokens.py
│ └── syntax_parser.py
│
└── data/
├── input/
│ ├── test1.gml
│ ├── test2.gml
│ ├── Player.gml
│ └── folder_containing_tests
│ ├── test3.gml
| └── folder_containing_tests
| └── test4.gml
└── output/
├── test1.json
├── test2.json
└── Player.json
Contributing
Reporting Bugs
If you encounter a bug, please open an issue on our issue tracker and provide detailed information about the bug, including how to reproduce it.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jsdoc2json-1.0.0.tar.gz.
File metadata
- Download URL: jsdoc2json-1.0.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea6ede1057852347e11f005a2cb04662664a243c4d81d3f8c24286e3986101b4
|
|
| MD5 |
a61c961d28b5339b71dfb594bf41aa30
|
|
| BLAKE2b-256 |
ca10e7119d336524c13d37ff3dabba508d7e813b647b2b99c2ee6cb6324cc518
|
File details
Details for the file jsdoc2json-1.0.0-py3-none-any.whl.
File metadata
- Download URL: jsdoc2json-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b5404ab110faf142c07806e39dd2f1ae2f2ff275814b467cae09c007f70e13f
|
|
| MD5 |
7e52b297c7ffacfb96ce6d4efa086ddb
|
|
| BLAKE2b-256 |
1811d387479e9dec6ab4e0f2456ca97db950353e054b6f982679a2cb3ec75861
|