Fix org parameter parsing
This commit is contained in:
parent
13d9f685d9
commit
0eee46b2ae
|
@ -86,7 +86,7 @@ class Document:
|
||||||
def parse_attrs(text):
|
def parse_attrs(text):
|
||||||
attrs = {}
|
attrs = {}
|
||||||
value_list = text.split(':')
|
value_list = text.split(':')
|
||||||
attrs['language'] = value_list.pop(0)
|
attrs['language'] = value_list.pop(0).strip()
|
||||||
for row in value_list:
|
for row in value_list:
|
||||||
values = row.strip().split(' ')
|
values = row.strip().split(' ')
|
||||||
attrs[values[0]] = values[1:]
|
attrs[values[0]] = values[1:]
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
__version__ = 0.2
|
__version__ = 0.3
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,33 @@ import os
|
||||||
import pytest
|
import pytest
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from eorg.parser import parse
|
from eorg.parser import parse
|
||||||
|
from eorg.parser import Token
|
||||||
|
|
||||||
CODE_BLOCK_EXAMPLE_01 = StringIO("""
|
|
||||||
|
CODE_BLOCK_EXAMPLE_01 = StringIO(
|
||||||
|
"""
|
||||||
#+BEGIN_SRC shell :results silent :tangle .env
|
#+BEGIN_SRC shell :results silent :tangle .env
|
||||||
elcato create --path=/tmp/myblog
|
elcato create --path=/tmp/myblog
|
||||||
#+END_SRC""")
|
#+END_SRC"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_block_settings():
|
def test_block_settings():
|
||||||
result = parse(CODE_BLOCK_EXAMPLE_01)
|
expected = [
|
||||||
assert [i for i in result] == []
|
Token(token="BREAK", value=""),
|
||||||
|
Token(
|
||||||
|
token="SRC_BEGIN",
|
||||||
|
value="elcato create --path=/tmp/myblog\n",
|
||||||
|
attrs={
|
||||||
|
"language": "shell",
|
||||||
|
"results": ["silent"],
|
||||||
|
"tangle": [".env"],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
result = [i for i in parse(CODE_BLOCK_EXAMPLE_01)]
|
||||||
|
assert result[0].value == expected[0].value
|
||||||
|
assert result[1].value == expected[1].value
|
||||||
|
assert result[1].attrs == expected[1].attrs
|
||||||
|
#assert result == expected
|
||||||
|
|
Loading…
Reference in New Issue