Substitute out links
This commit is contained in:
parent
84239d053c
commit
04b5522e7f
|
@ -39,9 +39,11 @@ def to_camel_case(description: str) -> str:
|
|||
description = description.strip(' \t.').replace(',',' ')
|
||||
words = description.split(' ')
|
||||
|
||||
words[0] = words[0].lower()
|
||||
words[0] = words[0][0].lower() + words[0][1:]
|
||||
for i in range(1, len(words)):
|
||||
words[i] = words[i].capitalize()
|
||||
if words[i] == '':
|
||||
continue
|
||||
words[i] = words[i][0].upper() + words[i][1:]
|
||||
|
||||
return ''.join(words)
|
||||
|
||||
|
@ -51,7 +53,9 @@ def from_camel_case(name: str) -> str:
|
|||
def parse_javadoc_to_description(text: str| None):
|
||||
if text is None:
|
||||
return ''
|
||||
return re.sub(r'\n\s*\*', ' ', text).strip()
|
||||
text = re.sub(r'\n\s*\*', ' ', text).strip()
|
||||
text = re.sub(r'\{@link\s+(\w+)\}', r'\1', text)
|
||||
return text
|
||||
|
||||
def replace_test_pattern(match: re.Match, with_javadoc: bool, with_display_name: bool) -> str:
|
||||
javadoc = parse_javadoc_to_description(match.group('javadoc'))
|
||||
|
|
|
@ -52,6 +52,21 @@ OUTPUT_4 = """
|
|||
public void concatTwoProducesANewArrayWithTheTwoInputArraysJoinedTogetherWithNoSeparators()
|
||||
"""
|
||||
|
||||
INPUT_5 = """
|
||||
/**
|
||||
* {@link ZkBinderContextImpl} propagates a lot of fields directly from the underlying {@link
|
||||
* ZkBinderContext}.
|
||||
*/
|
||||
@Test
|
||||
public void propagate()
|
||||
"""
|
||||
|
||||
OUTPUT_5 = """
|
||||
@Test
|
||||
@DisplayName("ZkBinderContextImpl propagates a lot of fields directly from the underlying ZkBinderContext")
|
||||
public void zkBinderContextImplPropagatesALotOfFieldsDirectlyFromTheUnderlyingZkBinderContext()
|
||||
"""
|
||||
|
||||
|
||||
def test_javadoc_parsing():
|
||||
assert re.match(PATTERN_JAVADOC, '/** Hello World */') is not None
|
||||
|
@ -71,3 +86,6 @@ def test_3():
|
|||
def test_4():
|
||||
assert standardize_java_text(INPUT_4.strip(),False,True) == OUTPUT_4.strip()
|
||||
|
||||
def test_5():
|
||||
assert standardize_java_text(INPUT_5.strip(),False,True) == OUTPUT_5.strip()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user