From e212e38e8aa7d0f27166774591776fe45b031f77 Mon Sep 17 00:00:00 2001 From: Oliver Marks Date: Sun, 7 Jul 2019 11:22:40 +0100 Subject: [PATCH] Small fix for bullet parsing. --- eorg/const.py | 2 +- eorg/version.py | 2 +- tests/test_document_parsing.py | 28 ++++++++++++++++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/eorg/const.py b/eorg/const.py index 0114e73..c1fcdac 100755 --- a/eorg/const.py +++ b/eorg/const.py @@ -43,7 +43,7 @@ t_IMG_END = r"\]\]" t_RESULTS_END = r"^\s*$" t_END_LABELS = r"^(?!\[|\#).*" t_BULLET_START = r"^\s*[\+|\-|0-9\.]" -t_BULLET_END = r"^\s*(?![\+|\-|0-9]).*$" +t_BULLET_END = r"^(?!\s*[\+|\-|0-9\.]).*$" t_HEADER = r"^\*+" t_META_OTHER = r"^[#]\+[A-Z\_]+\:" diff --git a/eorg/version.py b/eorg/version.py index cfc7f5a..695f800 100755 --- a/eorg/version.py +++ b/eorg/version.py @@ -1 +1 @@ -__version__=0.84 +__version__=0.85 diff --git a/tests/test_document_parsing.py b/tests/test_document_parsing.py index 76e31f5..1ea0c23 100644 --- a/tests/test_document_parsing.py +++ b/tests/test_document_parsing.py @@ -201,10 +201,28 @@ def test_bullet_block(): assert result[1].token == tokens.BULLET assert result[1].value == expected[1].value + text = StringIO( + """ +- Bullet 1 +- Bullet 2 + -Bullet 3""" + ) + + expected = [ + Token(tokens.BLANK, ""), + Token(tokens.BULLET, """- Bullet 1\n- Bullet 2\n -Bullet 3\n"""), + ] + result = parse(text).doc + assert result[0].token == tokens.BLANK + assert result[0].value == expected[0].value + assert result[1].token == tokens.BULLET + assert result[1].value == expected[1].value + @pytest.mark.skip def test_src_block_images(): - text = StringIO(""" + text = StringIO( + """ #+BEGIN_SRC latex :exports results :file test.png :results raw file \begin{equation} x=\sqrt{b} @@ -213,12 +231,14 @@ x=\sqrt{b} #+RESULTS: [[file:test.png]] -""") +""" + ) expected = [ Token(tokens.BLANK, ""), - Token(tokens.SOURCE, """\begin{equation}\nx=\sqrt{b}\n\end{equation}"""), + Token( + tokens.SOURCE, """\begin{equation}\nx=\sqrt{b}\n\end{equation}""" + ), Token(tokens.BLANK, ""), - ] result = parse(text).doc assert result[0].token == tokens.BLANK