forked from Dynalon/mdwiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tmpl
190 lines (170 loc) · 5.95 KB
/
index.tmpl
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html>
<!--
This is <%= grunt.config('pkg').name %> v<%= grunt.config('pkg').version %>
(C) 2013 by Timo Dörr and contributors. This software is licensed
under the terms of the GNU GPLv3 with additional terms applied.
See https://github.com/Dynalon/mdwiki/blob/master/LICENSE.txt for more detail.
See http://github.com/Dynalon/mdwiki for a copy of the source code.
-->
<head>
<title>MDwiki</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="fragment" content="!">
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta charset="UTF-8">
<style type="text/css">
/* hide the main content while we assemble everything */
.md-hidden-load { display: none; }
.anchor-highlight {
font-size: 0.7em;
margin-left: 0.25em;
}
/* for pageContentMenu */
#md-page-menu {
position: static;
}
#md-page-menu a.active {
/* background-color: rgba(0, 0, 0, 0.01); */
font-weight: bold;
padding-left: 6px;
}
@media (min-width: 992px) {
#md-page-menu.affix {
position: fixed;
}
}
@media (min-width: 768px) {
.md-float-left .col-sm-8, .md-float-right .col-sm-8 {
max-width: 66.67%;
}
.md-float-left .col-sm-4, .md-float-right .col-sm-4 {
max-width: 33.33%;
}
.md-float-left .col-sm-2, .md-float-right .col-sm-2 {
max-width: 16.67%;
}
}
@media (max-width: 992px) {
a.forkmeongithub {
display: none;
}
}
@media (max-width: 768px) {
/* don't use floating for smaller screens */
.md-float-left .col-sm-8, .md-float-left .col-sm-4, .md-float-left .col-sm-2 {
width: 100%;
max-width: !important;
min-width: 100%;
}
.md-float-right .col-sm-8, .md-float-right .col-sm-4, .md-float-right .col-sm-2 {
width: 100%;
max-width: !important;
min-width: 100%;
}
}
.md-floatenv .md-text {
/* md-text is not of md-col-* but needs the spacing */
margin-left: 15px;
margin-right: 15px;
}
/* float images */
.md-float-left .col-sm-8, .md-float-left .col-sm-4, .md-float-left .col-sm-2 {
float: left !important;
width: auto;
}
.md-float-right .col-sm-8, .md-float-right .col-sm-4, .md-float-right .col-sm-2 {
float: right;
width: auto;
}
#md-all .md-copyright-footer {
background-color: !important;
font-size: smaller;
padding: 1em;
}
</style>
<%
var task = grunt.config('currentTask').name;
grunt.log.writeln('Building single index.html of type: ' + task);
var ownJsFileFull = grunt.config('concat').dev.dest;
var ownJsFileMin = grunt.config('uglify').dist.dest;
var internalJsFiles = grunt.config('internalJsFiles');
var internalCssFiles = grunt.config('internalCssFiles');
var externalJsFiles = grunt.config('externalJsFiles');
var externalCssFiles = grunt.config('externalCssFiles');
var externalJsRefs = grunt.config('externalJsRefs');
var externalCssRefs = grunt.config('externalCssRefs');
function print_script_ref(ref) {
print('<script type="text/javascript" src="//' + ref + '"></script>\n');
}
function print_style_ref(ref) {
print('<link rel="stylesheet" href="//' + ref + '" type="text/css"></link>\n');
}
function print_script_inline(name, content) {
print('<!-- START ' + name + ' -->\n');
print('<script type="text/javascript">');
print(content);
print('</script>\n');
print('<!-- END ' + name + ' -->\n');
}
function print_style_inline(name, content) {
print('<!-- START ' + name + ' -->\n');
print('<style id="style:' + name + '">');
print(content);
print('</style>');
print('<!-- END ' + name + ' -->\n');
}
if (task === 'slim') {
// INCLUDE REFERENCES TO CDN
// css
for(var i = 0, len = externalCssRefs.length; i < len; i++) {
print_style_ref(externalCssRefs[i]);
}
// js
for(var i = 0, len = externalJsRefs.length; i < len; i++) {
print_script_ref(externalJsRefs[i]);
}
}
else if (task === 'fat' || task ==='debug') {
// INLINE SCRIPTS AND CSS
for(var i = 0, len = externalCssFiles.length; i < len; i++) {
var fileContent = grunt.file.read(externalCssFiles[i]);
print_style_inline(externalCssFiles[i], fileContent);
}
for(var i = 0, len = externalJsFiles.length; i < len; i++) {
var fileContent = grunt.file.read(externalJsFiles[i]);
print_script_inline(externalJsFiles[i], fileContent);
}
}
// STUFF WE ALWAYS INLINE (not available on any CDN)
for(var i = 0, len = internalCssFiles.length; i < len; i++) {
var fileContent = grunt.file.read(internalCssFiles[i]);
print_style_inline(internalCssFiles[i], fileContent);
}
for(var i = 0, len = internalJsFiles.length; i < len; i++) {
var fileContent = grunt.file.read(internalJsFiles[i]);
print_script_inline(internalJsFiles[i], fileContent);
}
// OUR OWN CODE
var fileContent = '';
if (task === 'debug') {
fileContent = grunt.file.read(ownJsFileFull);
print_script_inline(ownJsFileFull, fileContent);
} else if (task === 'fat' || task === 'slim') {
fileContent = grunt.file.read(ownJsFileMin);
print_script_inline(ownJsFileMin, fileContent);
}
if (task === 'debug') {
print('<script type="text/javascript">$.md.logThreshold = $.md.loglevel.DEBUG;</script>')
}
%>
</head>
<body>
<noscript>
This website requires Javascript to be enabled. Please turn on Javascript
and reload the page.
</noscript>
<div id="md-all">
</div>
</body>
</html>