Skip to content

Commit 0a3a44d

Browse files
committedDec 20, 2020
initial commit
0 parents  commit 0a3a44d

File tree

7 files changed

+190
-0
lines changed

7 files changed

+190
-0
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# test scripts
2+
test*.py

‎LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Victoria Lim
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# TextSmoosh
2+
3+
README last updated: 20 Dec 2020
4+
5+
**About**: Web app to process and combine multi-line text into a single line.
6+
7+
## Screenshot of web app
8+
9+
![screenshot](https://github.com/vtlim/textsmoosh/blob/master/screenshot.png)
10+
11+
## Contributors
12+
Victoria Lim
13+

‎app.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
from flask import Flask, request, render_template
3+
4+
app = Flask(__name__)
5+
6+
@app.route('/')
7+
def my_form():
8+
return render_template('mainpage.html')
9+
10+
@app.route('/', methods=['POST'])
11+
def my_form_post():
12+
text = request.form['text']
13+
processed_text = text.upper()
14+
15+
if 'ignore-blank-lines' in request.form:
16+
processed_text = text.lower()
17+
if 'ignore-trailing-spaces' in request.form:
18+
processed_text = text.lower()
19+
20+
return processed_text

‎screenshot.png

70 KB
Loading

‎static/styles/main.css

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
.header {
3+
background-color: #1abc9c;
4+
color: white;
5+
font-size: 14px;
6+
padding-left: 15px;
7+
padding-top: 0.015px;
8+
padding-bottom: 0.012px;
9+
margin-top: 0px;
10+
}
11+
12+
* {
13+
box-sizing: border-box;
14+
}
15+
16+
.myform {
17+
display: grid;
18+
grid-template-areas:
19+
"inputArea optionsArea"
20+
"buttonArea ...";
21+
grid-template-rows: 2.4fr 0.3fr;
22+
grid-template-columns: 1.2fr 1fr;
23+
grid-gap: .8em;
24+
background: #eee;
25+
padding: 1.5em;
26+
}
27+
28+
.side-input {
29+
grid-area: inputArea;
30+
width: 100%;
31+
padding: 1.1em;
32+
margin-bottom: 1em;
33+
}
34+
35+
.side-options {
36+
grid-area: optionsArea;
37+
width: 100%;
38+
padding: 1.1em;
39+
margin-bottom: 1em;
40+
}
41+
42+
.myform button {
43+
grid-area: buttonArea;
44+
border: 0;
45+
background: gray;
46+
color: white;
47+
float: right;
48+
margin: 0.7em;
49+
padding: 0.7em;
50+
}
51+
52+
#textbox-input {
53+
width: 98.5%;
54+
height: 260px;
55+
}
56+
57+
.options-label1 {
58+
margin-left: 6px;
59+
}
60+
61+
.options-label2 {
62+
margin-left: 10px;
63+
}
64+
65+
#textbox-delimiter {
66+
vertical-align: -8px;
67+
}
68+
69+
span {
70+
display: block;
71+
overflow: hidden;
72+
padding-right:10px;
73+
}
74+
75+
label, input {
76+
display: inline-block;
77+
}
78+
79+
label {
80+
margin-bottom: 20px;
81+
vertical-align: top;
82+
}

‎templates/mainpage.html

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<title>Join multiline text</title>
6+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles/main.css') }}">
7+
</head>
8+
9+
<body>
10+
11+
<div class="header">
12+
<h1>Process and combine multi-line text into a single line</h1>
13+
</div>
14+
15+
<form method="POST" class="myform">
16+
17+
<div class="side-input">
18+
<label for="textbox-input">Input text:</label>
19+
<!-- <span><input id="textbox-input" name="text"></span> -->
20+
<textarea id="textbox-input" name="text" cols="40" rows="5"></textarea>
21+
<button>Submit</button>
22+
</div>
23+
24+
25+
<div class="side-options">
26+
<label><i>Before combining lines:</i></label>
27+
<br>
28+
<input type="checkbox" id="checkbox-blank" name="ignore-blank-lines" checked/>
29+
<label for="checkbox-blank" class="options-label1">Ignore blank lines</label>
30+
<br>
31+
<input type="checkbox" id="checkbox-trailing" name="ignore-trailing-spaces" checked/>
32+
<label for="checkbox-trailing" class="options-label1">Ignore trailing spaces</label>
33+
<br>
34+
<input type="checkbox" id="checkbox-leading" name="ignore-leading-spaces" checked/>
35+
<label for="checkbox-leading" class="options-label1">Ignore leading spaces</label>
36+
<br>
37+
<input id="textbox-rm-start" name="rm-start" type="number" value="0" style="width:40px"/>
38+
<label for="textbox-rm-start" class="options-label2">Remove this many characters from the <b>start</b> of each line.</label>
39+
<br>
40+
<input id="textbox-rm-end" name="rm-end" type="number" value="0" style="width:40px"/>
41+
<label for="textbox-rm-end" class="options-label2">Remove this many characters from the <b>end</b> of each line.</label>
42+
<br>
43+
<input id="textbox-delimiter" name="delimiter" style="width:40px"/>
44+
<label for="textbox-delimiter" class="options-label2">Insert character(s) between each line before combining.<br>Leave empty for no delimiter.</label>
45+
</div>
46+
47+
</form>
48+
49+
</body>
50+
</html>
51+
52+

0 commit comments

Comments
 (0)
Please sign in to comment.