Skip to content
Snippets Groups Projects
Commit 908fff1f authored by Raniere Silva's avatar Raniere Silva Committed by GitHub
Browse files

Merge pull request #149 from rgaiacs/styles-print

Add all in one lesson build with Javascript
parents 6951d40b 3474a5ff
Branches
Tags
No related merge requests found
......@@ -14,7 +14,6 @@
<div class="col-md-10">
{% if include.episode_navbar_title %}
<h3 class="maintitle"><a href="{{ page.root }}/">{{ site.title }}</a></h3>
<h1 class="maintitle">{{ page.title }}</h1>
{% endif %}
</div>
<div class="col-md-1">
......
{% comment %}
Find previous and next episodes (if any).
{% endcomment %}
{% for episode in site.episodes %}
{% if episode.url == page.url %}
{% unless forloop.first %}
{% assign prev_episode = prev %}
{% endunless %}
{% unless forloop.last %}
{% assign next_episode = site.episodes[forloop.index] %}
{% endunless %}
{% endif %}
{% assign prev = episode %}
{% endfor %}
{% comment %}
Display title and prev/next links.
{% endcomment %}
<div class="row">
<div class="col-md-1">
<h3>
{% if prev_episode %}
<a href="{{ page.root }}{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>
{% else %}
<a href="{{ page.root }}"><span class="glyphicon glyphicon-menu-up"></span></a>
{% endif %}
</h3>
</div>
<div class="col-md-10">
<h3 class="maintitle"><a href="{{ page.root }}/">{{ site.title }}</a></h3>
<h1 class="maintitle">{{ page.title }}</h1>
</div>
<div class="col-md-1">
<h3>
{% if next_episode %}
<a href="{{ page.root }}{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right"></span></a>
{% else %}
<a href="{{ page.root }}"><span class="glyphicon glyphicon-menu-up"></span></a>
{% endif %}
</h3>
</div>
</div>
......@@ -45,6 +45,8 @@
{% for episode in site.episodes %}
<li><a href="{{ page.root }}{{ episode.url }}">{{ episode.title }}</a></li>
{% endfor %}
<li role="separator" class="divider"></li>
<li><a href="{{ page.root }}/aio/">All in one page (Beta)</a></li>
</ul>
</li>
{% endif %}
......
......@@ -2,6 +2,9 @@
layout: base
---
{% include episode_navbar.html episode_navbar_title=true %}
<article>
{% include episode_title.html %}
{% include episode_break.html %}
{{content}}
</article>
{% include episode_navbar.html episode_navbar_title=false %}
......@@ -2,7 +2,10 @@
layout: base
---
{% include episode_navbar.html episode_navbar_title=true %}
<article>
{% include episode_title.html %}
{% include episode_overview.html %}
{{content}}
{% include episode_keypoints.html %}
</article>
{% include episode_navbar.html episode_navbar_title=false %}
......@@ -278,6 +278,45 @@ permalink: /setup/
FIXME
'''
ROOT_SETUP_MD = '''\
---
layout: page
permalink: /aio/
---
<script>
window.onload = function() {
var lesson_episodes = [
{% for episode in site.episodes %}
"{{ episode.url}}"{% unless forloop.last %},{% endunless %}
{% endfor %}
];
var xmlHttp = []; /* Required since we are going to query every episode. */
for (i=0; i < lesson_episodes.length; i++) {
xmlHttp[i] = new XMLHttpRequest();
xmlHttp[i].episode = lesson_episodes[i]; /* To enable use this later. */
xmlHttp[i].onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var article_here = document.getElementById(this.episode);
var parser = new DOMParser();
var htmlDoc = parser.parseFromString(this.responseText,"text/html");
var htmlDocArticle = htmlDoc.getElementsByTagName("article")[0];
article_here.innerHTML = htmlDocArticle.innerHTML;
}
}
episode_url = "{{ page.root }}" + lesson_episodes[i];
xmlHttp[i].open("GET", episode_url);
xmlHttp[i].send(null);
}
}
</script>
{% comment %}
Create anchor for each one of the episodes.
{% endcomment %}
{% for episode in site.episodes %}
<article id="{{ episode.url }}"></article>
{% endfor %}
'''
EPISODES_INTRODUCTION_MD = '''\
---
title: "Introduction"
......@@ -340,6 +379,7 @@ BOILERPLATE = (
('index.md', ROOT_INDEX_MD),
('reference.md', ROOT_REFERENCE_MD),
('setup.md', ROOT_SETUP_MD),
('aio.md', ROOT_AIO_MD),
('_episodes/01-introduction.md', EPISODES_INTRODUCTION_MD),
('_extras/about.md', EXTRAS_ABOUT_MD),
('_extras/discuss.md', EXTRAS_DISCUSS_MD),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment