Skip to content

Commit

Permalink
Add pause images between chapters
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetazzo committed Nov 11, 2017
1 parent 4322478 commit e931906
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
10 changes: 10 additions & 0 deletions slides/interstitials.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
https://static.pexels.com/photos/163726/belgium-antwerp-shipping-container-163726.jpeg
https://cdn.pixabay.com/photo/2017/03/12/06/18/container-2136505_1280.jpg
http://www.publicdomainpictures.net/pictures/100000/velka/blue-containers.jpg
https://media.defense.gov/2013/Nov/12/2000897311/-1/-1/0/131108-F-PD986-087.JPG
https://upload.wikimedia.org/wikipedia/commons/4/4d/Locomotive_4700_with_a_container_train_at_Concordancia_de_Poceirao.jpg
https://upload.wikimedia.org/wikipedia/commons/7/7e/ShippingContainerSFBay.jpg
https://upload.wikimedia.org/wikipedia/commons/c/c7/Copper_%26_Kings_Distillery_Shipping_Containers.jpg
https://cdn.pixabay.com/photo/2017/08/01/21/54/container-2568197_1280.jpg
http://s0.geograph.org.uk/geophotos/05/04/71/5047160_cc034d65.jpg
https://c1.staticflickr.com/2/1513/25530579783_57d6dd3d9c_b.jpg
17 changes: 16 additions & 1 deletion slides/markmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ def anchor(title):
return "toc-" + title


def interstitials_generator():
images = [url.strip() for url in open("interstitials.txt") if url.strip()]
while True:
for image in images:
yield image
interstitials = interstitials_generator()


def insertslide(markdown, title):
title_position = markdown.find("\n# {}\n".format(title))
slide_position = markdown.rfind("\n---\n", 0, title_position+1)
Expand All @@ -38,10 +46,17 @@ def insertslide(markdown, title):
currentindex = _titles_.index(title)
previouslink = anchor(_titles_[currentindex-1])
nextlink = anchor(_titles_[currentindex+1])
interstitial = interstitials.next()

extra_slide = """
---
class: pic
.interstitial[![Image separating from the next chapter]({interstitial})]
---
name: {anchor}
class: title
Expand All @@ -56,7 +71,7 @@ def insertslide(markdown, title):
]
.debug[(automatically generated title slide)]
""".format(anchor=anchor(title), title=title, toclink=toclink, previouslink=previouslink, nextlink=nextlink)
""".format(anchor=anchor(title), interstitial=interstitial, title=title, toclink=toclink, previouslink=previouslink, nextlink=nextlink)
after = markdown[slide_position:]
return before + extra_slide + after

Expand Down
6 changes: 6 additions & 0 deletions slides/workshop.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ div.title > p:first-child {
font-size: 300%;
}

div.pic span.interstitial img {
width: 100%;
max-height: unset;
max-width: unset;
}

/* "Normal" images (not on title or pic slides) shouldn't be too big */
div img {
max-width: 1210px;
Expand Down

0 comments on commit e931906

Please sign in to comment.