{% extends "templates/base.html" %} {% from "www/macros/sidebar.html" import Sidebar %} {% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %} {% block title %}{{ lesson.title }}{% endblock %} {% block head_include %} {% endblock %} {% block content %} {{ Sidebar(course.name, batch.name) }}
{% if prev_url %} ← Prev {% endif %} {% if next_url %} Next → {% endif %}

{{ lesson.title }}

{% for s in lesson.get_sections() %}
{{ render_section(s) }}
{% endfor %}
{% endblock %} {% macro render_section(s) %} {% if s.type == "text" %} {{ render_section_text(s) }} {% elif s.type == "example" or s.type == "code" or s.type == "exercise" %} {{ LiveCodeEditor(s.name, s.get_latest_code_for_user(), s.type=="exercise", "2 hours ago") }} {% else %}
Unknown section type: {{s.type}}
{% endif %} {% endmacro %} {% macro render_section_text(s) %}
{{ frappe.utils.md_to_html(s.contents) }}
{% endmacro %} {%- block script %} {{ super() }} {{ LiveCodeEditorJS() }} {%- endblock %}