Add edition links

This commit is contained in:
Jérôme Petazzoni
2017-10-24 12:18:20 +02:00
parent 5c0b83cd1b
commit 68fc895017
2 changed files with 15 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ def processchapter(chapter, filename):
if isinstance(chapter, str):
if "\n" in chapter:
titles = re.findall("^# (.*)", chapter, re.MULTILINE)
slidefooter = ".debug[{}]".format(filename)
slidefooter = ".debug[{}]".format(makelink(filename))
chapter = chapter.replace("\n---\n", "\n{}\n---\n".format(slidefooter))
chapter += "\n" + slidefooter
return (chapter, titles)
@@ -118,4 +118,15 @@ def processchapter(chapter, filename):
raise InvalidChapter(chapter)
def makelink(filename):
if os.path.isfile(filename):
repo = "https://github.com/jpetazzo/orchestration-workshop"
branch = "the-big-2017-refactor"
base = "docs"
url = "{}/tree/{}/{}/{}".format(repo, branch, base, filename)
return "[{}]({})".format(filename, url)
else:
return filename
sys.stdout.write(generatefromyaml(sys.stdin))

View File

@@ -34,6 +34,9 @@ div.remark-slide-number {
font-family: monospace;
color: white;
}
.debug a {
color: white;
}
.debug:hover {
background-color: black;
}