File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1104,6 +1104,11 @@ def safe_default_value(p: inspect.Parameter):
11041104 elif ' at 0x' in repr (p .default ):
11051105 replacement = re .sub (r' at 0x\w+' , '' , repr (p .default ))
11061106
1107+ nonlocal link
1108+ if link and ('<' in repr (p .default ) or '>' in repr (p .default )):
1109+ import html
1110+ replacement = html .escape (replacement or p .default )
1111+
11071112 if replacement :
11081113 class mock :
11091114 def __repr__ (self ):
Original file line number Diff line number Diff line change 104104 if returns:
105105 returns = ' ->\N{NBSP} ' + returns
106106 %>
107- <span >${ f.funcdef()} ${ ident(f.name)} </span >(<span >${ params | h } )${ returns | h } </span >
107+ <span >${ f.funcdef()} ${ ident(f.name)} </span >(<span >${ params} )${ returns} </span >
108108 </code ></dt >
109109 <dd >${ show_desc(f)} </dd >
110110 </%def >
Original file line number Diff line number Diff line change @@ -639,6 +639,9 @@ def test_Function_params(self):
639639 func = pdoc .Function ('f' , mod , lambda a = object (): None )
640640 self .assertEqual (func .params (), ['a=<object object>' ])
641641
642+ func = pdoc .Function ('f' , mod , lambda a = object (): None )
643+ self .assertEqual (func .params (link = lambda x : '' ), ['a=<object object>' ])
644+
642645 # typed
643646 def f (a : int , * b , c : typing .List [pdoc .Doc ] = []): pass
644647 func = pdoc .Function ('f' , mod , f )
You can’t perform that action at this time.
0 commit comments