Passed
Pull Request — develop (#110)
by inkhey
01:45
created

convert_to_another_markup()   A

Complexity

Conditions 3

Size

Total Lines 17
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 17
rs 10
c 0
b 0
f 0
cc 3
nop 3
1
TEXT_MARKUP = 'text'
2
HTML_MARKUP = 'html'
3
4
5
def convert_to_another_markup(
6
        content: str,
7
        input_markup: str,
8
        output_markup: str,
9
) -> str:
10
    """
11
12
    :param content: content as string
13
    :param input_markup: valid markup langage slug
14
    :param output_markup: valid markup langage slug
15
    :return: converted_content as string
16
    """
17
    # TODO - G.M - 2018-10-29 - Support for html content, deal correctly
18
    # with line break.
19
    if input_markup == TEXT_MARKUP and output_markup == HTML_MARKUP:
20
        content = content.replace('\n', '<br/>')
21
    return content
22