Gen docs is done, promise
This commit is contained in:
parent
925d4eb91b
commit
72028f3772
22
gen_docs.py
22
gen_docs.py
|
@ -1,7 +1,12 @@
|
||||||
import sys
|
import sys
|
||||||
import scrython
|
import scrython
|
||||||
import re
|
import re
|
||||||
from scrython import *
|
from scrython.bulk_data import *
|
||||||
|
from scrython.cards import *
|
||||||
|
from scrython.catalog import *
|
||||||
|
from scrython.rulings import *
|
||||||
|
from scrython.sets import *
|
||||||
|
from scrython.symbology import *
|
||||||
from types import FunctionType
|
from types import FunctionType
|
||||||
|
|
||||||
def format_args(string, f):
|
def format_args(string, f):
|
||||||
|
@ -56,7 +61,8 @@ def format_functions(_class, function_list, f):
|
||||||
|
|
||||||
f.write('\n```\n{}\n```'.format(function_docstring))
|
f.write('\n```\n{}\n```'.format(function_docstring))
|
||||||
|
|
||||||
for _class in scrython.__all__:
|
def main(subpackage):
|
||||||
|
for _class in subpackage.__all__:
|
||||||
|
|
||||||
intro = """
|
intro = """
|
||||||
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
|
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
|
||||||
|
@ -79,8 +85,8 @@ These docs will likely not be as detailed as the official Scryfall Documentation
|
||||||
|
|
||||||
functions = [x for x in dir(eval(_class)) if not x.startswith('_')]
|
functions = [x for x in dir(eval(_class)) if not x.startswith('_')]
|
||||||
|
|
||||||
with open('./docs/{}.md'.format(_class), 'w') as f:
|
with open('./docs/{}/{}.md'.format(subpackage.__name__, _class), 'w') as f:
|
||||||
f.write('# **class** `{}()`\n'.format(_class))
|
f.write('# **class** `{}.{}()`\n'.format(subpackage.__name__, _class))
|
||||||
f.write(intro)
|
f.write(intro)
|
||||||
format_args(args, f)
|
format_args(args, f)
|
||||||
format_returns(returns, f)
|
format_returns(returns, f)
|
||||||
|
@ -97,3 +103,11 @@ These docs will likely not be as detailed as the official Scryfall Documentation
|
||||||
print('Examples: ', re.findall(r'(?<=Examples:)(.*)', remove_extra_spaces))
|
print('Examples: ', re.findall(r'(?<=Examples:)(.*)', remove_extra_spaces))
|
||||||
print(e)
|
print(e)
|
||||||
print('~~~~~~~~~~~~~~~~~~~~~~~~~~')
|
print('~~~~~~~~~~~~~~~~~~~~~~~~~~')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main(scrython.bulk_data)
|
||||||
|
main(scrython.cards)
|
||||||
|
main(scrython.catalog)
|
||||||
|
main(scrython.rulings)
|
||||||
|
main(scrython.sets)
|
||||||
|
main(scrython.symbology)
|
Loading…
Reference in New Issue