mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Fix unit tests
							parent
							
								
									7d4addfac8
								
							
						
					
					
						commit
						3e2e7f25bf
					
				
							
								
								
									
										2
									
								
								blog.py
								
								
								
								
							
							
						
						
									
										2
									
								
								blog.py
								
								
								
								
							| 
						 | 
				
			
			@ -313,7 +313,7 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
 | 
			
		|||
        if citations_str:
 | 
			
		||||
            citations_str = '<p><b>' + translate['Citations'] + \
 | 
			
		||||
                ':</b></p>' + \
 | 
			
		||||
                '<ul>\n' + citations_str + '</ul>\n'
 | 
			
		||||
                '<u>\n' + citations_str + '</u>\n'
 | 
			
		||||
 | 
			
		||||
    blog_str += '<br>\n' + citations_str
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -256,6 +256,10 @@ code {
 | 
			
		|||
    line-height: var(--code-spacing);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ul.md_list {
 | 
			
		||||
    color: var(--main-fg-color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
audio {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										21
									
								
								markdown.py
								
								
								
								
							
							
						
						
									
										21
									
								
								markdown.py
								
								
								
								
							| 
						 | 
				
			
			@ -68,13 +68,13 @@ def _markdown_emphasis_html(markdown: str) -> str:
 | 
			
		|||
        '*)': '</i>)',
 | 
			
		||||
        '*,': '</i>,',
 | 
			
		||||
        '*\n': '</i>\n',
 | 
			
		||||
        ' _': ' <ul>',
 | 
			
		||||
        '_ ': '</ul> ',
 | 
			
		||||
        '_.': '</ul>.',
 | 
			
		||||
        '_:': '</ul>:',
 | 
			
		||||
        '_;': '</ul>;',
 | 
			
		||||
        '_,': '</ul>,',
 | 
			
		||||
        '_\n': '</ul>\n',
 | 
			
		||||
        ' _': ' <u>',
 | 
			
		||||
        '_ ': '</u> ',
 | 
			
		||||
        '_.': '</u>.',
 | 
			
		||||
        '_:': '</u>:',
 | 
			
		||||
        '_;': '</u>;',
 | 
			
		||||
        '_,': '</u>,',
 | 
			
		||||
        '_\n': '</u>\n',
 | 
			
		||||
        ' `': ' <em>',
 | 
			
		||||
        '`.': '</em>.',
 | 
			
		||||
        '`:': '</em>:',
 | 
			
		||||
| 
						 | 
				
			
			@ -100,14 +100,14 @@ def _markdown_emphasis_html(markdown: str) -> str:
 | 
			
		|||
        elif section_text.startswith('*'):
 | 
			
		||||
            section_text = section_text[1:] + '<i>'
 | 
			
		||||
        elif section_text.startswith('_'):
 | 
			
		||||
            section_text = section_text[1:] + '<ul>'
 | 
			
		||||
            section_text = section_text[1:] + '<u>'
 | 
			
		||||
 | 
			
		||||
        if section_text.endswith('**'):
 | 
			
		||||
            section_text = section_text[:len(section_text) - 2] + '</b>'
 | 
			
		||||
        elif section_text.endswith('*'):
 | 
			
		||||
            section_text = section_text[:len(section_text) - 1] + '</i>'
 | 
			
		||||
        elif section_text.endswith('_'):
 | 
			
		||||
            section_text = section_text[:len(section_text) - 1] + '</ul>'
 | 
			
		||||
            section_text = section_text[:len(section_text) - 1] + '</u>'
 | 
			
		||||
 | 
			
		||||
        if section_text.strip():
 | 
			
		||||
            markdown += section_text
 | 
			
		||||
| 
						 | 
				
			
			@ -259,7 +259,8 @@ def _markdown_replace_bullet_points(markdown: str) -> str:
 | 
			
		|||
                for index in range(start_line, line_ctr):
 | 
			
		||||
                    line_text = lines[index].replace(bullet_matched, '', 1)
 | 
			
		||||
                    if index == start_line:
 | 
			
		||||
                        lines[index] = '<ul>\n<li>' + line_text + '</li>'
 | 
			
		||||
                        lines[index] = \
 | 
			
		||||
                            '<ul class="md_list">\n<li>' + line_text + '</li>'
 | 
			
		||||
                    elif index == line_ctr - 1:
 | 
			
		||||
                        lines[index] = '<li>' + line_text + '</li>\n</ul>'
 | 
			
		||||
                    else:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								tests.py
								
								
								
								
							
							
						
						
									
										14
									
								
								tests.py
								
								
								
								
							| 
						 | 
				
			
			@ -5736,7 +5736,8 @@ def _test_markdown_to_html():
 | 
			
		|||
        'And some other text.'
 | 
			
		||||
    result = markdown_to_html(markdown)
 | 
			
		||||
    expected = \
 | 
			
		||||
        'This is a list of points:<br>\n<ul><br>\n<li>Point 1</li><br>\n' + \
 | 
			
		||||
        'This is a list of points:<br>\n<ul class="md_list">' + \
 | 
			
		||||
        '<br>\n<li>Point 1</li><br>\n' + \
 | 
			
		||||
        '<li>Point 2</li><br>\n<li></li><br>\n</ul><br>\n' + \
 | 
			
		||||
        'And some other text.<br>\n'
 | 
			
		||||
    if result != expected:
 | 
			
		||||
| 
						 | 
				
			
			@ -5749,7 +5750,7 @@ def _test_markdown_to_html():
 | 
			
		|||
        'And some other text.'
 | 
			
		||||
    result = markdown_to_html(markdown)
 | 
			
		||||
    expected = \
 | 
			
		||||
        'This is a list of points:<br>\n<ul><br>\n' + \
 | 
			
		||||
        'This is a list of points:<br>\n<ul class="md_list"><br>\n' + \
 | 
			
		||||
        '<li><b>Point 1</b></li><br>\n' + \
 | 
			
		||||
        '<li><i>Point 2</i></li><br>\n<li></li><br>\n</ul><br>\n' + \
 | 
			
		||||
        'And some other text.<br>\n'
 | 
			
		||||
| 
						 | 
				
			
			@ -5767,10 +5768,11 @@ def _test_markdown_to_html():
 | 
			
		|||
    expected = \
 | 
			
		||||
        'This is a code section:<br>\n' + \
 | 
			
		||||
        '<code>\n' + \
 | 
			
		||||
        '10 PRINT "YOLO"<br>\n' + \
 | 
			
		||||
        '20 GOTO 10<br>\n' + \
 | 
			
		||||
        '10 PRINT "YOLO"\n' + \
 | 
			
		||||
        '20 GOTO 10\n' + \
 | 
			
		||||
        '</code>\n' + \
 | 
			
		||||
        '<br>\nAnd some other text.<br>\n'
 | 
			
		||||
        '<br>\n' + \
 | 
			
		||||
        'And some other text.<br>\n'
 | 
			
		||||
    if result != expected:
 | 
			
		||||
        print(result)
 | 
			
		||||
    assert result == expected
 | 
			
		||||
| 
						 | 
				
			
			@ -5782,7 +5784,7 @@ def _test_markdown_to_html():
 | 
			
		|||
    assert markdown_to_html(markdown) == 'This is <i>italic</i>'
 | 
			
		||||
 | 
			
		||||
    markdown = 'This is _underlined_'
 | 
			
		||||
    assert markdown_to_html(markdown) == 'This is <ul>underlined</ul>'
 | 
			
		||||
    assert markdown_to_html(markdown) == 'This is <u>underlined</u>'
 | 
			
		||||
 | 
			
		||||
    markdown = 'This is **just** plain text'
 | 
			
		||||
    assert markdown_to_html(markdown) == 'This is <b>just</b> plain text'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ def _html_podcast_chapters(link_url: str,
 | 
			
		|||
            if chapters_html:
 | 
			
		||||
                html_str = \
 | 
			
		||||
                    '<div class="chapters">\n' + \
 | 
			
		||||
                    '  <ul>\n' + chapters_html + '  </ul>\n</div>\n'
 | 
			
		||||
                    '  <u>\n' + chapters_html + '  </u>\n</div>\n'
 | 
			
		||||
    return html_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1008,7 +1008,7 @@ def _get_blog_citations_html(box_name: str,
 | 
			
		|||
        if translate.get(translated_citations_str):
 | 
			
		||||
            translated_citations_str = translate[translated_citations_str]
 | 
			
		||||
        citations_str = '<p><b>' + translated_citations_str + ':</b></p>' + \
 | 
			
		||||
            '<ul>\n' + citations_str + '</ul>\n'
 | 
			
		||||
            '<u>\n' + citations_str + '</u>\n'
 | 
			
		||||
    return citations_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue