Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_code_yaml(mocker):
"""Test code block rendering with yaml language
"""
mocker.patch.object(lookatme.config, "LOG")
fake_config = mocker.patch.object(lookatme.render.pygments, "config")
fake_config.STYLE = {
"style": "monokai",
}
rendered = render_markdown("""
```yaml
test: a value
test2: "another value"
array:
- item1
- item2
- item3
```""")
assert len(rendered) == 8
def test_headings(mocker):
"""Test basic header rendering
"""
mocker.patch.object(lookatme.config, "LOG")
fake_config = mocker.patch.object(lookatme.render.markdown_block, "config")
fake_config.STYLE = TEST_STYLE
rendered = render_markdown("""
# H1
## H2
### H3
---
""")
# three lines for the headings plus an extra line of padding after each
# and one line of padding before the first one
assert len(rendered) == 7
stripped_rows = [
b"",
def __init__(self, input_stream, theme, style_override=None, live_reload=False):
"""Creates a new Presentation
:param stream input_stream: An input stream from which to read the
slide data
"""
self.input_filename = None
if hasattr(input_stream, "name"):
lookatme.config.SLIDE_SOURCE_DIR = os.path.dirname(input_stream.name)
self.input_filename = input_stream.name
self.style_override = style_override
self.live_reload = live_reload
self.tui = None
self.theme_mod = __import__("lookatme.themes." + theme, fromlist=[theme])
if self.live_reload:
self.reload_thread = threading.Thread(target=self.reload_watcher)
self.reload_thread.daemon = True
self.reload_thread.start()
self.reload(data=input_stream.read())
.. code-block:: yaml
bullets:
'1': "•"
'2': "⁃"
'3': "◦"
default: "•"
See :any:`lookatme.tui.SlideRenderer.do_render` for argument and return
value descriptions.
"""
list_level = _list_level(stack[-1])
pile = urwid.Pile(urwid.SimpleFocusListWalker([]))
bullets = config.STYLE["bullets"]
list_bullet = bullets.get(str(list_level), bullets["default"])
res = urwid.Columns([
(2, urwid.Text(("bold", list_bullet + " "))),
pile,
])
stack.append(pile)
return res