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

backend.tracim_backend.lib.utils.markup_conversion   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A convert_to_another_markup() 0 17 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