Skip to main content

spec.fold

spec.fold(value)

The folded value of a prose string: stripped, every line break one space.

Each line break (CRLF, a lone CR or LF) with the blanks and tabs around it becomes one space; all other whitespace is kept. U+2028 and U+0085 are no line break for this rule.

Parameters

Name Type Description Default
value str The prose as loaded from TOML. required

Returns

Name Type Description
str str The one-line paragraph.

Raises

Name Type Description
ValueError If the stripped value holds a blank line; a prose field is one paragraph.

Examples

from babregen.spec import fold

print(repr(fold("  Adds  numbers," + chr(10) + "   and sums them. ")))
'Adds  numbers, and sums them.'