File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 6
6
7
7
from generator import model
8
8
9
+ BASIC_LINK_RE = re .compile (r"{@link +(\w+) ([\w ]+)}" )
10
+ BASIC_LINK_RE2 = re .compile (r"{@link +(\w+)\.(\w+) ([\w \.`]+)}" )
11
+ BASIC_LINK_RE3 = re .compile (r"{@link +(\w+)}" )
12
+ BASIC_LINK_RE4 = re .compile (r"{@link +(\w+)\.(\w+)}" )
9
13
PARTS_RE = re .compile (r"(([a-z0-9])([A-Z]))" )
10
14
11
15
16
+ def _fix_links (line : str ) -> str :
17
+ line = BASIC_LINK_RE .sub (r'<see cref="\1">\2</see>' , line )
18
+ line = BASIC_LINK_RE2 .sub (r'<see cref="\1.\2">\3</see>' , line )
19
+ line = BASIC_LINK_RE3 .sub (r'<see cref="\1" />' , line )
20
+ line = BASIC_LINK_RE4 .sub (r'<see cref="\1.\2" />' , line )
21
+ return line
22
+
23
+
12
24
def lines_to_doc_comments (lines : List [str ]) -> List [str ]:
13
25
if not lines :
14
26
return []
27
+
15
28
return (
16
29
["/// <summary>" ]
17
- + [f"/// { line } " for line in lines if not line .startswith ("@" )]
30
+ + [f"/// { _fix_links ( line ) } " for line in lines if not line .startswith ("@" )]
18
31
+ ["/// </summary>" ]
19
32
)
20
33
You can’t perform that action at this time.
0 commit comments