diff --git a/generator/plugins/dotnet/dotnet_helpers.py b/generator/plugins/dotnet/dotnet_helpers.py index 5b4f39b..5d83351 100644 --- a/generator/plugins/dotnet/dotnet_helpers.py +++ b/generator/plugins/dotnet/dotnet_helpers.py @@ -6,15 +6,28 @@ from generator import model +BASIC_LINK_RE = re.compile(r"{@link +(\w+) ([\w ]+)}") +BASIC_LINK_RE2 = re.compile(r"{@link +(\w+)\.(\w+) ([\w \.`]+)}") +BASIC_LINK_RE3 = re.compile(r"{@link +(\w+)}") +BASIC_LINK_RE4 = re.compile(r"{@link +(\w+)\.(\w+)}") PARTS_RE = re.compile(r"(([a-z0-9])([A-Z]))") +def _fix_links(line: str) -> str: + line = BASIC_LINK_RE.sub(r'\2', line) + line = BASIC_LINK_RE2.sub(r'\3', line) + line = BASIC_LINK_RE3.sub(r'', line) + line = BASIC_LINK_RE4.sub(r'', line) + return line + + def lines_to_doc_comments(lines: List[str]) -> List[str]: if not lines: return [] + return ( ["/// "] - + [f"/// {line}" for line in lines if not line.startswith("@")] + + [f"/// {_fix_links(line)}" for line in lines if not line.startswith("@")] + ["/// "] )