move docs, remove katex

This commit is contained in:
undefined committed 2020-07-20 16:03:22 +08:00
1 parent da6002278d
commit c4a13f2e27
27 files changed
+190 -550

No files matched your search

+5 -4
View File
@@ -103,10 +103,11 @@ class SwitchLanguageHandler extends Handler {
}
class MarkdownHandler extends Handler {
async post({ text, safe = true }) {
this.response.body = safe
? markdown.safe.render(text)
: markdown.unsafe.render(text);
async post({ text, html = false, inline = false }) {
this.response.body = inline
? markdown.renderInline(text, html)
: markdown.render(text, html);
this.response.type = 'text/html';
}
}
+1 -1
View File
@@ -355,7 +355,7 @@ class ProblemEditHandler extends ProblemManageHandler {
const pid = checkPid(this.request.body.pid);
const pdoc = await problem.get(domainId, this.request.params.pid);
await problem.edit(domainId, pdoc.docId, { title, content, pid });
this.back();
this.response.redirect = this.url('problem_detail', this.request.params.pid);
}
}
-31
View File
@@ -1,31 +0,0 @@
import { NotFoundError } from '../error';
import {
Route, Handler, Types, param,
} from '../service/server';
class WikiHandler extends Handler {
@param('category', Types.String, true)
@param('page', Types.String)
async get(domainId: string, category = 'wiki', page: string) {
if (!global.Hydro.wiki[category]) throw new NotFoundError(category);
if (!global.Hydro.wiki[category][page]) throw new NotFoundError(category, page);
const contents = global.Hydro.wiki[category][page];
const pages = Object.keys(global.Hydro.wiki[category]);
const path = [
['Hydro', 'homepage'],
[`wiki_${category}`, null],
[`wiki_${category}_${page}`, null],
];
this.response.body = {
path, contents, pages, page_name: `wiki_${category}_${page}`,
};
this.response.template = 'wiki.html';
}
}
export async function apply() {
Route('wiki', '/wiki/:page', WikiHandler);
Route('wiki_with_category', '/wiki/:category/:page', WikiHandler);
}
global.Hydro.handler.wiki = apply;