mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #6474: `DocFieldTransformer
` raises AttributeError
This commit is contained in:
parent
4732ec5edf
commit
ec71c4d14a
2
CHANGES
2
CHANGES
@ -64,6 +64,8 @@ Bugs fixed
|
|||||||
* #6561: glossary: Wrong hyperlinks are generated for non alphanumeric terms
|
* #6561: glossary: Wrong hyperlinks are generated for non alphanumeric terms
|
||||||
* #6620: i18n: classifiers of definition list are not translated with
|
* #6620: i18n: classifiers of definition list are not translated with
|
||||||
docutils-0.15
|
docutils-0.15
|
||||||
|
* #6474: ``DocFieldTransformer`` raises AttributeError when given directive is
|
||||||
|
not a subclass of ObjectDescription
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -218,7 +218,14 @@ class DocFieldTransformer:
|
|||||||
|
|
||||||
def __init__(self, directive: "ObjectDescription") -> None:
|
def __init__(self, directive: "ObjectDescription") -> None:
|
||||||
self.directive = directive
|
self.directive = directive
|
||||||
self.typemap = directive.get_field_type_map()
|
|
||||||
|
try:
|
||||||
|
self.typemap = directive.get_field_type_map()
|
||||||
|
except Exception:
|
||||||
|
# for 3rd party extensions directly calls this transformer.
|
||||||
|
warnings.warn('DocFieldTransformer expects given directive object is a subclass '
|
||||||
|
'of ObjectDescription.', RemovedInSphinx40Warning)
|
||||||
|
self.typemap = self.preprocess_fieldtypes(directive.__class__.doc_field_types)
|
||||||
|
|
||||||
def preprocess_fieldtypes(self, types: List[Field]) -> Dict[str, Tuple[Field, bool]]:
|
def preprocess_fieldtypes(self, types: List[Field]) -> Dict[str, Tuple[Field, bool]]:
|
||||||
warnings.warn('DocFieldTransformer.preprocess_fieldtypes() is deprecated.',
|
warnings.warn('DocFieldTransformer.preprocess_fieldtypes() is deprecated.',
|
||||||
|
Loading…
Reference in New Issue
Block a user