mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-27 08:10:24 +01:00
Clean up
This commit is contained in:
parent
c2a8e29ef9
commit
01e7a01daf
6 changed files with 0 additions and 342 deletions
|
@ -1,9 +0,0 @@
|
|||
extends ./base
|
||||
|
||||
block main
|
||||
!= html
|
||||
|
||||
block footer
|
||||
p
|
||||
= i18n('docs.edit-this-page-on-github')
|
||||
a(href=src rel="noopener" target="_blank")= i18n('docs.edit-this-page-on-github-link')
|
|
@ -1,50 +0,0 @@
|
|||
doctype html
|
||||
|
||||
html(lang= lang)
|
||||
head
|
||||
meta(charset="UTF-8")
|
||||
meta(name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no")
|
||||
title
|
||||
| #{title} | Misskey Docs
|
||||
link(rel="stylesheet" href="/docs/assets/style.css")
|
||||
link(rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css")
|
||||
script(src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js")
|
||||
link(rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous")
|
||||
block meta
|
||||
|
||||
body
|
||||
nav
|
||||
ul
|
||||
each doc in docs
|
||||
li: a(href=`/docs/${lang}/${doc.name}`)= doc.title[lang] || doc.title['ja-JP']
|
||||
main
|
||||
article
|
||||
block main
|
||||
if content
|
||||
| !{content}
|
||||
|
||||
aside.
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
|
||||
/**
|
||||
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
|
||||
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
|
||||
/*
|
||||
var disqus_config = function () {
|
||||
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
|
||||
this.page.identifier = "#{ id }"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
|
||||
};
|
||||
*/
|
||||
(function() { // DON'T EDIT BELOW THIS LINE
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://misskey.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
|
||||
footer
|
||||
block footer
|
||||
small= copyright
|
|
@ -1,156 +0,0 @@
|
|||
@import "../client/style"
|
||||
@import "./ui"
|
||||
|
||||
html
|
||||
--accent #fb4e4e
|
||||
--link #fb4e4e
|
||||
--linkTapHighlight #fb4e4eb3
|
||||
|
||||
body
|
||||
margin 0
|
||||
color #34495e
|
||||
word-break break-word
|
||||
|
||||
main
|
||||
margin 0 0 0 330px
|
||||
padding 64px
|
||||
width 850px
|
||||
max-width calc(100% - 330px)
|
||||
|
||||
h1
|
||||
margin 0 0 24px 0
|
||||
padding 16px 0
|
||||
font-size 1.5em
|
||||
border-bottom solid 2px #eee
|
||||
|
||||
h2
|
||||
margin 1em 0 24px 0
|
||||
padding 0 0 16px 0
|
||||
font-size 1.4em
|
||||
border-bottom solid 1px #eee
|
||||
|
||||
h3
|
||||
margin 1em 0 0 0
|
||||
padding 0
|
||||
font-size 1.25em
|
||||
|
||||
h4
|
||||
margin 1em 0 0 0
|
||||
|
||||
p
|
||||
margin 1em 0
|
||||
line-height 1.6em
|
||||
|
||||
hr
|
||||
border none
|
||||
border-bottom solid 2px #eee
|
||||
|
||||
> aside
|
||||
margin-top 32px
|
||||
padding-top 32px
|
||||
border-top solid 2px #eee
|
||||
|
||||
> footer
|
||||
margin 32px 0 0 0
|
||||
border-top solid 2px #eee
|
||||
|
||||
> small
|
||||
display block
|
||||
margin 16px 0 0 0
|
||||
color #aaa
|
||||
|
||||
nav
|
||||
display block
|
||||
position fixed
|
||||
z-index 10000
|
||||
top 0
|
||||
left 0
|
||||
width 330px
|
||||
height 100%
|
||||
overflow auto
|
||||
padding 32px
|
||||
background #fff
|
||||
border-right solid 2px #eee
|
||||
|
||||
ul
|
||||
padding 0
|
||||
margin 0
|
||||
|
||||
@media (max-width 1025px)
|
||||
main
|
||||
margin 0
|
||||
max-width 100%
|
||||
|
||||
nav
|
||||
position relative
|
||||
width 100%
|
||||
max-height 128px
|
||||
background #f9f9f9
|
||||
border-right none
|
||||
|
||||
@media (max-width 768px)
|
||||
main
|
||||
padding 32px
|
||||
|
||||
@media (max-width 512px)
|
||||
main
|
||||
padding 16px
|
||||
|
||||
table
|
||||
width 100%
|
||||
max-width 100%
|
||||
overflow auto
|
||||
border-spacing 0
|
||||
border-collapse collapse
|
||||
|
||||
thead
|
||||
font-weight bold
|
||||
border-bottom solid 2px #eee
|
||||
|
||||
tr
|
||||
th
|
||||
text-align left
|
||||
|
||||
tbody
|
||||
tr
|
||||
&:nth-child(odd)
|
||||
background #fbfbfb
|
||||
|
||||
th, td
|
||||
padding 8px 16px
|
||||
min-width 128px
|
||||
|
||||
code
|
||||
padding 4px 8px
|
||||
font-family Consolas, 'Courier New', Courier, Monaco, monospace
|
||||
//color #295c92
|
||||
background #f2f2f2
|
||||
border-radius 4px
|
||||
|
||||
pre
|
||||
overflow auto
|
||||
|
||||
> code
|
||||
display block
|
||||
padding 16px
|
||||
|
||||
kbd.group
|
||||
display inline-block
|
||||
padding 4px
|
||||
background #fbfbfb
|
||||
border 1px solid #d6d6d6
|
||||
border-radius 4px
|
||||
box-shadow 0 1px 1px rgba(0, 0, 0, 0.1)
|
||||
|
||||
kbd.key
|
||||
display inline-block
|
||||
padding 6px 8px
|
||||
background #fff
|
||||
border solid 1px #cecece
|
||||
border-radius 4px
|
||||
box-shadow 0 1px 1px rgba(0, 0, 0, 0.1)
|
||||
|
||||
td
|
||||
> kbd.group,
|
||||
> kbd.key
|
||||
margin 4px
|
|
@ -1,19 +0,0 @@
|
|||
.ui.info
|
||||
display block
|
||||
margin 1em 0
|
||||
padding 0 1em
|
||||
font-size 90%
|
||||
color rgba(#000, 0.87)
|
||||
background #f8f8f9
|
||||
border-radius 4px
|
||||
overflow hidden
|
||||
|
||||
> p
|
||||
opacity 0.8
|
||||
|
||||
> [data-icon]:first-child
|
||||
margin-right 0.25em
|
||||
|
||||
&.warn
|
||||
color #573a08
|
||||
background #FFFAF3
|
|
@ -1,106 +0,0 @@
|
|||
/**
|
||||
* Docs
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as showdown from 'showdown';
|
||||
import 'showdown-highlightjs-extension';
|
||||
import ms = require('ms');
|
||||
import * as Router from '@koa/router';
|
||||
import * as send from 'koa-send';
|
||||
import * as glob from 'glob';
|
||||
import config from '../../config';
|
||||
import { licenseHtml } from '../../misc/license';
|
||||
import * as locales from '../../../locales';
|
||||
import * as nestedProperty from 'nested-property';
|
||||
|
||||
function getLang(lang: string): string {
|
||||
if (['en-US', 'ja-JP'].includes(lang)) {
|
||||
return lang;
|
||||
} else {
|
||||
return 'en-US';
|
||||
}
|
||||
}
|
||||
|
||||
async function genVars(lang: string): Promise<{ [key: string]: any }> {
|
||||
const vars = {} as { [key: string]: any };
|
||||
|
||||
vars['lang'] = lang;
|
||||
|
||||
const cwd = path.resolve(__dirname + '/../../../') + '/';
|
||||
|
||||
const docs = glob.sync(`src/docs/**/*.${lang}.md`, { cwd });
|
||||
vars['docs'] = {};
|
||||
for (const x of docs) {
|
||||
const [, name] = x.match(/docs\/(.+?)\.(.+?)\.md$/)!;
|
||||
if (vars['docs'][name] == null) {
|
||||
vars['docs'][name] = {
|
||||
name,
|
||||
title: {}
|
||||
};
|
||||
}
|
||||
vars['docs'][name]['title'][lang] = fs.readFileSync(cwd + x, 'utf-8').match(/^# (.+?)\r?\n/)![1];
|
||||
}
|
||||
|
||||
vars['kebab'] = (string: string) => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase();
|
||||
|
||||
vars['config'] = config;
|
||||
|
||||
vars['copyright'] = '(c) Misskey';
|
||||
|
||||
vars['license'] = licenseHtml;
|
||||
|
||||
vars['i18n'] = (key: string) => nestedProperty.get(locales[lang], key);
|
||||
|
||||
return vars;
|
||||
}
|
||||
|
||||
const router = new Router();
|
||||
|
||||
router.get('/assets/*', async ctx => {
|
||||
await send(ctx as any, ctx.params[0], {
|
||||
root: `${__dirname}/../../docs/assets/`,
|
||||
maxage: ms('1 days')
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/*/*', async ctx => {
|
||||
const lang = getLang(ctx.params[0]);
|
||||
const doc = ctx.params[1];
|
||||
|
||||
showdown.extension('urlExtension', () => ({
|
||||
type: 'output',
|
||||
regex: /%URL%/g,
|
||||
replace: config.url
|
||||
}));
|
||||
|
||||
showdown.extension('wsUrlExtension', () => ({
|
||||
type: 'output',
|
||||
regex: /%WS_URL%/g,
|
||||
replace: config.wsUrl
|
||||
}));
|
||||
|
||||
showdown.extension('apiUrlExtension', () => ({
|
||||
type: 'output',
|
||||
regex: /%API_URL%/g,
|
||||
replace: config.apiUrl
|
||||
}));
|
||||
|
||||
const conv = new showdown.Converter({
|
||||
tables: true,
|
||||
extensions: ['urlExtension', 'apiUrlExtension', 'highlightjs']
|
||||
});
|
||||
const md = fs.readFileSync(`${__dirname}/../../../src/docs/${doc}.${lang}.md`, 'utf8');
|
||||
|
||||
await ctx.render('../../../../src/docs/article', Object.assign({
|
||||
id: doc,
|
||||
html: conv.makeHtml(md),
|
||||
title: md.match(/^# (.+?)\r?\n/)![1],
|
||||
src: `https://github.com/syuilo/misskey/tree/master/src/docs/${doc}.${lang}.md`
|
||||
}, await genVars(lang)));
|
||||
|
||||
ctx.set('Cache-Control', 'public, max-age=300');
|
||||
});
|
||||
|
||||
export default router;
|
|
@ -10,7 +10,6 @@ import * as send from 'koa-send';
|
|||
import * as favicon from 'koa-favicon';
|
||||
import * as views from 'koa-views';
|
||||
|
||||
import docs from './docs';
|
||||
import packFeed from './feed';
|
||||
import { fetchMeta } from '../../misc/fetch-meta';
|
||||
import { genOpenapiSpec } from '../api/openapi/gen-spec';
|
||||
|
@ -84,7 +83,6 @@ router.get('/robots.txt', async ctx => {
|
|||
//#endregion
|
||||
|
||||
// Docs
|
||||
router.use('/docs', docs.routes());
|
||||
router.get('/api-doc', async ctx => {
|
||||
await send(ctx as any, '/assets/redoc.html', {
|
||||
root: client
|
||||
|
|
Loading…
Reference in a new issue