[ADD] подсветка синтаксиса C и C++ в листингах
This commit is contained in:
@@ -334,7 +334,7 @@ LISTING_MD = (
|
||||
def test_listing_with_caption() -> None:
|
||||
tex = render(LISTING_MD)
|
||||
assert "caption={Потокобезопасная очередь}" in tex
|
||||
assert "language=C++" in tex
|
||||
assert "language=[modern]C++" in tex
|
||||
assert "class ThreadSafeQueue {};" in tex
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ def test_listing_caption_paragraph_is_not_duplicated() -> None:
|
||||
|
||||
def test_listing_without_caption_stays_bare() -> None:
|
||||
tex = render("```cpp\nint main() {}\n```\n")
|
||||
assert "\\begin{lstlisting}[language=C++]" in tex
|
||||
assert "\\begin{lstlisting}[language=[modern]C++]" in tex
|
||||
assert "caption=" not in tex
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ def test_paragraph_starting_with_listing_word_is_not_a_caption() -> None:
|
||||
def test_listing_language_is_mapped_to_listings_name() -> None:
|
||||
"""listings не знает 'cpp', только 'C++'."""
|
||||
tex = render("```cpp\nint x;\n```\n")
|
||||
assert "language=C++" in tex
|
||||
assert "language=[modern]C++" in tex
|
||||
|
||||
|
||||
def test_listing_unsupported_language_falls_back_to_plain() -> None:
|
||||
@@ -480,3 +480,9 @@ def test_abbreviation_table_has_no_extra_column_padding() -> None:
|
||||
"""Отбивка между колонками добавляется к \\linewidth и роняет строку за поле."""
|
||||
tex = body(render(ABBR_MD))
|
||||
assert "@{}p{\\dimexpr\\linewidth" in tex
|
||||
|
||||
|
||||
def test_cpp_uses_extended_dialect() -> None:
|
||||
"""Встроенный C++ в listings не знает auto, nullptr и override."""
|
||||
tex = body(render("```cpp\nauto x = nullptr;\n```\n"))
|
||||
assert "language=[modern]C++" in tex
|
||||
|
||||
Reference in New Issue
Block a user