fix pyi_generator to remove commented out props from docs

This commit is contained in:
Lendemor 2024-12-10 20:13:39 +01:00
parent f7ecb7b4b1
commit 54dc428a01
2 changed files with 7 additions and 1 deletions

View File

@ -70,7 +70,7 @@ class Image(NextComponent):
quality: The quality of the optimized image, an integer between 1 and 100, where 100 is the best quality and therefore largest file size. Defaults to 75.
priority: When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority.
placeholder: A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty.
loading: Allows passing CSS styles to the underlying image element. style: Var[Any] #noqa: ERA001 The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
loading: The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
blurDataURL: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
on_load: Fires when the image has loaded.
on_error: Fires when the image has an error.

View File

@ -255,8 +255,14 @@ def _generate_docstrings(clzs: list[Type[Component]], props: list[str]) -> str:
# We've reached the functions, so stop.
break
if line == "":
# We hit a blank line, so clear comments to avoid commented out prop appearing in next prop docs.
comments.clear()
continue
# Get comments for prop
if line.strip().startswith("#"):
print(line)
comments.append(line)
continue