Commit 18569fa1 authored by nachtgold's avatar nachtgold
Browse files

Documentations module

parent 34a23f65
...@@ -31,7 +31,8 @@ INSTALLED_APPS = [ ...@@ -31,7 +31,8 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'core', 'core',
'highscore' 'highscore',
'docs'
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
...@@ -5,6 +5,7 @@ from django.views.generic import TemplateView ...@@ -5,6 +5,7 @@ from django.views.generic import TemplateView
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from core import views as core_views from core import views as core_views
from highscore import views as highscore_views from highscore import views as highscore_views
from docs import views as docs_views
urlpatterns = [ urlpatterns = [
path('', TemplateView.as_view(template_name='index.html'), name='home'), path('', TemplateView.as_view(template_name='index.html'), name='home'),
...@@ -17,5 +18,6 @@ urlpatterns = [ ...@@ -17,5 +18,6 @@ urlpatterns = [
path('snake/', core_views.snake_list, name='snake'), path('snake/', core_views.snake_list, name='snake'),
path('snake/create', core_views.snake_create, name='snake_create'), path('snake/create', core_views.snake_create, name='snake_create'),
path('snake/<int:snake_id>', core_views.snake_edit, name='snake_edit'), path('snake/<int:snake_id>', core_views.snake_edit, name='snake_edit'),
path('highscore/', highscore_views.table, name='highscore_table') path('highscore/', highscore_views.table, name='highscore_table'),
path('docs/', docs_views.docs, name='docs')
] ]
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<li><a href="{% url 'home' %}">Home</a></li> <li><a href="{% url 'home' %}">Home</a></li>
<li><a href="{% url 'watch' %}">Watch</a></li> <li><a href="{% url 'watch' %}">Watch</a></li>
<li><a href="{% url 'highscore_table' %}">Highscores</a></li> <li><a href="{% url 'highscore_table' %}">Highscores</a></li>
<li><a href="{% url 'docs' %}">Documentation</a></li>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<li><a href="{% url 'snake' %}">My Snakes</a></li> <li><a href="{% url 'snake' %}">My Snakes</a></li>
<li><a href="{% url 'logout' %}">Logout</a></li> <li><a href="{% url 'logout' %}">Logout</a></li>
......
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class DocsConfig(AppConfig):
name = 'docs'
--- Define special sequences of characters.
-- For each pair (find, subs), the function will create a field named with
-- find which has the value of subs.
-- It also creates an index for the table, according to the order of insertion.
-- @param subs The replacement pattern.
-- @param find The pattern to find.
function def_escapes (find, subs)
local special = { t = "\t", n = "\n", ['"'] = '"', ['\\'] = '\\', }
find = gsub (find, "\\(.)", function (x) return %special[x] or x end)
subs = gsub (subs, "\\(.)", function (x) return %special[x] or x end)
escape_sequences.n = escape_sequences.n+1
escape_sequences[escape_sequences.n] = find
escape_sequences[find] = subs
end
\ No newline at end of file
from django.db import models
# Create your models here.
{% extends 'base.html' %}
{% block content %}
<div class="docs-title">Documentation</div>
<div class="editor">function foo(items) {
var x = "All this is syntax highlighted";
return x;
}</div>
<div class="editor">function foo(items) {
var x = "All this is syntax highlighted";
return x;
}</div>
<script src="/static/core/ace/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editors = document.getElementsByClassName("editor");
for(var element of editors) {
console.log(element);
var editor = ace.edit(element);
editor.setTheme("ace/theme/twilight");
editor.session.setMode("ace/mode/lua");
editor.setShowPrintMargin(false);
editor.setReadOnly(true);
}
</script>
{% endblock %}
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
def docs(request):
return render(request, 'docs/docs.html', context={})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment