Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param str input_data: The input data string
:returns: tuple of (remaining_data, slide)
"""
# slides are delimited by ---
md = mistune.Markdown()
state = {}
tokens = md.block.parse(input_data, state)
slides = []
curr_slide_tokens = []
for token in tokens:
# new slide!
if token["type"] == "hrule":
slide = Slide(curr_slide_tokens, md, len(slides))
slides.append(slide)
curr_slide_tokens = []
continue
else:
curr_slide_tokens.append(token)
slides.append(Slide(curr_slide_tokens, md, len(slides)))
return "", slides
state = {}
tokens = md.block.parse(input_data, state)
slides = []
curr_slide_tokens = []
for token in tokens:
# new slide!
if token["type"] == "hrule":
slide = Slide(curr_slide_tokens, md, len(slides))
slides.append(slide)
curr_slide_tokens = []
continue
else:
curr_slide_tokens.append(token)
slides.append(Slide(curr_slide_tokens, md, len(slides)))
return "", slides