From d27812adc119d089a348aef326256e2971bb2b89 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sat, 9 Jul 2022 16:17:37 +0200 Subject: Add support for overriding thumbnail positioning --- helpers.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'helpers.py') diff --git a/helpers.py b/helpers.py index fed585b..ab93699 100644 --- a/helpers.py +++ b/helpers.py @@ -68,6 +68,7 @@ class Illustration: source_name: str source_link: Optional[str] license_info: Optional[LicenseInfo] + position: Optional[str] @classmethod def deserialize(cls, d): @@ -75,7 +76,15 @@ class Illustration: d['pic_alt'], d['pic_src'], d['pic_link'], - LicenseInfo.deserialize(d['pic_license'])) + LicenseInfo.deserialize(d['pic_license']), + d['pic_position']) + + @property + def style(self): + if self.position is None: + return None + + return f'object-position: {self.position}' @dataclass @@ -120,6 +129,7 @@ _CONCERT_LINES = ( r'source : (?P[^\n]+)\n', _optional(r'lien : (?P[^\n]+)\n'), _optional(r'licence : (?P[^\n]+)\n'), + _optional(r'position : (?P[^\n]+)\n'), _optional(r'AVERTISSEMENT : (?P[^\n]+)\n'), ) -- cgit v1.2.3