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

Wrap signatures onto several lines when function len is over a treshold and function has the focus #831

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
dea121c
Introduce ParsedDocstring.with_linker()/.with_tag()/.combine(). The w…
tristanlatr Oct 25, 2024
95f8f3d
Colorize the signature ourself.
tristanlatr Oct 25, 2024
0b7c76e
Some more adjustments. Make the self param always inline. Try to opti…
tristanlatr Oct 25, 2024
188c410
Add comment
tristanlatr Oct 25, 2024
83d47f7
Fix usage of cache
tristanlatr Oct 25, 2024
ab1cdd1
Fix usages of cache
tristanlatr Oct 25, 2024
eca5ced
Simplify with_linker() and with_tag(). These do not create new parsed…
tristanlatr Oct 25, 2024
ff4269f
Revert "Simplify with_linker() and with_tag(). These do not create ne…
tristanlatr Oct 25, 2024
914e01c
Minor changes not to use lru_cache too much
tristanlatr Oct 25, 2024
cdef965
Try to optimize what I can
tristanlatr Oct 25, 2024
2033d65
Fix mypy
tristanlatr Oct 26, 2024
5396396
Merge branch 'master' into 801-signature-spans
tristanlatr Oct 26, 2024
282250b
Remove unused imports
tristanlatr Oct 26, 2024
6a4de9f
Better implementation of with_linker and with_tag inside a single sub…
tristanlatr Oct 29, 2024
c0f93dc
First attempt to implement relatively smart Expand/Collapse signature…
tristanlatr Oct 29, 2024
da89d7c
Simplify things: don't try to wrap overload signatures. Sphinx doesn'…
tristanlatr Nov 14, 2024
141b211
Get rid of the ParsedStanOnly by using parsed_text_with_css instead.
tristanlatr Nov 14, 2024
a46a3a3
Few simplifications here and there.
tristanlatr Nov 14, 2024
40ac0a6
Use the CSS class 'decorator' for all decorators.
tristanlatr Nov 14, 2024
4172485
Fix various bugs in the implementation.
tristanlatr Nov 14, 2024
7103ce5
Fix pyflakes
tristanlatr Nov 14, 2024
eae961a
Fix format_undocumented_summary returning a tuple of strings instead …
tristanlatr Nov 14, 2024
7c6c6eb
increase the threshold for a function to be rendered in several lines.
tristanlatr Nov 14, 2024
19400ff
Avoid an empty div for decorators when there are no decorators.
tristanlatr Nov 14, 2024
a3ebbdf
Use non breaking spaces in sugnature defs.
tristanlatr Nov 14, 2024
cd257eb
Improve a little bit the rendering of parameter tables that uses very…
tristanlatr Nov 15, 2024
907792a
Get rid of the AnnotationLinker - drop the verbose messages when an a…
tristanlatr Nov 16, 2024
977e5b5
Merge branch 'master' into 801-signature-spans
tristanlatr Nov 16, 2024
91edc51
Change comment
tristanlatr Nov 18, 2024
b504c21
Merge branch '801-signature-spans' of github.com:twisted/pydoctor int…
tristanlatr Nov 18, 2024
25b5e62
Add an environment to build temporalio docs
tristanlatr Nov 21, 2024
bd2de92
Add a bug overload in the google demo
tristanlatr Nov 21, 2024
cc82f10
Apply suggestions from code review
tristanlatr Dec 13, 2024
07fc41d
Merge branch 'master' into 801-signature-spans
tristanlatr Dec 13, 2024
668f4d0
Fix the NotFoundLinker
tristanlatr Dec 13, 2024
7fc2b10
Do not mark overloaded functions with css class .long-signature
tristanlatr Dec 13, 2024
80de043
Remove unused imports
tristanlatr Dec 13, 2024
a9c5bf2
Add readme entries
tristanlatr Dec 13, 2024
6784e4c
Upadate docs tests
tristanlatr Dec 13, 2024
78f73b9
Like back, consider a function long from 88 chars.
tristanlatr Dec 13, 2024
bf7045f
Adjust test again
tristanlatr Dec 13, 2024
a37b028
Update README.rst
tristanlatr Dec 13, 2024
8b24212
Merge branch 'master' into 801-signature-spans
tristanlatr Jan 14, 2025
56168f8
Fix typo
tristanlatr Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add comment
  • Loading branch information
tristanlatr committed Oct 25, 2024
commit 188c410671be7cbe923eaa969f84402450f0644c
11 changes: 8 additions & 3 deletions pydoctor/templatewriter/pages/__init__.py
Original file line number Diff line number Diff line change
@@ -112,6 +112,10 @@ def format_overloads(func: model.Function) -> Iterator["Flattenable"]:
"""
Format a function overloads definitions as nice HTML signatures.
"""
# TODO: Find a manner to wrap long overloads like the ones from temporalio.client.Client.start_workflow
# Maybe when there are more than one long overload, we create a fake overload without any annotations
# expect the one that are the same accros all overloads, then this could be showed when clicking on the function name then all overloads
# could be showed on demand
for overload in func.overloads:
yield from format_decorators(overload)
yield tags.div(format_function_def(func.name, func.is_async, overload))
@@ -130,13 +134,14 @@ def format_function_def(func_name: str, is_async: bool,
def_stmt = 'async def' if is_async else 'def'
if func_name.endswith('.setter') or func_name.endswith('.deleter'):
func_name = func_name[:func_name.rindex('.')]
func_class = 'function-signature'

func_signature_css_class = 'function-signature'
if epydoc2stan.is_long_function_def(func):
func_class += ' expand-signature'
func_signature_css_class += ' expand-signature'
r.extend([
tags.span(def_stmt, class_='py-keyword'), ' ',
tags.span(func_name, class_='py-defname'),
tags.span(format_signature(func), class_=func_class), ':',
tags.span(format_signature(func), class_=func_signature_css_class), ':',
])
return r