mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
fix/docs parser (#219)
This commit is contained in:
@@ -16,15 +16,10 @@ def find_class_files(search_path):
|
|||||||
:param search_path: the path to search for Eluna methods in
|
:param search_path: the path to search for Eluna methods in
|
||||||
:return: a list of all files containing Eluna methods, and the name of their respective classes
|
:return: a list of all files containing Eluna methods, and the name of their respective classes
|
||||||
"""
|
"""
|
||||||
# Get the current working dir and switch to the search path.
|
|
||||||
old_dir = os.getcwd()
|
|
||||||
os.chdir(search_path)
|
|
||||||
# Search for all files ending in "Methods.h".
|
# Search for all files ending in "Methods.h".
|
||||||
method_file_names = glob.glob('*Methods.h')
|
method_file_names = glob.glob(os.path.join(search_path, '**', '*Methods.h'))
|
||||||
# Open each file.
|
# Open each file.
|
||||||
method_files = [open(file_name, 'r') for file_name in method_file_names]
|
method_files = [open(file_name, 'r') for file_name in method_file_names]
|
||||||
# Go back to where we were before.
|
|
||||||
os.chdir(old_dir)
|
|
||||||
return method_files
|
return method_files
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import typing
|
import typing
|
||||||
import markdown
|
import markdown
|
||||||
@@ -321,7 +322,7 @@ class ClassParser(object):
|
|||||||
def parse_file(file):
|
def parse_file(file):
|
||||||
"""Parse the file `file` into a documented class."""
|
"""Parse the file `file` into a documented class."""
|
||||||
# Get the class name from "ClassMethods.h" by stripping off "Methods.h".
|
# Get the class name from "ClassMethods.h" by stripping off "Methods.h".
|
||||||
class_name = file.name[:-len('Methods.h')]
|
class_name = os.path.basename(file.name)[:-len('Methods.h')]
|
||||||
parser = ClassParser(class_name)
|
parser = ClassParser(class_name)
|
||||||
|
|
||||||
line = file.readline()
|
line = file.readline()
|
||||||
|
|||||||
Reference in New Issue
Block a user