Section » elements
elements() → list
Retrieve the elements of this section in sequential order. This seamlessly lets you switch from associative readout to sequential readout, allowing sections within, or the whole document, to represent document-like structures (think generic markup) instead of just associative data stores.
enodate: 2018-03-01
title: My blog post
# page
h1: Hello world
p: This is my first post, I'm so happy!
python>>> document = enopy.parse(input)
>>> metadata = {
... 'date': document.field('date', my_date_loader_function),
... 'title': document.field('title')
... }
>>> html = ''
>>> for element in document.section('page').elements():
... html += f"<{element.name}>{element.value}</{element.name}>"
>>> with open('index.html', 'w') as file:
... file.write(html)
Return value
A list containing the elements of this section.