From: Radek Czajka Date: Fri, 8 Jul 2022 09:41:07 +0000 (+0200) Subject: Fixes X-Git-Tag: 2.4.5 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/eb6b8e8e497922011e8a89f1e1869d68ef8f7066?ds=sidebyside Fixes --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 3045ea4..56ccb9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ This document records all notable changes to Librarian. +## 2.4.5 (2022-07-08) + +# Fixed +- Bug in reading picture XML. +- Bug in setting WLURI.slug + + ## 2.4.4 (2022-07-07) ### Fixed diff --git a/setup.py b/setup.py index 98e2298..7056674 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def whole_tree(prefix, path): setup( name='librarian', - version='2.4.4', + version='2.4.5', description='Converter from WolneLektury.pl XML-based language to XHTML, TXT and other formats', author="Marek Stępniowski", author_email='marek@stepniowski.com', diff --git a/src/librarian/meta/types/wluri.py b/src/librarian/meta/types/wluri.py index 45bf23c..92c6017 100644 --- a/src/librarian/meta/types/wluri.py +++ b/src/librarian/meta/types/wluri.py @@ -4,8 +4,6 @@ from .base import MetaValue class WLURI(MetaValue): """Represents a WL URI. Extracts slug from it.""" - slug = None - example = 'http://wolnelektury.pl/katalog/lektura/template/' _re_wl_uri = re.compile( r'http://(www\.)?wolnelektury.pl/katalog/lektur[ay]/' @@ -23,8 +21,7 @@ class WLURI(MetaValue): uri = 'http://wolnelektury.pl/katalog/lektura/%s/' % slug self.uri = uri return super().__init__(slug) - - + @classmethod def from_text(cls, uri): slug = uri.rstrip('/').rsplit('/', 1)[-1] @@ -35,10 +32,13 @@ class WLURI(MetaValue): if not match: raise ValidationError('Invalid URI (%s). Should match: %s' % ( self.uri, self._re_wl_uri.pattern)) - return cls(uri) def __str__(self): return self.uri def __eq__(self, other): - return self.slug == other.slug + return self.value == other.value + + @property + def slug(self): + return self.value diff --git a/src/librarian/picture.py b/src/librarian/picture.py index 93d8cb9..3897d1a 100644 --- a/src/librarian/picture.py +++ b/src/librarian/picture.py @@ -230,7 +230,7 @@ class WLPicture(object): clip = self.get_sem_coords(k) self.frame = clip frm = Element("sem", {"type": "frame"}) - frm.append(k.iter("div").next()) + frm.append(next(k.iter("div"))) self.edoc.getroot().append(frm) k.getparent().remove(k) else: