Skip to content

Commit d88289f

Browse files
committed
fix: handle missing directive
1 parent e5f8986 commit d88289f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lectern/contrib/relative_location.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __call__(
3030
fragment: Fragment,
3131
directives: Mapping[str, Directive],
3232
) -> Fragment:
33-
if isinstance(directives[fragment.directive], NamespacedResourceDirective):
33+
if isinstance(directives.get(fragment.directive), NamespacedResourceDirective):
3434
name = fragment.expect("name")
3535
if ":" not in name:
3636
fragment = replace(fragment, arguments=[self.ctx.generate.path(name)])

lectern/contrib/yaml_to_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def beet_default(ctx: Context):
2929

3030
def handle_yaml(fragment: Fragment, directives: Mapping[str, Directive]) -> Fragment:
3131
"""Loader that converts yaml to json."""
32-
directive = directives[fragment.directive]
32+
directive = directives.get(fragment.directive)
3333
is_yaml = False
3434

3535
if isinstance(directive, NamespacedResourceDirective):

0 commit comments

Comments
 (0)