Euler source The code that runs the solver shell and this site, version 4.34.2 Repository on GitHub

edit_file.html

35 lines of HTML Raw file Open on GitHub

{% extends "base.html" %}
{% block title %}edit {{ filename }} · euler{% endblock %}
{% block content %}
<section class="panel editor editor-fill">
  <div class="editor-head">
    <h1>edit <code>{{ filename }}</code></h1>
    {% if status %}<p class="status {{ 'ok' if ok else 'err' }}">{{ status }}</p>{% endif %}
    {% if diagnostics %}
    <ul class="diagnostics">
      {% for d in diagnostics %}
      <li class="diag-{{ d.severity }}"><code>{{ d.line }}:{{ d.col }}</code>
          <span class="diag-sev">{{ d.severity }}</span> {{ d.message }}</li>
      {% endfor %}
    </ul>
    {% endif %}
  </div>
  {# The buffer always shows what is (or would be) stored: a save echoes the
     gate's canonical content back. Save lives in the Actions menu (and ⌘/Ctrl-S);
     no in-form button. data-cm enhances this into CodeMirror on JS (site.js
     lazy-loads it); with no JS the plain textarea still edits and submits. #}
  {# `action_path` lets the article editor reuse this form; the solution editor leaves it unset
     and keeps its problem-scoped route. #}
  {% set post_to = action_path if action_path else '/edit/solutions/%04d/%s' % (number, filename) %}
  <form class="editor-form"
        hx-post="{{ post_to }}"
        hx-target="#content" hx-swap="innerHTML"
        method="post" action="{{ post_to }}">
    <textarea class="editor-buffer" name="content" data-cm data-language="{{ language }}"
              spellcheck="false" autocomplete="off" autocapitalize="off">{{ text }}</textarea>
  </form>
  <p class="muted editor-hint">Save with <strong>Actions ▸ Save</strong> or
     <kbd>⌘/Ctrl-S</kbd> — every save passes the validation gate (Python auto-fixed
     &amp; flake8-checked, C compiled, JSON re-indented, HTML sanitised).</p>
</section>
{% endblock %}