diff --git a/slides/hivemq.yml b/slides/hivemq.yml index 8b233e29..c25cddd0 100644 --- a/slides/hivemq.yml +++ b/slides/hivemq.yml @@ -3,8 +3,9 @@ title: | & Kubernetes -chat: "[Slack](https://dockercommunity.slack.com/messages/C7GKACWDV)" +#chat: "[Slack](https://dockercommunity.slack.com/messages/C7GKACWDV)" #chat: "[Gitter](https://gitter.im/jpetazzo/workshop-yyyymmdd-city)" +chat: FIXME gitrepo: github.com/jpetazzo/container.training @@ -15,7 +16,7 @@ slides: http://container.training/ exclude: - self-paced -chapters: +content: - shared/title.md - logistics.md - containers/intro.md diff --git a/slides/intro-fullday.yml b/slides/intro-fullday.yml index 1859feac..ba8b8cba 100644 --- a/slides/intro-fullday.yml +++ b/slides/intro-fullday.yml @@ -14,7 +14,7 @@ slides: http://container.training/ exclude: - self-paced -chapters: +content: - shared/title.md - logistics.md - containers/intro.md diff --git a/slides/intro-selfpaced.yml b/slides/intro-selfpaced.yml index cd97afce..12316bf9 100644 --- a/slides/intro-selfpaced.yml +++ b/slides/intro-selfpaced.yml @@ -14,7 +14,7 @@ slides: http://container.training/ exclude: - in-person -chapters: +content: - shared/title.md # - shared/logistics.md - containers/intro.md diff --git a/slides/intro-twodays.yml b/slides/intro-twodays.yml index ddd66f60..ecebcdb1 100644 --- a/slides/intro-twodays.yml +++ b/slides/intro-twodays.yml @@ -14,7 +14,7 @@ slides: http://container.training/ exclude: - self-paced -chapters: +content: - shared/title.md - logistics.md - containers/intro.md diff --git a/slides/logistics-online.md b/slides/logistics-online.md new file mode 100644 index 00000000..301abd39 --- /dev/null +++ b/slides/logistics-online.md @@ -0,0 +1,21 @@ +## Intros + +- Hello! We are: + + - .emoji[πŸ‘·πŸ»β€β™€οΈ] AJ ([@s0ulshake], [EphemeraSearch]) + + - .emoji[🐳] JΓ©rΓ΄me ([@jpetazzo], Enix SAS) + +- The training will run for 4 hours, with a 10 minutes break every hour + + (the middle break will be a bit longer) + +- Feel free to ask questions at any time + +- *Especially when you see full screen container pictures!* + +- Live feedback, questions, help: @@CHAT@@ + +[EphemeraSearch]: https://ephemerasearch.com/ +[@s0ulshake]: https://twitter.com/s0ulshake +[@jpetazzo]: https://twitter.com/jpetazzo \ No newline at end of file diff --git a/slides/logistics-template.md b/slides/logistics-template.md new file mode 100644 index 00000000..33388a06 --- /dev/null +++ b/slides/logistics-template.md @@ -0,0 +1,35 @@ +## Intros + +- This slide should be customized by the tutorial instructor(s). + +- Hello! We are: + + - .emoji[πŸ‘©πŸ»β€πŸ«] Ann O'Nymous ([@...](https://twitter.com/...), Megacorp Inc) + + - .emoji[πŸ‘¨πŸΎβ€πŸŽ“] Stu Dent ([@...](https://twitter.com/...), University of Wakanda) + + + +- The workshop will run from ... + +- There will be a lunch break at ... + + (And coffee breaks!) + +- Feel free to interrupt for questions at any time + +- *Especially when you see full screen container pictures!* + +- Live feedback, questions, help: @@CHAT@@ diff --git a/slides/logistics.md b/slides/logistics.md deleted file mode 100644 index 33388a06..00000000 --- a/slides/logistics.md +++ /dev/null @@ -1,35 +0,0 @@ -## Intros - -- This slide should be customized by the tutorial instructor(s). - -- Hello! We are: - - - .emoji[πŸ‘©πŸ»β€πŸ«] Ann O'Nymous ([@...](https://twitter.com/...), Megacorp Inc) - - - .emoji[πŸ‘¨πŸΎβ€πŸŽ“] Stu Dent ([@...](https://twitter.com/...), University of Wakanda) - - - -- The workshop will run from ... - -- There will be a lunch break at ... - - (And coffee breaks!) - -- Feel free to interrupt for questions at any time - -- *Especially when you see full screen container pictures!* - -- Live feedback, questions, help: @@CHAT@@ diff --git a/slides/logistics.md b/slides/logistics.md new file mode 120000 index 00000000..2780e3c0 --- /dev/null +++ b/slides/logistics.md @@ -0,0 +1 @@ +logistics-template.md \ No newline at end of file diff --git a/slides/markmaker.py b/slides/markmaker.py index 07e78062..5e2b20ca 100755 --- a/slides/markmaker.py +++ b/slides/markmaker.py @@ -42,7 +42,7 @@ def insertslide(markdown, title): before = markdown[:slide_position] - toclink = "toc-chapter-{}".format(title2path[title][0]) + toclink = "toc-module-{}".format(title2path[title][0]) _titles_ = [""] + all_titles + [""] currentindex = _titles_.index(title) previouslink = anchor(_titles_[currentindex-1]) @@ -54,7 +54,7 @@ def insertslide(markdown, title): class: pic -.interstitial[![Image separating from the next chapter]({interstitial})] +.interstitial[![Image separating from the next module]({interstitial})] --- @@ -98,7 +98,7 @@ def generatefromyaml(manifest, filename): if "html" not in manifest: manifest["html"] = filename + ".html" - markdown, titles = processchapter(manifest["chapters"], filename) + markdown, titles = processcontent(manifest["content"], filename) logging.debug("Found {} titles.".format(len(titles))) toc = gentoc(titles) markdown = markdown.replace("@@TOC@@", toc) @@ -134,9 +134,8 @@ def generatefromyaml(manifest, filename): # Maps a section title (the string just after "^# ") to its position -# in the table of content (as a (chapter,part,subpart,...) tuple). +# in the table of content (as a (module,part,subpart,...) tuple). title2path = {} -path2title = {} all_titles = [] # "tree" is a list of titles, potentially nested. @@ -144,50 +143,60 @@ def gentoc(tree, path=()): if not tree: return "" if isinstance(tree, str): + logging.debug("Path {} Title {}".format(path, tree)) title = tree title2path[title] = path - path2title[path] = title all_titles.append(title) - logging.debug("Path {} Title {}".format(path, title)) return "- [{}](#{})".format(title, anchor(title)) if isinstance(tree, list): + # If there is only one sub-element, give it index zero. + # Otherwise, elements will have indices 1-to-N. + offset = 0 if len(tree) == 1 else 1 + logging.debug( + "Path {} Tree [...({} sub-elements)]" + .format(path, len(tree))) if len(path) == 0: - return "\n---\n".join(gentoc(subtree, path+(i+1,)) for (i,subtree) in enumerate(tree)) + return "\n---\n".join(gentoc(subtree, path+(i+offset,)) for (i,subtree) in enumerate(tree)) elif len(path) == 1: - chapterslide = "name: toc-chapter-{n}\n\n## Chapter {n}\n\n".format(n=path[0]) + # If there is only one module, don't show "Module 1" but just "TOC" + if path[0] == 0: + label = "Table of contents" + else: + label = "Module {}".format(path[0]) + moduleslide = "name: toc-module-{n}\n\n## {label}\n\n".format(n=path[0], label=label) for (i,subtree) in enumerate(tree): - chapterslide += gentoc(subtree, path+(i+1,)) + "\n\n" - chapterslide += ".debug[(auto-generated TOC)]" - return chapterslide + moduleslide += gentoc(subtree, path+(i+offset,)) + "\n\n" + moduleslide += ".debug[(auto-generated TOC)]" + return moduleslide else: - return "\n\n".join(gentoc(subtree, path+(i+1,)) for (i,subtree) in enumerate(tree)) + return "\n\n".join(gentoc(subtree, path+(i+offset,)) for (i,subtree) in enumerate(tree)) # Arguments: -# - `chapter` is a string; if it has multiple lines, it will be used as +# - `content` is a string; if it has multiple lines, it will be used as # a markdown fragment; otherwise it will be considered as a file name # to be recursively loaded and parsed # - `filename` is the name of the file that we're currently processing # (to generate inline comments to facilitate edition) # Returns: (epxandedmarkdown,[list of titles]) # The list of titles can be nested. -def processchapter(chapter, filename): - if isinstance(chapter, str): - if "\n" in chapter: - titles = re.findall("^# (.*)", chapter, re.MULTILINE) +def processcontent(content, filename): + if isinstance(content, str): + if "\n" in content: + titles = re.findall("^# (.*)", content, re.MULTILINE) slidefooter = ".debug[{}]".format(makelink(filename)) - chapter = chapter.replace("\n---\n", "\n{}\n---\n".format(slidefooter)) - chapter += "\n" + slidefooter - return (chapter, titles) - if os.path.isfile(chapter): - return processchapter(open(chapter).read(), chapter) - if isinstance(chapter, list): - chapters = [processchapter(c, filename) for c in chapter] - markdown = "\n---\n".join(c[0] for c in chapters) - titles = [t for (m,t) in chapters if t] + content = content.replace("\n---\n", "\n{}\n---\n".format(slidefooter)) + content += "\n" + slidefooter + return (content, titles) + if os.path.isfile(content): + return processcontent(open(content).read(), content) + if isinstance(content, list): + subparts = [processcontent(c, filename) for c in content] + markdown = "\n---\n".join(c[0] for c in subparts) + titles = [t for (m,t) in subparts if t] return (markdown, titles) - logging.warning("Invalid chapter: {}".format(chapter)) - return "```\nInvalid chapter: {}\n```\n".format(chapter), [] + logging.warning("Invalid content: {}".format(content)) + return "```\nInvalid content: {}\n```\n".format(content), [] # Try to figure out the URL of the repo on GitHub. # This is used to generate "edit me on GitHub"-style links.