summaryrefslogtreecommitdiff
path: root/helpers.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2022-07-09 16:17:37 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2022-07-09 16:19:29 +0200
commitd27812adc119d089a348aef326256e2971bb2b89 (patch)
tree5492669ea46678d00d80ace8c5e2cdc0f715e3d3 /helpers.py
parent872109176e64d35d361a73515eddd807a46a7559 (diff)
downloadquatuorbellefeuille.com-d27812adc119d089a348aef326256e2971bb2b89.tar.xz
Add support for overriding thumbnail positioning
Diffstat (limited to 'helpers.py')
-rw-r--r--helpers.py12
1 files changed, 11 insertions, 1 deletions
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<pic_src>[^\n]+)\n',
_optional(r'lien : (?P<pic_link>[^\n]+)\n'),
_optional(r'licence : (?P<pic_license>[^\n]+)\n'),
+ _optional(r'position : (?P<pic_position>[^\n]+)\n'),
_optional(r'AVERTISSEMENT : (?P<warning>[^\n]+)\n'),
)