{% 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, batch) }}
{{ pagination(prev_url, next_url) }}

{{ lesson.title }}

{% for s in lesson.get_sections() %}
{{ render_section(s) }}
{% endfor %} {{ pagination(prev_url, next_url) }}
{% endblock %} {% macro render_section(s) %} {% if s.type == "text" %} {{ render_section_text(s) }} {% elif s.type == "example" or s.type == "code" %} {{ LiveCodeEditor(s.name, code=s.get_latest_code_for_user(), reset_code=s.contents, is_exercise=False) }} {% elif s.type == "exercise" %} {{ widgets.Exercise(exercise=s.get_exercise())}} {% else %}
Unknown section type: {{s.type}}
{% endif %} {% endmacro %} {% macro render_section_text(s) %}
{{ frappe.utils.md_to_html(s.contents) }}
{% endmacro %} {% macro pagination(prev_url, next_url) %}
{% if prev_url %} ← Prev {% endif %} {% if next_url %} Next → {% endif %}
{% endmacro %} {%- block script %} {{ super() }} {{ LiveCodeEditorJS() }} {%- endblock %}