Merge branch 'main' into feature/latex
This commit is contained in:
@@ -94,6 +94,8 @@ CQ CQ hier ist DL1PZ mit einem allgemeinen Anruf, hier ist DL1PZ und hört.
|
||||
[table:n_morsetelegrafie_morsecode_buchstaben:Morsecode (Buchstaben)]
|
||||
</webmargin>
|
||||
|
||||
Das ist ein A in Morsecode: [morse:a], das finde ich ganz toll!
|
||||
|
||||
<webtip>
|
||||
...
|
||||
</webtip>
|
||||
|
||||
@@ -11,6 +11,7 @@ def test_halfwidth_space_html():
|
||||
|
||||
assert mistletoe.markdown(input, FiftyOhmHtmlRenderer) == paragraph(target)
|
||||
|
||||
|
||||
def test_halfwidth_space_latex():
|
||||
input = "Dies ist z.B. ein Test. D.h. hier sollten d.h. Spaces ersetzt worden sein."
|
||||
target = "\nDies ist z.\,B. ein Test. D.\,h. hier sollten d.\,h. Spaces ersetzt worden sein.\n"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
import mistletoe
|
||||
|
||||
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
|
||||
|
||||
def test_html(capsys) :
|
||||
|
||||
with capsys.disabled():
|
||||
with open("test/acceptanceTest.md") as file:
|
||||
content = file.read()
|
||||
output = mistletoe.markdown(content, FiftyOhmHtmlRenderer)
|
||||
with open("test/acceptanceTest.html", "w") as output_file:
|
||||
output_file.write(output)
|
||||
@@ -0,0 +1,17 @@
|
||||
import mistletoe
|
||||
|
||||
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
|
||||
|
||||
def test_morse_html() :
|
||||
|
||||
assertions = {
|
||||
'"[morse:a]"' : "<p>"+FiftyOhmHtmlRenderer.render_morse_helper([[1,2]])+"</p>\n",
|
||||
'"[morse: a]"' : "<p>"+FiftyOhmHtmlRenderer.render_morse_helper([[1,2]])+"</p>\n",
|
||||
'"[morse: aaa]"' : "<p>"+FiftyOhmHtmlRenderer.render_morse_helper([[1,2],[1,2],[1,2]])+"</p>\n",
|
||||
'"[morse: a a]"' : "<p>"+FiftyOhmHtmlRenderer.render_morse_helper([[1,2],[3],[1,2]])+"</p>\n",
|
||||
'"[morse: db0]"' : "<p>"+FiftyOhmHtmlRenderer.render_morse_helper([[2,1,1],[2,1,1,1],[2,2,2,2,2]])+"</p>\n",
|
||||
}
|
||||
|
||||
for assertion in assertions:
|
||||
assert mistletoe.markdown(assertion, FiftyOhmHtmlRenderer) == assertions[assertion]
|
||||
@@ -0,0 +1,17 @@
|
||||
import mistletoe
|
||||
|
||||
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
from test.util import paragraph
|
||||
|
||||
|
||||
def test_references_html():
|
||||
# Right now this tests only the default values.
|
||||
# The correct behavior can be tested when the information is added to the renderer class
|
||||
assertions = {
|
||||
"[ref:e_oszilloskop_bildschirmfoto_sinus]": '<a href="section.html#ref_e_oszilloskop_bildschirmfoto_sinus" onclick="highlightRef(\'e_oszilloskop_bildschirmfoto_sinus\');">0</a>',
|
||||
"[ref:n_rst_r]": '<a href="section.html#ref_n_rst_r" onclick="highlightRef(\'n_rst_r\');">0</a>',
|
||||
"[ref:Uuuuuh]": '<a href="section.html#ref_Uuuuuh" onclick="highlightRef(\'Uuuuuh\');">0</a>', # Test the default parameters
|
||||
}
|
||||
|
||||
for key, value in assertions.items():
|
||||
assert mistletoe.markdown(key, FiftyOhmHtmlRenderer) == paragraph(value)
|
||||
@@ -4,6 +4,7 @@ from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
from renderer.fifty_ohm_latex_renderer import FiftyOhmLaTeXRenderer
|
||||
|
||||
|
||||
|
||||
def test_thematic_break_html() :
|
||||
assertions = {
|
||||
"---" : '<a id="margin_1"></a>\n',
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import mistletoe
|
||||
import pytest
|
||||
|
||||
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
|
||||
from .util import paragraph
|
||||
|
||||
|
||||
@pytest.mark.html
|
||||
def test_basic_units_html():
|
||||
"""Test basic units: Insert non-breaking, smaller space."""
|
||||
assertions = {
|
||||
"1 V": "1 V",
|
||||
"0,12 V": "0,12 V",
|
||||
"0,75 kW": "0,75 kW",
|
||||
"33 A": "33 A",
|
||||
"1 Ah": "1 Ah", # Ah can be a tricky case if the RegEx is wrong, as A might match before Ah, thus rendering the output with an "A" unit
|
||||
}
|
||||
|
||||
for input, output in assertions.items():
|
||||
assert mistletoe.markdown(input, FiftyOhmHtmlRenderer) == paragraph(output)
|
||||
|
||||
|
||||
@pytest.mark.html
|
||||
def test_translated_units_html():
|
||||
"""Test translated units: Replace Ohm with Ω."""
|
||||
assertions = {
|
||||
"50 Ohm": "50 Ω",
|
||||
"100 mOhm": "100 mΩ",
|
||||
}
|
||||
|
||||
for input, output in assertions.items():
|
||||
assert mistletoe.markdown(input, FiftyOhmHtmlRenderer) == paragraph(output)
|
||||
|
||||
|
||||
@pytest.mark.html
|
||||
def test_special_units_html():
|
||||
"""Test special units: Don't put space before ° and %."""
|
||||
assertions = {
|
||||
"100%": "100%",
|
||||
"42,24°": "42,24°",
|
||||
}
|
||||
|
||||
for input, output in assertions.items():
|
||||
assert mistletoe.markdown(input, FiftyOhmHtmlRenderer) == paragraph(output)
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
def paragraph(text) :
|
||||
return f'<p>{text}</p>\n'
|
||||
def paragraph(text):
|
||||
return f"<p>{text}</p>\n"
|
||||
|
||||
Reference in New Issue
Block a user