+ def assign_ids(self, tree):
+ # Assign IDs depth-first, to account for any <numeracja> inside.
+ for _e, elem in etree.iterwalk(tree, events=('end',)):
+ if getattr(elem, 'NUMBERING', None):
+ elem.assign_id(self)
+
+ def prepare_images(self):
+ # Temporarily use the legacy method, before transitioning to external generators.
+ if self.gallery_path is None:
+ return
+ try:
+ os.makedirs(self.gallery_path)
+ except OSError:
+ pass
+ add_image_sizes(self.document.tree, self.gallery_path, self.gallery_url, self.base_url)
+