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

Define new field #456

Open
SoyeonBaek opened this issue Dec 2, 2021 · 1 comment
Open

Define new field #456

SoyeonBaek opened this issue Dec 2, 2021 · 1 comment
Milestone

Comments

@SoyeonBaek
Copy link

I've written a epydoc to define new field in the following way. But Unknown Field errors occur if I run pydoctor on my project. I think it's because current version of pydoctor do not support newfield for reStructuredText. Is there any other mechanism for defining new field? Or do you have any plans to update?

:newfield contributor: Contributor, Contributors (Alphabetical Order)
:contributor: `Glyph Lefkowitz  <mailto:[email protected]>`__
:contributor: `Edward Loper  <mailto:[email protected]>`__

@tristanlatr
Copy link
Contributor

Hi @SoyeonBaek

There is currently no way of defining custom fields.

Adding the newfield mechanism seems possible, though. Maybe we should not bother with plural handling (like epydoc) and provide simpler syntax, like: :newfield tag: label

Regarding implementation, we should add a new method: handled_newfield to the FieldHandler:

class FieldHandler:

This method should dynamically patch self in order to add the required handle_<newfield> method. This method could simply add the new field content into a self.newfields: Dict[str, List[Field]] (that maps the name of the new fields to the docstring fields). Then we should use this new variable in the format function to include the new fields into the generated HTML.

We need to make a choice about the position of the new fields in the generated HTML, should they be before the regular fields or after ?

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants