Compare commits

...

10 Commits
0.83 ... master

Author SHA1 Message Date
Oliver Marks e212e38e8a Small fix for bullet parsing.
continuous-integration/drone/push Build is passing Details
2019-07-07 11:22:40 +01:00
Oliver Marks a6e26ea84f Add pull to config
continuous-integration/drone/push Build is passing Details
2019-01-27 17:29:29 +00:00
Oliver Marks cf783857ab Remove environment section no longer needed
continuous-integration/drone/push Build is failing Details
2019-01-27 17:24:28 +00:00
Oliver Marks dad21c58f5 Modify deploy stage
continuous-integration/drone/push Build is failing Details
2019-01-27 17:13:47 +00:00
Oliver Marks a792ac1009 update pull location
continuous-integration/drone/push Build is failing Details
2019-01-27 16:37:05 +00:00
Oliver Marks e216e0a98a Fix up tests, and make div valid.
continuous-integration/drone/push Build is failing Details
2019-01-13 21:28:34 +00:00
Oly 9b61640ba5 Handle blank douments html generation and wrap reponse in div.
continuous-integration/drone/push Build is failing Details
2018-12-13 08:49:29 +00:00
Oliver Marks 66109c06fd Update to 0.84 version
continuous-integration/drone/push Build is failing Details
2018-12-10 20:49:40 +00:00
Oly 534bc31d2a Add test for export settings attributes
continuous-integration/drone/push Build is failing Details
2018-12-10 14:21:21 +00:00
Oly b2ba2897bd Update results end condition to look for a new line
continuous-integration/drone/push Build is failing Details
2018-12-10 08:38:05 +00:00
8 changed files with 67 additions and 31 deletions

View File

@ -9,30 +9,30 @@ steps:
# Auto build to pypi test
- name: deploy-test
image: olymk2/drone-pypi
image: registry.gitlab.com/olymk2/drone-pypi
pull: true
settings:
environment:
PYPI_USERNAME:
from_secret: PYPI_TEST_USERNAME
PYPI_PASSWORD:
from_secret: PYPI_TEST_PASSWORD
PYPI_REPOSITORY:
from_secret: PYPI_TEST_REPOSITORY
commands:
- env
- echo "__version__=$(date +'%y%m%d.%H%M')" > elcato/version.py
PYPI_USERNAME:
from_secret: PYPI_TEST_USERNAME
PYPI_PASSWORD:
from_secret: PYPI_TEST_PASSWORD
PYPI_REPOSITORY:
from_secret: PYPI_TEST_REPOSITORY
commands:
- env
- echo "__version__=$(date +'%y%m%d.%H%M')" > ./eorg/version.py
- python3 /bin/upload
- name: deploy
image: olymk2/drone-pypi
image: registry.gitlab.com/olymk2/drone-pypi
pull: true
settings:
environment:
PYPI_USERNAME:
from_secret: PYPI_LIVE_USERNAME
PYPI_PASSWORD:
from_secret: PYPI_LIVE_PASSWORD
PYPI_REPOSITORY:
from_secret: PYPI_LIVE_REPOSITORY
PYPI_USERNAME:
from_secret: PYPI_LIVE_USERNAME
PYPI_PASSWORD:
from_secret: PYPI_LIVE_PASSWORD
PYPI_REPOSITORY:
from_secret: PYPI_LIVE_REPOSITORY
commands:
- env
- echo "__version__=${DRONE_TAG}"

View File

@ -40,10 +40,10 @@ t_NAME = r"^\#\+NAME:"
# t_IMG = r"^\[\[(\w|\.|-|_|/)+\]\]$"
t_IMG = r"^\[\["
t_IMG_END = r"\]\]"
t_RESULTS_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\_]+\:"

View File

@ -156,7 +156,9 @@ def handle_token(doc, item, root=False):
def html(doc):
response = StringIO()
response.write('<div class="org-body">')
for item in doc:
response.write(handle_token(doc, item, True))
response.write('</div>')
response.seek(0)
return response

View File

@ -1 +1 @@
__version__=0.83
__version__=0.85

View File

@ -32,3 +32,17 @@ def test_block_settings():
assert result[1].value == expected[1].value
assert result[1].attrs == expected[1].attrs
#assert result == expected
def test_export_settings():
document = StringIO("""
#+TITLE: Tests
#+BEGIN_SRC shell :exports results
elcato create --path=/tmp/myblog
#+END_SRC
#+RESULTS:
result block here
""")
result = parse(document).doc
assert result[2].attrs.get('exports') == ['results']

View File

@ -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

View File

@ -24,7 +24,7 @@ def test_html_output():
print(htmlbody)
assert (
htmlbody
== """<h2> Header 1</h2>
== """<div class="org-body"><h2> Header 1</h2>
<h3> Sub Header 1</h3>
<p class="flow-text">body <code>text</code>
over multiple <b>lines</b>
@ -34,5 +34,5 @@ def test_html_output():
</pre></div>
</td></tr></table><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv">test</span> <span class="nv">code</span><span class="p">)</span>
</pre></div>
</td></tr></table>"""
</td></tr></table></div>"""
)

View File

@ -7,7 +7,7 @@ from eorg.generate import html
def test_bullet_block():
expected = """<ul class="browser-default"><li class="collection-item">Bullet 1</li><li class="collection-item">Bullet 2</li></ul>"""
expected = """<div class="org-body"><ul class="browser-default"><li class="collection-item">Bullet 1</li><li class="collection-item">Bullet 2</li></ul></div>"""
result = html(parse(snippets.bullet_plus_snippet).doc)
assert result.read() == expected
@ -33,4 +33,4 @@ def test_render_results():
assert tags[1].value[1].value == expected[1].value
htmlbody = html(tags).read()
assert htmlbody == '<img style="margin:auto;" src="test.png" alt="" />'
assert htmlbody == '<div class="org-body"><img style="margin:auto;" src="test.png" alt="" /></div>'