diff --git a/docs/changelog.rst b/docs/changelog.rst index b2a0f33..623405a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,10 @@ Changelog ========= +v0.2.28 +======= + +- Make `content` optional for forename, formatted_initials and title v0.2.27 ======= diff --git a/relaton/__init__.py b/relaton/__init__.py index cfb8bc9..78adfae 100644 --- a/relaton/__init__.py +++ b/relaton/__init__.py @@ -1 +1 @@ -__version__ = '0.2.27' +__version__ = '0.2.28' diff --git a/relaton/models/people.py b/relaton/models/people.py index c06c89a..f984969 100644 --- a/relaton/models/people.py +++ b/relaton/models/people.py @@ -4,16 +4,15 @@ from .contacts import ContactMethod from .orgs import Organization -from .strings import GenericStringValue +from .strings import GenericStringValue, GenericStringValueWithOptionalContent __all__ = ('Forename', 'Person', 'FullName', 'GivenName', 'PersonAffiliation', ) @dataclass -class Forename(GenericStringValue): +class Forename(GenericStringValueWithOptionalContent): """A forename of a person""" - content: Optional[str] = None initial: Optional[str] = None """ An individual initial of the person, corresponding to the given forename. @@ -33,7 +32,7 @@ class GivenName: ]] = None """Also known as given name or first name.""" - formatted_initials: Optional[GenericStringValue] = None + formatted_initials: Optional[GenericStringValueWithOptionalContent] = None """The initials of the person, as a formatted string, including punctuation, dropping punctuation as desired, and including hyphens where necessary. For example, the initial set for Jean-Paul would be J, P; the formatted initials would be "J.-P." diff --git a/relaton/models/strings.py b/relaton/models/strings.py index e8b4d5a..a7a2826 100644 --- a/relaton/models/strings.py +++ b/relaton/models/strings.py @@ -25,7 +25,19 @@ class GenericStringValue(FormattedContent): @dataclass -class Title(GenericStringValue): +class GenericStringValueWithOptionalContent: + """ + Roughly corresponds to a combination + of Relaton’s localized & formatted string. + """ + content: Optional[str] = None + format: Optional[str] = None + script: Optional[Union[str, List[str]]] = None + language: Optional[Union[str, List[str]]] = None + + +@dataclass +class Title(GenericStringValueWithOptionalContent): """ Typed title. """