Compare commits
10 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
e212e38e8a | |
|
|
a6e26ea84f | |
|
|
cf783857ab | |
|
|
dad21c58f5 | |
|
|
a792ac1009 | |
|
|
e216e0a98a | |
|
|
9b61640ba5 | |
|
|
66109c06fd | |
|
|
534bc31d2a | |
|
|
b2ba2897bd |
40
.drone.yml
40
.drone.yml
|
|
@ -9,30 +9,30 @@ steps:
|
||||||
|
|
||||||
# Auto build to pypi test
|
# Auto build to pypi test
|
||||||
- name: deploy-test
|
- name: deploy-test
|
||||||
image: olymk2/drone-pypi
|
image: registry.gitlab.com/olymk2/drone-pypi
|
||||||
|
pull: true
|
||||||
settings:
|
settings:
|
||||||
environment:
|
PYPI_USERNAME:
|
||||||
PYPI_USERNAME:
|
from_secret: PYPI_TEST_USERNAME
|
||||||
from_secret: PYPI_TEST_USERNAME
|
PYPI_PASSWORD:
|
||||||
PYPI_PASSWORD:
|
from_secret: PYPI_TEST_PASSWORD
|
||||||
from_secret: PYPI_TEST_PASSWORD
|
PYPI_REPOSITORY:
|
||||||
PYPI_REPOSITORY:
|
from_secret: PYPI_TEST_REPOSITORY
|
||||||
from_secret: PYPI_TEST_REPOSITORY
|
commands:
|
||||||
commands:
|
- env
|
||||||
- env
|
- echo "__version__=$(date +'%y%m%d.%H%M')" > ./eorg/version.py
|
||||||
- echo "__version__=$(date +'%y%m%d.%H%M')" > elcato/version.py
|
- python3 /bin/upload
|
||||||
|
|
||||||
|
|
||||||
- name: deploy
|
- name: deploy
|
||||||
image: olymk2/drone-pypi
|
image: registry.gitlab.com/olymk2/drone-pypi
|
||||||
|
pull: true
|
||||||
settings:
|
settings:
|
||||||
environment:
|
PYPI_USERNAME:
|
||||||
PYPI_USERNAME:
|
from_secret: PYPI_LIVE_USERNAME
|
||||||
from_secret: PYPI_LIVE_USERNAME
|
PYPI_PASSWORD:
|
||||||
PYPI_PASSWORD:
|
from_secret: PYPI_LIVE_PASSWORD
|
||||||
from_secret: PYPI_LIVE_PASSWORD
|
PYPI_REPOSITORY:
|
||||||
PYPI_REPOSITORY:
|
from_secret: PYPI_LIVE_REPOSITORY
|
||||||
from_secret: PYPI_LIVE_REPOSITORY
|
|
||||||
commands:
|
commands:
|
||||||
- env
|
- env
|
||||||
- echo "__version__=${DRONE_TAG}"
|
- echo "__version__=${DRONE_TAG}"
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ t_NAME = r"^\#\+NAME:"
|
||||||
# t_IMG = r"^\[\[(\w|\.|-|_|/)+\]\]$"
|
# t_IMG = r"^\[\[(\w|\.|-|_|/)+\]\]$"
|
||||||
t_IMG = r"^\[\["
|
t_IMG = r"^\[\["
|
||||||
t_IMG_END = r"\]\]"
|
t_IMG_END = r"\]\]"
|
||||||
t_RESULTS_END = r"^\:..*"
|
t_RESULTS_END = r"^\s*$"
|
||||||
t_END_LABELS = r"^(?!\[|\#).*"
|
t_END_LABELS = r"^(?!\[|\#).*"
|
||||||
t_BULLET_START = r"^\s*[\+|\-|0-9\.]"
|
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_HEADER = r"^\*+"
|
||||||
t_META_OTHER = r"^[#]\+[A-Z\_]+\:"
|
t_META_OTHER = r"^[#]\+[A-Z\_]+\:"
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,9 @@ def handle_token(doc, item, root=False):
|
||||||
|
|
||||||
def html(doc):
|
def html(doc):
|
||||||
response = StringIO()
|
response = StringIO()
|
||||||
|
response.write('<div class="org-body">')
|
||||||
for item in doc:
|
for item in doc:
|
||||||
response.write(handle_token(doc, item, True))
|
response.write(handle_token(doc, item, True))
|
||||||
|
response.write('</div>')
|
||||||
response.seek(0)
|
response.seek(0)
|
||||||
return response
|
return response
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
__version__=0.83
|
__version__=0.85
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,17 @@ def test_block_settings():
|
||||||
assert result[1].value == expected[1].value
|
assert result[1].value == expected[1].value
|
||||||
assert result[1].attrs == expected[1].attrs
|
assert result[1].attrs == expected[1].attrs
|
||||||
#assert result == expected
|
#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']
|
||||||
|
|
|
||||||
|
|
@ -201,10 +201,28 @@ def test_bullet_block():
|
||||||
assert result[1].token == tokens.BULLET
|
assert result[1].token == tokens.BULLET
|
||||||
assert result[1].value == expected[1].value
|
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
|
@pytest.mark.skip
|
||||||
def test_src_block_images():
|
def test_src_block_images():
|
||||||
text = StringIO("""
|
text = StringIO(
|
||||||
|
"""
|
||||||
#+BEGIN_SRC latex :exports results :file test.png :results raw file
|
#+BEGIN_SRC latex :exports results :file test.png :results raw file
|
||||||
\begin{equation}
|
\begin{equation}
|
||||||
x=\sqrt{b}
|
x=\sqrt{b}
|
||||||
|
|
@ -213,12 +231,14 @@ x=\sqrt{b}
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
[[file:test.png]]
|
[[file:test.png]]
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
expected = [
|
expected = [
|
||||||
Token(tokens.BLANK, ""),
|
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, ""),
|
Token(tokens.BLANK, ""),
|
||||||
|
|
||||||
]
|
]
|
||||||
result = parse(text).doc
|
result = parse(text).doc
|
||||||
assert result[0].token == tokens.BLANK
|
assert result[0].token == tokens.BLANK
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ def test_html_output():
|
||||||
print(htmlbody)
|
print(htmlbody)
|
||||||
assert (
|
assert (
|
||||||
htmlbody
|
htmlbody
|
||||||
== """<h2> Header 1</h2>
|
== """<div class="org-body"><h2> Header 1</h2>
|
||||||
<h3> Sub Header 1</h3>
|
<h3> Sub Header 1</h3>
|
||||||
<p class="flow-text">body <code>text</code>
|
<p class="flow-text">body <code>text</code>
|
||||||
over multiple <b>lines</b>
|
over multiple <b>lines</b>
|
||||||
|
|
@ -34,5 +34,5 @@ def test_html_output():
|
||||||
</pre></div>
|
</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>
|
</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>
|
</pre></div>
|
||||||
</td></tr></table>"""
|
</td></tr></table></div>"""
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from eorg.generate import html
|
||||||
|
|
||||||
|
|
||||||
def test_bullet_block():
|
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)
|
result = html(parse(snippets.bullet_plus_snippet).doc)
|
||||||
assert result.read() == expected
|
assert result.read() == expected
|
||||||
|
|
||||||
|
|
@ -33,4 +33,4 @@ def test_render_results():
|
||||||
assert tags[1].value[1].value == expected[1].value
|
assert tags[1].value[1].value == expected[1].value
|
||||||
|
|
||||||
htmlbody = html(tags).read()
|
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>'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue