Add pause images between chapters

This commit is contained in:
Jérôme Petazzoni
2017-11-10 22:48:20 -08:00
parent 4322478a4a
commit e9319060f6
3 changed files with 32 additions and 1 deletions

10
slides/interstitials.txt Normal file
View File

@@ -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

View File

@@ -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)
@@ -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
@@ -56,7 +71,7 @@ class: 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

View File

@@ -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;