-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog-maker.py
94 lines (79 loc) · 3.29 KB
/
blog-maker.py
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
class PostInformation:
def __init__(self, number, content):
self.n = number
self.c = content
def make_post(self):
if self.n == 1:
return '<h1>' + self.c + '</h1>'
elif self.n == 2:
return '<p>' + self.c + '</p>'
elif self.n == 3:
return '<span class="image fit">' + '<img src='+ self.c +'alt=""/></span>'
elif self.n == 4:
return '<iframe height=1000 width="100%" src=' + self.c + 'frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
elif self.n == 5:
return ''
else:
return ''
def main():
title = input("Title: ")
blog_body = input("Blog contents: ")
generate_blog(title, blog_body)
def generate_blog(title, body):
filename = 'auto_gen.html'
message = """<!DOCTYPE HTML>
<html>
<head>
<title>Red, White & Blue</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
<noscript><link rel="stylesheet" href="assets/css/noscript.css" /></noscript>
</head>
<body class="is-preload">
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<header id="header" class="alt">
<a href="index.html" class="logo"><strong>theredwhite.blue</strong> <span>by Brian Daniel</span></a>
</header>
<!-- Main -->
<div id="main" class="alt">
<!-- One -->
<section id="one">
<div class="inner">
<header class="major">
<h1>%s</h1>
</header>
<p>%s</p>
</div>
</section>
</div>
<!-- Footer -->
<footer id="footer">
<div class="inner">
<ul class="icons">
<li><a href="soon.html" class="icon brands alt fa-twitter"><span class="label">Twitter</span></a></li>
<li><a href="soon.html" class="icon brands alt fa-facebook-f"><span class="label">Facebook</span></a></li>
<li><a href="soon.html" class="icon brands alt fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="soon.html" class="icon brands alt fa-youtube"><span class="label">YouTube</span></a></li>
<li><a href="soon.html" class="icon brands alt fa-soundcloud"><span class="label">Sound Cloud</span></a></li>
</ul>
</div>
</footer>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>"""
with open(filename, 'w') as f:
whole = message % (title, body)
f.write(whole)
f.close()
main()