-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.html
76 lines (53 loc) · 1.26 KB
/
generator.html
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
<!DOCTYPE html>
<script>
var name = '';
var lectures = `
`;
var exercises = `
`;
function p( text = '' )
{
document.write( text+'<br>' );
}
function process( names )
{
var ext, head, str, path;
for( var name of names )
{
name = name.split('/');
path = name[6];
name = name.pop().split('"')[0].split('.');
ext = name.pop();
name = name.join('.');
if( ext!='html' ) continue;
head = name.split(' ');
head[0] = '**'+head[0]+'**';
head = head.join(' ');
p(head);
p();
str = `[<kbd><img src="${path}/${name.split(' ').join('%20')}.jpg" width="400"></kbd>](${path}/${name}.html)`;
p(str);
p();
}
}
lectures = lectures.split( '\n' ).filter( x => x );
exercises = exercises.split( '\n' ).filter( x => x );
n = parseInt((lectures[0]||exercises[0]).split('/')[5]);
zn = n>9 ? n : '0'+n;
var uriname = name.toLowerCase().split('–').join('').split(' ').join('-');
p( `- [Тема №${n} &ndash; ${name}](${zn}/index.md)` );
p( '---' );
p( `title: Тема №${n} &ndash; ${name}` );
p( 'description: Архив с примери и решения' );
p( 'tag: contents' );
p( '---' );
p( );
p( '# Примери' );
p( );
process( lectures );
p( );
p( );
p( '# Задачи' );
p( );
process( exercises );
</script>