Working on automating doc creation.
This commit is contained in:
parent
3bd19ca5a5
commit
1d9b2eb9e1
|
@ -0,0 +1,42 @@
|
||||||
|
# **class** `Autocomplete()`
|
||||||
|
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
|
||||||
|
|
||||||
|
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`{Class_name}().scryfallJson`).
|
||||||
|
|cards/autocomplete|
|
||||||
|
|Get a list of potential autocompletion phrases.|
|
||||||
|
|
||||||
|
## Args
|
||||||
|
|
||||||
|
| arg | description |
|
||||||
|
|:---:|:---:|
|
||||||
|
|q (string):
|
||||||
|
|The query of the autocompletion.|
|
||||||
|
|format (string, optional):
|
||||||
|
|Defaults to 'json'.|
|
||||||
|
|Returns data in the specified method.|
|
||||||
|
|face (string, optional):
|
||||||
|
|Defaults to empty string.|
|
||||||
|
|If you're using the `image` format,|
|
||||||
|
|this will specify if you want the front or back face.|
|
||||||
|
|version (string, optional):
|
||||||
|
|Defaults to empty string.|
|
||||||
|
|If you're using the `image` format, this will specify|
|
||||||
|
|if you want the small, normal, large, etc version of the image.|
|
||||||
|
|pretty (string, optional):
|
||||||
|
|Defaults to empty string.|
|
||||||
|
|Returns a prettier version of the json object.|
|
||||||
|
|Note that this may break functionality with Scrython.|
|
||||||
|
|
||||||
|
## Raises
|
||||||
|
|
||||||
|
| arg | description |
|
||||||
|
|:---:|:---:|
|
||||||
|
|Exception: If the 'q' parameter is not provided.|
|
||||||
|
|Exception: If the object returned is an error.|
|
||||||
|
|
||||||
|
## Example usage
|
||||||
|
|
||||||
|
| arg | description |
|
||||||
|
|:---:|:---:|
|
||||||
|
|>>> auto = scrython.cards.Autocomplete(q="Thal")|
|
||||||
|
|>>> auto.total_items()|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import sys
|
||||||
|
import scrython
|
||||||
|
from scrython import *
|
||||||
|
import re
|
||||||
|
|
||||||
|
intro = """These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
|
||||||
|
|
||||||
|
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`{Class_name}().scryfallJson`)."""
|
||||||
|
|
||||||
|
for _class in scrython.__all__:
|
||||||
|
|
||||||
|
match = list(filter(None, (token.strip() for token in re.findall(r'[^\n]*', eval(_class).__doc__))))
|
||||||
|
|
||||||
|
with open('{}.md'.format(eval(_class).__name__), 'w') as f:
|
||||||
|
f.write('# **class** `{}()`\n'.format(eval(_class).__name__))
|
||||||
|
f.write(intro)
|
||||||
|
for token in match:
|
||||||
|
# Match section header
|
||||||
|
if re.findall(r'[A-Z][a-z].*:', token) and ':' in re.findall(r':.*', token):
|
||||||
|
f.write('\n\n## {}\n\n'.format(token.replace(':', '')))
|
||||||
|
if 'Example' in token:
|
||||||
|
f.write()
|
||||||
|
else:
|
||||||
|
f.write('| arg | description |\n|:---:|:---:|')
|
||||||
|
|
||||||
|
# Match args description
|
||||||
|
elif re.findall(r'[\w]+\s\(.+\):', token):
|
||||||
|
if 'Defaults' in token:
|
||||||
|
f.write(token)
|
||||||
|
else:
|
||||||
|
f.write('\n|{}'.format(token))
|
||||||
|
else:
|
||||||
|
f.write('\n|{}|'.format(token))
|
||||||
|
# r'[\w]+\s\(.+\):' Matches anything that's a described parameter
|
||||||
|
# r'[A-Z][a-z](.*)' Matches section titles
|
||||||
|
break
|
|
@ -0,0 +1,23 @@
|
||||||
|
# **class** `{Class_name}()`
|
||||||
|
|
||||||
|
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
|
||||||
|
|
||||||
|
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`{Class_name}().scryfallJson`).
|
||||||
|
|
||||||
|
## Args
|
||||||
|
|
||||||
|
|arg|description|
|
||||||
|
|:---:|:---:|
|
||||||
|
|{arg} ({type})|{description}|
|
||||||
|
|
||||||
|
## Raises
|
||||||
|
|
||||||
|
|exception type|reason|
|
||||||
|
|:---:|:---:|
|
||||||
|
|{Exception}|{reason}|
|
||||||
|
|
||||||
|
## Example usage
|
||||||
|
|
||||||
|
```
|
||||||
|
{Examples}
|
||||||
|
```
|
Loading…
Reference in New Issue