{% extends wide_base %}

{% block head %}

{% include common/script/load_codemirror.html %}
<script type="text/javascript" src="/static/lib/codemirror/mode/clike/clike.js"></script>

{% end %}

{% block body %}

{% init code = "" %}
{% init output = "" %}
{% init title = "TCC" %}

<div class="card">
  {% include common/title/base_title.html %}
</div>

<div class="card">
  <form method="POST">
    <div class="col-md-12">
      <textarea id="editor" class="col-md-12" rows="20" name="code">{{code}}</textarea>
      <div class="row top-offset-1 bottom-offset-1">
        <button id="run" class="btn">执行</button>
      </div>
      <textarea id="output" class="col-md-12" rows="5" placeholder="程序输出...">{{output}}</textarea>
    </div>
  </form>
</div>

<script>
  $(function () {
    var editor = CodeMirror.fromTextArea($("#editor")[0], {
      lineNumbers: true,
      mode: "text/x-c",
      theme: "monokai",
      indentUnit: 4,
    });
  });
</script>

{% end %}