From c4fb3fdfe33a919494ae41e38f338b6b81fe0683 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sun, 25 Jul 2021 01:51:40 +1000 Subject: [PATCH] tools: Stop initial blank lines being stripped. --- eris/tools.py | 2 +- tests/golden-files/results/contents-hi3_py | 2 ++ tests/golden-files/results/python_gut-hi3_py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/eris/tools.py b/eris/tools.py index 6ac1c57..9cf3364 100755 --- a/eris/tools.py +++ b/eris/tools.py @@ -154,7 +154,7 @@ def _syntax_highlight(text, lexer, style): def _syntax_highlight_using_path(text, path): - lexer = pygments.lexers.get_lexer_for_filename(path, text) + lexer = pygments.lexers.get_lexer_for_filename(path, text, stripnl=False) style = pygments.styles.get_style_by_name(os.environ["PYGMENT_STYLE"]) return _syntax_highlight(text, lexer, style) diff --git a/tests/golden-files/results/contents-hi3_py b/tests/golden-files/results/contents-hi3_py index 9e9eed2..25d6b2e 100644 --- a/tests/golden-files/results/contents-hi3_py +++ b/tests/golden-files/results/contents-hi3_py @@ -1,2 +1,4 @@ +  +  def hi():   print("hi") \ No newline at end of file diff --git a/tests/golden-files/results/python_gut-hi3_py b/tests/golden-files/results/python_gut-hi3_py index cb7ff1a..38d0e11 100644 --- a/tests/golden-files/results/python_gut-hi3_py +++ b/tests/golden-files/results/python_gut-hi3_py @@ -1 +1,3 @@ +  +  def hi(): \ No newline at end of file