mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
68 lines
2.6 KiB
HTML
68 lines
2.6 KiB
HTML
{% extends "layout.html" %}
|
||
|
||
{% block title %}{{ _input }} {{ title }}{% parent %}{% endblock %}
|
||
{% block description %}{% endblock %}
|
||
{% block robots %}index, follow{% endblock %}
|
||
{% block content %}
|
||
<div class="book {% if _input == "README.md" %}with-summary{% endif %}">
|
||
{% include "includes/book/header.html" %}
|
||
{% include "includes/book/summary.html" %}
|
||
|
||
<div class="book-body">
|
||
<div class="page-wrapper">
|
||
<div class="page-inner">
|
||
{% for section in content %}
|
||
<section class="{{ section.type }}" id="section-{{ section.id }}">
|
||
{% if section.type == "normal" %}
|
||
{% autoescape false %}{{ section.content }}{% endautoescape %}
|
||
{% elif section.type == "exercise" %}
|
||
{% include "./includes/book/exercise.html" with {section: section} %}
|
||
{% endif %}
|
||
</section>
|
||
{% endfor %}
|
||
</div>
|
||
|
||
<div class="page-footer">
|
||
<div class="navigation">
|
||
{% if _input == "README.md" %}
|
||
<a href="{{ basePath }}/{{ navigation.next.path }}" class="navigation-link">Start this book</a>
|
||
{% else %}
|
||
{% if navigation.prev %}
|
||
<a href="{{ basePath }}/{{ navigation.prev.path }}" class="navigation-link prev"><i class="fa fa-chevron-left"></i> <span>{{ navigation.prev.title }}</span></a>
|
||
{% endif %}
|
||
{% if navigation.next %}
|
||
<a href="{{ basePath }}/{{ navigation.next.path }}" class="navigation-link next"><span>{{ navigation.next.title }}</span> <i class="fa fa-chevron-right"></i></a>
|
||
{% endif %}
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
$("section.exercise").each(function() {
|
||
var $exercise = $(this);
|
||
|
||
var codeSolution = $exercise.find(".code-solution").html();
|
||
var codeValidation = $exercise.find(".code-validation").html();
|
||
|
||
var editor = ace.edit($exercise.find(".editor").get(0));
|
||
editor.setTheme("ace/theme/tomorrow");
|
||
editor.getSession().setMode("ace/mode/javascript");
|
||
|
||
$exercise.find(".action-submit").click(function(e) {
|
||
e.preventDefault();
|
||
|
||
alert("submit");
|
||
});
|
||
$exercise.find(".action-solution").click(function(e) {
|
||
e.preventDefault();
|
||
|
||
editor.setValue(codeSolution);
|
||
});
|
||
})
|
||
});
|
||
</script>
|
||
{% endblock %} |