From 4dc58e6e14702989f7419d6bfc4ca589898f2e56 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Mon, 8 Apr 2019 14:05:50 +0100 Subject: Remove wiki host, use /wiki - Also some wiki config I've included the monokai pygments theme, but we can change it later --- .dockerignore | 2 - Pipfile | 1 + Pipfile.lock | 10 ++++- pydis_site/apps/home/urls.py | 7 +-- pydis_site/apps/wiki_container/__init__.py | 0 pydis_site/apps/wiki_container/apps.py | 6 --- pydis_site/apps/wiki_container/urls.py | 6 --- pydis_site/hosts.py | 3 +- pydis_site/settings.py | 29 ++++++++++++- pydis_site/static/css/pygments.css | 70 ++++++++++++++++++++++++++++++ 10 files changed, 113 insertions(+), 21 deletions(-) delete mode 100644 pydis_site/apps/wiki_container/__init__.py delete mode 100644 pydis_site/apps/wiki_container/apps.py delete mode 100644 pydis_site/apps/wiki_container/urls.py create mode 100644 pydis_site/static/css/pygments.css diff --git a/.dockerignore b/.dockerignore index ca6ba308..4ad7c8a7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -31,5 +31,3 @@ README.md scripts Vagrantfile venv -pydis_site/apps/wiki/tests -pydis_site/apps/wiki/tests.py diff --git a/Pipfile b/Pipfile index 1fd34c35..c6f210ab 100644 --- a/Pipfile +++ b/Pipfile @@ -28,6 +28,7 @@ psycopg2-binary = "~=2.8" django-simple-bulma = ">=1.1.6,<2.0" django-crispy-bulma = ">=0.1.2,<2.0" wiki = "~=0.4.4" +pygments = "~=2.3.1" [requires] python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock index a908b8c7..777dbd38 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "a63ccdec81594bd69f4af503e5a62fe01a74adfd6daaaa0fb9be08b25631cb84" + "sha256": "d6bbf11476ca021d14ef03475ef6154b148d75a3ceada522194a56e80a27ccf1" }, "pipfile-spec": 6, "requires": { @@ -229,6 +229,14 @@ "index": "pypi", "version": "==2.8.1" }, + "pygments": { + "hashes": [ + "sha256:5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a", + "sha256:e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d" + ], + "index": "pypi", + "version": "==2.3.1" + }, "pytz": { "hashes": [ "sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", diff --git a/pydis_site/apps/home/urls.py b/pydis_site/apps/home/urls.py index a01e019e..ede0531e 100644 --- a/pydis_site/apps/home/urls.py +++ b/pydis_site/apps/home/urls.py @@ -1,10 +1,11 @@ from django.contrib import admin -from django.urls import path +from django.urls import path, include from django.views.generic import TemplateView app_name = 'home' urlpatterns = [ - path('', TemplateView.as_view(template_name='home/index.html'), name='index'), - path('admin/', admin.site.urls) + path('admin/', admin.site.urls), + path('wiki/', include('wiki.urls')), + path('/', TemplateView.as_view(template_name='home/index.html'), name='index'), ] diff --git a/pydis_site/apps/wiki_container/__init__.py b/pydis_site/apps/wiki_container/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pydis_site/apps/wiki_container/apps.py b/pydis_site/apps/wiki_container/apps.py deleted file mode 100644 index 874ae8e4..00000000 --- a/pydis_site/apps/wiki_container/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from wiki.apps import WikiConfig - - -class WikiContainerConfig(WikiConfig): - name = 'wiki_container' - default_site = 'pydis_site.sites.PyDisWikiSite' diff --git a/pydis_site/apps/wiki_container/urls.py b/pydis_site/apps/wiki_container/urls.py deleted file mode 100644 index 1537fe8c..00000000 --- a/pydis_site/apps/wiki_container/urls.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.urls import path, include - -urlpatterns = [ - path('notifications/', include('django_nyt.urls')), - path('', include('wiki.urls')) -] diff --git a/pydis_site/hosts.py b/pydis_site/hosts.py index fc43d0eb..25220ee0 100644 --- a/pydis_site/hosts.py +++ b/pydis_site/hosts.py @@ -3,8 +3,7 @@ from django_hosts import host, patterns host_patterns = patterns( '', - # host(r"subdomain pattern", "URLs module", "host entry name") - host(r'wiki', 'pydis_site.apps.wiki_container.urls', name="wiki"), + # host(r"subdomain pattern", "URLs module", "host entry name"), host(r'admin', 'pydis_site.apps.admin.urls', name="admin"), host(r'api', 'pydis_site.apps.api.urls', name='api'), host(r'.*', 'pydis_site.apps.home.urls', name=settings.DEFAULT_HOST) diff --git a/pydis_site/settings.py b/pydis_site/settings.py index 2212da21..e55b3132 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -64,7 +64,6 @@ else: INSTALLED_APPS = [ 'pydis_site.apps.api', 'pydis_site.apps.home', - 'pydis_site.apps.wiki_container', 'django.contrib.admin', 'django.contrib.auth', @@ -277,3 +276,31 @@ SITE_ID = 1 WIKI_ACCOUNT_HANDLING = False WIKI_ACCOUNT_SIGNUP_ALLOWED = False + +WIKI_ANONYMOUS = True +WIKI_ANONYMOUS_CREATE = DEBUG +WIKI_ANONYMOUS_UPLOAD = DEBUG +WIKI_ANONYMOUS_WRITE = DEBUG + +WIKI_MARKDOWN_KWARGS = { + "extension_configs": { + "wiki.plugins.macros.mdx.toc": { + "title": "Contents" + } + }, "extensions": [ + "markdown.extensions.abbr", + "markdown.extensions.attr_list", + "markdown.extensions.extra", + "markdown.extensions.fenced_code", + "markdown.extensions.footnotes", + "markdown.extensions.nl2br", + "markdown.extensions.sane_lists", + + "wiki.core.markdown.mdx.codehilite", + "wiki.core.markdown.mdx.previewlinks", + "wiki.core.markdown.mdx.responsivetable", + "wiki.plugins.macros.mdx.macro", + "wiki.plugins.macros.mdx.toc", + "wiki.plugins.macros.mdx.wikilinks", + ] +} diff --git a/pydis_site/static/css/pygments.css b/pydis_site/static/css/pygments.css new file mode 100644 index 00000000..d2e9fc72 --- /dev/null +++ b/pydis_site/static/css/pygments.css @@ -0,0 +1,70 @@ +.codehilite .hll { background-color: #49483e } +.codehilite { background: #272822; color: #f8f8f2 } +.codehilite .c { color: #75715e } /* Comment */ +.codehilite .err { color: #960050; background-color: #1e0010 } /* Error */ +.codehilite .k { color: #66d9ef } /* Keyword */ +.codehilite .l { color: #ae81ff } /* Literal */ +.codehilite .n { color: #f8f8f2 } /* Name */ +.codehilite .o { color: #f92672 } /* Operator */ +.codehilite .p { color: #f8f8f2 } /* Punctuation */ +.codehilite .ch { color: #75715e } /* Comment.Hashbang */ +.codehilite .cm { color: #75715e } /* Comment.Multiline */ +.codehilite .cp { color: #75715e } /* Comment.Preproc */ +.codehilite .cpf { color: #75715e } /* Comment.PreprocFile */ +.codehilite .c1 { color: #75715e } /* Comment.Single */ +.codehilite .cs { color: #75715e } /* Comment.Special */ +.codehilite .gd { color: #f92672 } /* Generic.Deleted */ +.codehilite .ge { font-style: italic } /* Generic.Emph */ +.codehilite .gi { color: #a6e22e } /* Generic.Inserted */ +.codehilite .gs { font-weight: bold } /* Generic.Strong */ +.codehilite .gu { color: #75715e } /* Generic.Subheading */ +.codehilite .kc { color: #66d9ef } /* Keyword.Constant */ +.codehilite .kd { color: #66d9ef } /* Keyword.Declaration */ +.codehilite .kn { color: #f92672 } /* Keyword.Namespace */ +.codehilite .kp { color: #66d9ef } /* Keyword.Pseudo */ +.codehilite .kr { color: #66d9ef } /* Keyword.Reserved */ +.codehilite .kt { color: #66d9ef } /* Keyword.Type */ +.codehilite .ld { color: #e6db74 } /* Literal.Date */ +.codehilite .m { color: #ae81ff } /* Literal.Number */ +.codehilite .s { color: #e6db74 } /* Literal.String */ +.codehilite .na { color: #a6e22e } /* Name.Attribute */ +.codehilite .nb { color: #f8f8f2 } /* Name.Builtin */ +.codehilite .nc { color: #a6e22e } /* Name.Class */ +.codehilite .no { color: #66d9ef } /* Name.Constant */ +.codehilite .nd { color: #a6e22e } /* Name.Decorator */ +.codehilite .ni { color: #f8f8f2 } /* Name.Entity */ +.codehilite .ne { color: #a6e22e } /* Name.Exception */ +.codehilite .nf { color: #a6e22e } /* Name.Function */ +.codehilite .nl { color: #f8f8f2 } /* Name.Label */ +.codehilite .nn { color: #f8f8f2 } /* Name.Namespace */ +.codehilite .nx { color: #a6e22e } /* Name.Other */ +.codehilite .py { color: #f8f8f2 } /* Name.Property */ +.codehilite .nt { color: #f92672 } /* Name.Tag */ +.codehilite .nv { color: #f8f8f2 } /* Name.Variable */ +.codehilite .ow { color: #f92672 } /* Operator.Word */ +.codehilite .w { color: #f8f8f2 } /* Text.Whitespace */ +.codehilite .mb { color: #ae81ff } /* Literal.Number.Bin */ +.codehilite .mf { color: #ae81ff } /* Literal.Number.Float */ +.codehilite .mh { color: #ae81ff } /* Literal.Number.Hex */ +.codehilite .mi { color: #ae81ff } /* Literal.Number.Integer */ +.codehilite .mo { color: #ae81ff } /* Literal.Number.Oct */ +.codehilite .sa { color: #e6db74 } /* Literal.String.Affix */ +.codehilite .sb { color: #e6db74 } /* Literal.String.Backtick */ +.codehilite .sc { color: #e6db74 } /* Literal.String.Char */ +.codehilite .dl { color: #e6db74 } /* Literal.String.Delimiter */ +.codehilite .sd { color: #e6db74 } /* Literal.String.Doc */ +.codehilite .s2 { color: #e6db74 } /* Literal.String.Double */ +.codehilite .se { color: #ae81ff } /* Literal.String.Escape */ +.codehilite .sh { color: #e6db74 } /* Literal.String.Heredoc */ +.codehilite .si { color: #e6db74 } /* Literal.String.Interpol */ +.codehilite .sx { color: #e6db74 } /* Literal.String.Other */ +.codehilite .sr { color: #e6db74 } /* Literal.String.Regex */ +.codehilite .s1 { color: #e6db74 } /* Literal.String.Single */ +.codehilite .ss { color: #e6db74 } /* Literal.String.Symbol */ +.codehilite .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ +.codehilite .fm { color: #a6e22e } /* Name.Function.Magic */ +.codehilite .vc { color: #f8f8f2 } /* Name.Variable.Class */ +.codehilite .vg { color: #f8f8f2 } /* Name.Variable.Global */ +.codehilite .vi { color: #f8f8f2 } /* Name.Variable.Instance */ +.codehilite .vm { color: #f8f8f2 } /* Name.Variable.Magic */ +.codehilite .il { color: #ae81ff } /* Literal.Number.Integer.Long */ -- cgit v1.2.3