-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathutil.py
More file actions
76 lines (69 loc) · 2.19 KB
/
util.py
File metadata and controls
76 lines (69 loc) · 2.19 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, re, codecs, shutil, markdown, json, markdown2
html_head = '''
<!DOCTYPE html>
<html>
<head>
<title>[title]</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [["$","$"]]}
});
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
cancel: ["Extension","cancel"],
bcancel: ["Extension","cancel"],
xcancel: ["Extension","cancel"],
cancelto: ["Extension","cancel"]
});
});
</script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML-full">
</script>
<link rel="stylesheet" type="text/css" media="screen" href="https://burakbayramli.github.io/css/style.css">
</head>
<body>
<div id="header_wrap" class="outer">
<header class="inner">
<h1 id="project_title">
<a href="https://burakbayramli.github.io" style="text-decoration:none; color:inherit;">dersblog</a>
</h1>
<h2 id="project_tagline"></h2>
</header>
</div>
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<h1>[title]</h1>
'''
bottom = """
<br/><a href="../index.html">Yukarı</a>
</section>
</div>
</body>
</html>
"""
def translit_low(c):
res = c.lower()
res = res.replace(u'ğ','g')
res = res.replace(u'ş','s')
res = res.replace(u'ı','i')
res = res.replace(u'ç','c')
res = res.replace(u'ü','u')
res = res.replace(u'ö','o')
return res
def filename_from_title(title):
url = translit_low(title)
url = url.replace(" ","_")
url = url.replace("(","_")
url = url.replace("'","_")
url = url.replace(")","_")
url = url.replace("/","_")
url = url.replace("-","")
url = url.replace(",","")
url = url.replace("?","")
url = url.replace("̇","")
url = url.replace("#_","")
return url