fix/docs parser (#219)

This commit is contained in:
Axel Cocat
2025-01-21 00:31:19 +01:00
committed by GitHub
parent 648a8c6d55
commit 16173cb751
2 changed files with 3 additions and 7 deletions

View File

@@ -16,15 +16,10 @@ def find_class_files(search_path):
: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
"""
# 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".
method_file_names = glob.glob('*Methods.h')
method_file_names = glob.glob(os.path.join(search_path, '**', '*Methods.h'))
# Open each file.
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

View File

@@ -1,3 +1,4 @@
import os
import re
import typing
import markdown
@@ -321,7 +322,7 @@ class ClassParser(object):
def parse_file(file):
"""Parse the file `file` into a documented class."""
# 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)
line = file.readline()