Skip to content

Commit

Permalink
fix: handle missing directive
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Oct 9, 2023
1 parent e5f8986 commit d88289f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lectern/contrib/relative_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __call__(
fragment: Fragment,
directives: Mapping[str, Directive],
) -> Fragment:
if isinstance(directives[fragment.directive], NamespacedResourceDirective):
if isinstance(directives.get(fragment.directive), NamespacedResourceDirective):
name = fragment.expect("name")
if ":" not in name:
fragment = replace(fragment, arguments=[self.ctx.generate.path(name)])
Expand Down
2 changes: 1 addition & 1 deletion lectern/contrib/yaml_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def beet_default(ctx: Context):

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

if isinstance(directive, NamespacedResourceDirective):
Expand Down

0 comments on commit d88289f

Please sign in to comment.