-
Notifications
You must be signed in to change notification settings - Fork 3
/
template.go
73 lines (65 loc) · 2.09 KB
/
template.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package main
// html文件模版函数
func RenderHTMLTemplate(bundleName string, versionName string) string {
return `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="../../modules/Antd.css" />
<link rel="stylesheet" type="text/css" href="../../modules/katex.min.css" />
<script type="text/javascript" src="../../modules/React.js"></script>
<script type="text/javascript" src="../../modules/ReactDOM.js"></script>
<script type="text/javascript" src="../../modules/Antd.js"></script>
<script type="text/javascript" src='./reversion.js'></script>
<script type="text/javascript">
const pageName = "` + bundleName + `"
const versionName = "` + versionName + `"
</script>
<style>
html,
body {
color: #242A31;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
font-size: 15px;
box-sizing: border-box;
font-family: "Roboto", sans-serif;
line-height: 1em;
font-smoothing: antialiased;
text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
</style>
<title>Document</title>
</head>
<body>
<div id='app'></div>
<script type="text/javascript" src="./` + bundleName + `.js"></script>
</body>
</html>
`
}
// tsx文件模版函数
func RenderTsxTemplate(dom string) string {
return `
import * as React from 'react';
import * as ReactDom from 'react-dom';
// MarkDown render components
import { Document } from '@components/Document.tsx';
import { Block } from '@components/block/index.tsx';
import { Text } from '@components/Text.tsx';
import { Inline } from '@components/Inline.tsx';
import { Sider } from '@components/Sider.tsx';
import { Header } from '@components/Header.tsx';
import { Recommend } from '@components/Recommend.tsx';
export default () => <Header><Sider>` + dom + `</Sider></Header>
`
}