Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate documentation pages for each Pattern subclass #35

Closed
ideoforms opened this issue Feb 19, 2023 · 4 comments · Fixed by #52
Closed

Generate documentation pages for each Pattern subclass #35

ideoforms opened this issue Feb 19, 2023 · 4 comments · Fixed by #52

Comments

@ideoforms
Copy link
Owner

No description provided.

@loparcog
Copy link
Collaborator

loparcog commented Mar 5, 2023

We can use the following regex and re.search to repetitively pull up classes and their documentation in the code:

class\s[\w():]+\s+"""((?!""").)*"""

Using this gets us

class PSequence(Pattern):
    """ Sequence: Sequence of values based on an array
        Takes an input list, and repeats the items in this list.

        >>> p = PSeq([ 1, 2, 3, 5 ])
        >>> p.nextn(10)
        [1, 2, 3, 5, 1, 2, 3, 5, 1, 2, 3, 5, 1, 2, 3, 5]
        """

Which can then be formatted as the following:

PSequence

Sequence: Sequence of values based on an array Takes an input list, and repeats the items in this list.

p = PSeq([ 1, 2, 3, 5 ]) >>> p.nextn(10) [1, 2, 3, 5, 1, 2, 3, 5, 1, 2, 3, 5, 1, 2, 3, 5]

The main point where I'm having issue is in how the code should be formatted (either using > indents or removing those and surrounding them with ``` blocks), and also how to deal with titles, since some documentation starts with the pattern name (like the above starting with Sequence) and others do not.

@loparcog
Copy link
Collaborator

There aren't too many instances of it, but when there are comments for init args, they look to be in the format of:

Args:
            initial_value (float or int): Initial value
            step (float or int): Maximum value to increase or decrease by each step
            min (float or int): Minimum permitted value
            min (float or int): Maximum permitted value

Would this be the standard to stick to and work around or would you want to change the comment formatting before pushing the doc changes?

@ideoforms
Copy link
Owner Author

Happy to keep these as-is for now and address in a future change :)

@loparcog
Copy link
Collaborator

Got this working with the current args formatting and also made the index page push out to library.md to replace the file currently there. Main thing now would be adding all of this to the nav for MKDocs, where I would mainly want to check if we want to have all of these files in their own nav line or if we want to combine all of the markdown files into one for each python file.

@loparcog loparcog linked a pull request Jan 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants