Working on source block tests.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Oliver Marks 2018-12-06 07:22:32 +00:00
parent d21e391f81
commit ae9a504014
3 changed files with 46 additions and 17 deletions

View File

@ -10,28 +10,30 @@ steps:
# Auto build to pypi test
- name: deploy-test
image: olymk2/drone-pypi
environment:
PYPI_USERNAME:
from_secret: PYPI_USERNAME
PYPI_PASSWORD:
from_secret: PYPI_PASSWORD
PYPI_REPOSITORY:
from_secret: PYPI_REPOSITORY
commands:
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
- name: deploy
image: olymk2/drone-pypi
environment:
PYPI_USERNAME:
from_secret: PYPI_USERNAME
PYPI_PASSWORD:
from_secret: PYPI_PASSWORD
PYPI_REPOSITORY:
from_secret: PYPI_REPOSITORY
commands:
settings:
environment:
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}"
- echo "__version__=${DRONE_TAG}" > eorg/version.py

View File

@ -68,6 +68,19 @@ def parse_text_html(doc, token, cls="", root=True):
return f"{token.value}"
def results(doc, token, cls="", root=True):
if token.value.startswith('file:'):
return "<img%s src=\"%s\"/>\n" % (
cls,
escape(token.value).replace("\n", "<br />"),
)
return "<blockquote%s>%s</blockquote>\n" % (
cls,
escape(token.value).replace("\n", "<br />"),
)
def blockquote(doc, token, cls="", root=True):
return "<blockquote%s>%s</blockquote>\n" % (
cls,
@ -117,7 +130,7 @@ builddoc = {
tokens.TEXT: (parse_text_html, "flow-text"),
tokens.BULLET: (parse_bullets_html, "browser-default"),
tokens.SOURCE: (src, None),
tokens.EXAMPLE: (blockquote, None),
tokens.EXAMPLE: (results, None),
tokens.RESULTS: (blockquote, None),
tokens.TABLE: (table, "responsive-table striped"),
}

View File

@ -13,3 +13,17 @@ def test_bullet_block():
expected = """<ul class="browser-default"><li class="collection-item">Bullet 1</li><li class="collection-item">Bullet 2</li></ul>"""
result = html(parse(snippets.bullet_plus_snippet).doc)
assert result.read() == expected
def test_render_results():
text = StringIO("""
#+RESULTS:
[[file:test.png]]
""")
doc = parse(text).doc
assert doc[0].token == tokens.BLANK
assert doc[1].value == ''
assert doc[1].token == tokens.RESULTS
htmlbody = html(doc).read()
assert htmlbody == '<img class="materialboxed center-align responsive-img" style="margin:auto;" src="file:test.png" alt="" />'