Skip to content

Commit 8970972

Browse files
committed
fix imports
1 parent 98facf8 commit 8970972

File tree

4 files changed

+82
-37
lines changed

4 files changed

+82
-37
lines changed

dev/md.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from markdown2 import Markdown
2+
3+
import os
4+
os.chdir('..')
5+
6+
with open("README.md") as f:
7+
mdt = f.read()
8+
9+
markdown = Markdown()
10+
mdh = markdown.convert(mdt)
11+
h = f"""
12+
<!DOCTYPE html>
13+
<html lang="en">
14+
<head>
15+
<title>PyPrez</title>
16+
<link rel="icon" type="image/x-icon" href="../favicon.ico">
17+
</head>
18+
<body>
19+
<div style="margin-left:8%;margin-right:8%;margin-top:3%;padding:5%;background-color:rgb(253, 253, 253);">
20+
{mdh}
21+
</div>
22+
</body>
23+
</html>
24+
"""
25+
with open("../README.html", 'w') as f:
26+
f.write(h)

dev/server.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,31 @@
44
"""
55
import asyncio
66
import sys
7+
import os
78

89
import tornado.web
910
import tornado.ioloop
1011

12+
os.chdir(os.path.dirname(os.path.dirname(__file__)))
13+
print(os.getcwd())
14+
15+
16+
class RedirectHandler(tornado.web.RequestHandler):
17+
"""main handler for requests to the base url"""
18+
def initialize(self, homepage) -> None:
19+
"""function which initializes the handler and sets the homepage"""
20+
self.homepage = homepage
21+
22+
def get(self):
23+
"""redirects the landing page to the home page"""
24+
self.redirect(self.homepage)
25+
1126

1227
if __name__ == "__main__":
13-
app = tornado.web.Application([(r"/(.*)", tornado.web.StaticFileHandler, {"path": "."})])
28+
app = tornado.web.Application([
29+
(r"/", RedirectHandler, {"homepage": "/index.html"}),
30+
(r"/(.*)", tornado.web.StaticFileHandler, {"path": "./site"})
31+
])
1432

1533
if sys.platform == 'win32':
1634
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

site/index.html

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
<meta charset="utf-8">
55
<meta name="description" content="">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<title>Scribbler - a codding landing page template for codrops</title>
7+
<title>PyPrez | Run Python codesnippets in the the browser. Embed runnable answers in Stack Overflow or your webpage.</title>
88
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
99
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800,900" rel="stylesheet">
1010
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/railscasts.min.css">
1111
<link rel="stylesheet" href="scribbler-global.css">
1212
<link rel="stylesheet" href="scribbler-landing.css">
1313
<link rel="author" href="humans.txt">
14+
<script src="https://modularizer.github.io/pyprez/pyprez.js"></script>
1415
</head>
1516
<body>
1617
<nav>
@@ -22,71 +23,71 @@
2223
</ul>
2324
</nav>
2425
<div class="hero">
25-
<h1 class="hero__title">Scribbler</h1>
26-
<p class="hero__description">Take your markdown notes in terminal</p>
27-
</div>
28-
<div class="hero__terminal">
29-
<pre>
30-
<!-- Place your demo code here -->
31-
<code class="shell-session demo">hyperyolo ~ $ </code>
32-
</pre>
26+
<h1 class="hero__title">PyPrez</h1>
27+
<p class="hero__description">Present your Python with runnable and editable code snippets</p>
28+
<!-- </div>-->
29+
<pyprez-editor theme="darcula" style="margin:0 auto;text-align:left" runonload="true">
30+
#!/usr/bin/env python
31+
import numpy as np
32+
x = np.random.rand(4)
33+
34+
if __name__ == "__main__":
35+
print(f"{x=}")
36+
</pyprez-editor>
3337
</div>
3438
<div class="wrapper">
3539
<div class="installation">
36-
<h3 class="section__title">Installation</h3>
40+
<h3 class="section__title">Import</h3>
3741
<div class="tab__container">
3842
<ul class="tab__menu">
39-
<li class="tab active" data-tab="mac">mac</li>
40-
<li class="tab" data-tab="linux">linux</li>
41-
<li class="tab" data-tab="win">win</li>
43+
<li class="tab active" data-tab="linux">HTML</li>
44+
<li class="tab" data-tab="win">Install Locally</li>
4245
</ul>
4346
<pre class="nohighlight code">
44-
<code class="tab__pane active mac">$ brew install scribbler</code>
45-
<code class="tab__pane linux">$ apt-get install scribbler</code>
46-
<code class="tab__pane win">$ gem install scribbler</code>
47+
<code class="tab__pane active linux">&ltscript src="https://github.com/modularizer/pyprez/pyprez.min.js"&gt&lt/script&gt</code>
48+
<code class="tab__pane win">git clone https://github.com/modularizer/pyprez.git</code>
4749
</pre>
4850
</div>
4951
</div>
5052
<div class="feature">
5153
<div class="feature__item">
52-
<h3 class="section__title">Fast & Light</h3>
53-
<p>Start writing your notes immediately in any terminal! No more time wasted on navigating and opening your text editor.</p>
54+
<h3 class="section__title">No Installation</h3>
55+
<p>PyPrez is a javascript library which gets loaded when the webpage loads, meaning no installation
56+
is necessary to developers or users</p>
5457
</div>
5558
<div class="feature__item">
56-
<h3 class="section__title">File Syncing</h3>
57-
<p>Save your file in Dropbox then you can access to it from anywhere.</p>
59+
<h3 class="section__title">No Server Needed</h3>
60+
<p>Can be used in any HTML document! No server needed (aside from the file server to serve HTML/JS file)</p>
5861
</div>
5962
<div class="feature__item">
60-
<h3 class="section__title">Secure</h3>
61-
<p>Encrypt your notes optionally. No one can get to your secrets! </p>
63+
<h3 class="section__title">Edit & Try Again</h3>
64+
<p>Tinker with your code until you get it to work. Editor doubles a Python Console after it is run.</p>
6265
</div>
6366
<div class="feature__item">
64-
<h3 class="section__title">Configuration</h3>
65-
<p>Maintain all your settings in a single <span class="code code--inline">config.json</span> file. Never need to redo the setting every single time jotting down a note.</p>
67+
<h3 class="section__title">Use On Stack Overflow</h3>
68+
<p>Embed runnable code snippets into your answers. <a>Instructions</a>, <a>Samples</a></p>
6669
</div>
6770
<div class="feature__item">
68-
<h3 class="section__title">Highlightings</h3>
69-
<p>For better readability, scribbler has a clean, beautiful color scheme allow you to scan files fast.</p>
71+
<h3 class="section__title">Customize</h3>
72+
<p>Choose from darkmode, light mode, or more!</p>
7073
</div>
7174
<div class="feature__item">
7275
<h3 class="section__title">Keybindings</h3>
73-
<p>You can expect common keybindings for scribbler. Customize <span class="code code--inline">bindings.json</span> for your own liking! </p>
76+
<p>You can expect common keybindings in the editor, plus a few extra!</p>
7477
</div>
7578
</div>
7679
<div class="keybinding">
7780
<ul class="keybinding__detail">
7881
<h3 class="keybinding__title">Default Keybindings</h3>
79-
<li>Quit without saving <span class="keybinding__label">Ctrl+C</span></li>
80-
<li>Save <span class="keybinding__label">Cmd+S</span></li>
81-
<li>Save and Quit <span class="keybinding__label">Ctrl+D</span></li>
82+
<li>Select All <span class="keybinding__label">Ctrl+A</span></li>
83+
<li>Copy Selected <span class="keybinding__label">Cmd+C</span></li>
84+
<li>Paste <span class="keybinding__label">Ctrl+V</span></li>
8285
<li>Undo <span class="keybinding__label">Cmd+Z</span></li>
8386
</ul>
8487
<ul class="keybinding__detail">
85-
<h3 class="keybinding__title">Markdown Keybindings</h3>
86-
<li><span class="keybinding__label">Ctrl+A</span> Insert Link Markdown</li>
87-
<li><span class="keybinding__label">Ctrl+I</span> Insert Image Markdown</li>
88-
<li><span class="keybinding__label">Ctrl+V</span> Insert YouTube Video</li>
89-
<li><span class="keybinding__label">Ctrl+T</span> Insert Table</li>
88+
<h3 class="keybinding__title">Special Keybindings</h3>
89+
<li><span class="keybinding__label">Shift+Enter</span> Run Code</li>
90+
<li><span class="keybinding__label">Shift + Backspace</span> Reset Code</li>
9091
</ul>
9192
</div>
9293
<div class="callout">

site/scribbler-landing.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ nav {
1313
.hero {
1414
text-align: center;
1515
background-color: var(--bg-color);
16-
padding: 2rem 0 10rem 0;
16+
padding: 2rem 0 2rem 0;
1717
}
1818

1919
.hero__title {

0 commit comments

Comments
 (0)