Section » section

section(name) → Section or None
section(name, options) → Section or None

Retrieve the subsection with the specified name from this current section.

eno# content
title: A Manifest

# notes
python>>> document = enopy.parse(input)

>>> document.section('content')
<class Section name="content" elements=1>
>>> document.section('notes')
<class Section name="notes" elements=0>
>>> document.section('metadata')
ValidationError: ...
>>> document.section('metadata', required=False) 
None
>>> document.section('notes', enforce_element=True) 
<class Section name="notes" elements=0>
>>> document.section('metadata', enforce_element=True)
ValidationError: ...

Parameters

name

A string specifying the name of the section to retrieve.

options

enforce_element

Whether the section must be present in the document (defaults to False)

required

Alias for enforce_element (this exists on many methods and depending on context refers to either element or value)

Return value

An Section, or None.