Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions frontmatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@


# global handlers
handlers = {
Handler.FM_BOUNDARY: Handler()
handlers = [
Handler()
for Handler in [YAMLHandler, JSONHandler, TOMLHandler]
if Handler is not None
}
]


def detect_format(text, handlers):
Expand All @@ -32,8 +32,8 @@ def detect_format(text, handlers):
``handlers`` is a dictionary where keys are opening delimiters
and values are handler instances.
"""
for pattern, handler in handlers.items():
if pattern.match(text):
for handler in handlers:
if handler.detect(text):
return handler

# nothing matched, give nothing back
Expand Down