Organize gallery into highlighted photo groups
This commit is contained in:
@@ -86,9 +86,20 @@ class Publisher:
|
||||
entry = Path("_art") / f"{manifest['date'][:10]}-photo-{job}.md"
|
||||
images = Path("img/arts/uploads") / job
|
||||
(self.repo / entry).parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copyfile(submission / "entry.md", self.repo / entry)
|
||||
entries = submission / "entries"
|
||||
if entries.is_dir():
|
||||
# Remove the former batch document when a queued submission
|
||||
# is republished by a newer service version.
|
||||
self.git("rm", "--ignore-unmatch", "--", str(entry))
|
||||
for source in sorted(entries.glob("*.md")):
|
||||
destination = Path("_art") / f"{manifest['date'][:10]}-photo-{job}-{source.stem}.md"
|
||||
shutil.copyfile(source, self.repo / destination)
|
||||
self.git("add", "--", str(destination))
|
||||
else:
|
||||
shutil.copyfile(submission / "entry.md", self.repo / entry)
|
||||
self.git("add", "--", str(entry))
|
||||
shutil.copytree(submission / "images", self.repo / images, dirs_exist_ok=True)
|
||||
self.git("add", "--", str(entry), str(images))
|
||||
self.git("add", "--", str(images))
|
||||
if self.git("diff", "--cached", "--name-only"):
|
||||
self.git("commit", "-m", f"Publish {len(jobs)} submission(s)")
|
||||
self.git("push", "origin", f"HEAD:refs/heads/{self.branch}")
|
||||
|
||||
Reference in New Issue
Block a user