-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpose.py
More file actions
58 lines (44 loc) · 1.59 KB
/
expose.py
File metadata and controls
58 lines (44 loc) · 1.59 KB
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
# NO LONGER IN USE: refreshRepo does it all
import glob
import subprocess
import os
repoRoot='/home/lou/Public/ELTeC-'
webRoot='/home/lou/Public/distantreading.github.io/ELTeC/'
LANGS=('cze', 'deu', 'eng', 'fra', 'gre', 'hun', 'ita', 'lit', 'nor', 'por', 'rom', 'slv', 'spa', 'srp')
folderRoot='https://raw.githubusercontent.com/COST-ELTeC/ELTeC-'
string1='''<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="../../css/cetei.css" media="all" title="no title" />
<link type="application/tei+xml" rel="alternate" href="'''
string2='''"/>
<script src="../../js/CETEI.js" ></script>
<script type="text/javascript">
var ceteicean = new CETEI();
ceteicean.shadowCSS = "../../css/cetei.css";
ceteicean.getHTML5("'''
string3='''",function(data) {
document.getElementsByTagName("body")[0].appendChild(data);});
</script>
<title>Generated dummy</title>
</head>
<body>
<a href="https://www.distant-reading.net/">
<img src="../../media/distantreading.png" alt="logo"/>
</a>
</body>
</html>'''
for LANG in LANGS:
repoName=repoRoot+LANG
print("Exposing repo "+repoName)
os.chdir(repoName)
FILES=glob.glob('level[01]/*.xml')
for FILE in FILES:
bf=os.path.splitext(FILE)[0]
f1=bf.split('/')[1]
id=f1.split('_')[0]
outputFile=webRoot+LANG+"/"+id+".html"
gitURL=folderRoot+LANG+"/master/"+FILE
webFile=open(outputFile,'w')
webFile.write(string1+gitURL+string2+gitURL+string3)
webFile.close