diff --git a/lectern/contrib/relative_location.py b/lectern/contrib/relative_location.py index f606b94..28f6bc5 100644 --- a/lectern/contrib/relative_location.py +++ b/lectern/contrib/relative_location.py @@ -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)]) diff --git a/lectern/contrib/yaml_to_json.py b/lectern/contrib/yaml_to_json.py index 5a82ccb..ad4573b 100644 --- a/lectern/contrib/yaml_to_json.py +++ b/lectern/contrib/yaml_to_json.py @@ -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):