-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
342 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Module contains executable entrypoint for an app.""" | ||
"""Module contains executable entrypoint for an app (used for deployment e.g `heroku`).""" | ||
# pylint:disable=unused-import | ||
from article import app # noqa: F401 | ||
from article import application # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
"""Package contains a set of interfaces to operate `article` application.""" | ||
from flask import Flask | ||
from .views import home | ||
|
||
__author__: str = "Volodymyr Yahello" | ||
__email__: str = "vyahello@gmail.com" | ||
__version__: str = "0.0.0" | ||
|
||
app = None | ||
application: Flask = Flask(__name__) | ||
application.register_blueprint(home.to_register) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"""Represents executable entrypoint for `article` application.""" | ||
from article import application | ||
|
||
|
||
def main() -> None: | ||
def easyrun(host: str = "0.0.0.0", port: int = 5001, debug: bool = True) -> None: | ||
"""Runs `article` application.""" | ||
|
||
pass | ||
application.run(host, port, debug) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
easyrun() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* http://prismjs.com/download.html?themes=prism&languages=markup */ | ||
/** | ||
* prism.js default theme for JavaScript, CSS and HTML | ||
* Based on dabblet (http://dabblet.com) | ||
* @author Lea Verou | ||
*/ | ||
|
||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
color: black; | ||
text-shadow: 0 1px white; | ||
font-family: Consolas, Monaco, 'Andale Mono', monospace; | ||
direction: ltr; | ||
text-align: left; | ||
white-space: pre; | ||
word-spacing: normal; | ||
word-break: normal; | ||
line-height: 1.5; | ||
|
||
-moz-tab-size: 4; | ||
-o-tab-size: 4; | ||
tab-size: 4; | ||
|
||
-webkit-hyphens: none; | ||
-moz-hyphens: none; | ||
-ms-hyphens: none; | ||
hyphens: none; | ||
} | ||
|
||
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, | ||
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { | ||
text-shadow: none; | ||
background: #b3d4fc; | ||
} | ||
|
||
pre[class*="language-"]::selection, pre[class*="language-"] ::selection, | ||
code[class*="language-"]::selection, code[class*="language-"] ::selection { | ||
text-shadow: none; | ||
background: #b3d4fc; | ||
} | ||
|
||
@media print { | ||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
text-shadow: none; | ||
} | ||
} | ||
|
||
/* Code blocks */ | ||
pre[class*="language-"] { | ||
padding: 1em; | ||
margin: .5em 0; | ||
overflow: auto; | ||
} | ||
|
||
:not(pre) > code[class*="language-"], | ||
pre[class*="language-"] { | ||
background: #f5f2f0; | ||
} | ||
|
||
/* Inline code */ | ||
:not(pre) > code[class*="language-"] { | ||
padding: .1em; | ||
border-radius: .3em; | ||
} | ||
|
||
.token.comment, | ||
.token.prolog, | ||
.token.doctype, | ||
.token.cdata { | ||
color: slategray; | ||
} | ||
|
||
.token.punctuation { | ||
color: #999; | ||
} | ||
|
||
.namespace { | ||
opacity: .7; | ||
} | ||
|
||
.token.property, | ||
.token.tag, | ||
.token.boolean, | ||
.token.number, | ||
.token.constant, | ||
.token.symbol, | ||
.token.deleted { | ||
color: #905; | ||
} | ||
|
||
.token.selector, | ||
.token.attr-name, | ||
.token.string, | ||
.token.char, | ||
.token.builtin, | ||
.token.inserted { | ||
color: #690; | ||
} | ||
|
||
.token.operator, | ||
.token.entity, | ||
.token.url, | ||
.language-css .token.string, | ||
.style .token.string { | ||
color: #a67f59; | ||
background: hsla(0, 0%, 100%, .5); | ||
} | ||
|
||
.token.atrule, | ||
.token.attr-value, | ||
.token.keyword { | ||
color: #07a; | ||
} | ||
|
||
.token.function { | ||
color: #DD4A68; | ||
} | ||
|
||
.token.regex, | ||
.token.important, | ||
.token.variable { | ||
color: #e90; | ||
} | ||
|
||
.token.important { | ||
font-weight: bold; | ||
} | ||
|
||
.token.entity { | ||
cursor: help; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* Wide styles */ | ||
body { | ||
font-family: 'Open Sans', Arial, sans-serif; | ||
background: #fafafa; | ||
font-weight: 300; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
p { | ||
padding-bottom: 30px; | ||
} | ||
|
||
img { | ||
display: block; | ||
margin-left: auto; | ||
margin-right: auto; | ||
max-width: 100% !important; | ||
height: auto; | ||
} | ||
|
||
.btn, .btn-lg, .input-lg { | ||
border-radius: 3px; | ||
} | ||
|
||
.form-control { | ||
border-radius: 3px; | ||
-webkit-box-shadow: none; | ||
box-shadow: none; | ||
border: 0; | ||
} | ||
|
||
.input-lg { | ||
height: 50px; | ||
} | ||
|
||
.btn-lg, .btn-group-lg>.btn { | ||
padding: 10px 28px; | ||
height: 52px; | ||
} | ||
|
||
.btn-large { | ||
font-size: 18px; | ||
padding: 20px 50px; | ||
margin: 5px 10px; | ||
} | ||
|
||
.btn-success { | ||
background-color: rgba(108, 199, 108, 1.0); | ||
background-image: none; | ||
border: 0; | ||
line-height: 1.8; | ||
} | ||
|
||
.btn-success:hover, .btn-success:focus, .btn-success:active { | ||
background-color: rgba(94, 182, 94, 1.0); | ||
color: #fff; | ||
border: 0; | ||
} | ||
|
||
/* Specific styles */ | ||
.container.landing-page { | ||
position: relative; | ||
padding: 100px 15px; | ||
text-align: center; | ||
} | ||
|
||
.container.article-page { | ||
padding: 20px 15px 50px; | ||
background-color: #fff; | ||
color: rgba(0,0,0,0.8); | ||
font-family: 'Lora', serif; | ||
letter-spacing: 0.01rem; | ||
font-weight: 400; | ||
font-style: normal; | ||
font-size: 15px; | ||
line-height: 1.5; | ||
} | ||
|
||
.article { | ||
padding-top: 30px; | ||
} | ||
|
||
tr td:first-child { | ||
width: 15%; | ||
} | ||
|
||
tr td:last-child { | ||
max-width: 700px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Contains interfaces to work with application statuses.""" | ||
from enum import Enum | ||
|
||
|
||
class HttpStatus(Enum): | ||
"""Represents http status code item.""" | ||
|
||
NOT_FOUND: int = 404 | ||
|
||
@property | ||
def code(self) -> int: | ||
"""Returns value of status code.""" | ||
return self.value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% extends "shared/_layout.html" %} | ||
{% block body %} | ||
<div class="container landing-page"> | ||
<div class="row"> | ||
<div class="col-md-6 col-md-offset-3"> | ||
<h2>Newspaper Parser</h2> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-6 col-md-offset-3"> | ||
<form method=get> | ||
<div class="form-group"> | ||
<div class="col-md-12"> | ||
<input class="form-control input-lg" | ||
type="url" | ||
name="url_to_clean" | ||
placeholder="Paste the URL of an article"> | ||
</div> | ||
<div class="col-md-12"> | ||
<br/> | ||
<button class="btn btn-success btn-lg">Extract</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
<div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content=""> | ||
<title>Newspaper Parser</title> | ||
|
||
<!-- External CSS --> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | ||
|
||
<!-- External Fonts --> | ||
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,600' rel='stylesheet' type='text/css'> | ||
<link href='http://fonts.googleapis.com/css?family=Lora:400,700' rel='stylesheet' type='text/css'> | ||
|
||
<!--[if lt IE 9]> | ||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script> | ||
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script> | ||
<![endif]--> | ||
|
||
<!-- Site --> | ||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}"> | ||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/prism.css') }}"> | ||
</head> | ||
<body> | ||
<section class="main"> | ||
{% block body %}{% endblock %} | ||
</section> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Package contains API for application views.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Contains API for home page views.""" | ||
from flask import Response, blueprints as bprint, render_template | ||
from article.status import HttpStatus | ||
|
||
to_register: bprint.Blueprint = bprint.Blueprint(name=__name__, import_name=__name__) | ||
|
||
|
||
@to_register.route(rule="/") | ||
@to_register.route(rule="/index") | ||
def home() -> str: | ||
"""Returns home page content.""" | ||
return render_template(template_name_or_list="home/index.html") | ||
|
||
|
||
@to_register.errorhandler(code_or_exception=HttpStatus.NOT_FOUND.code) | ||
def not_found() -> Response: | ||
"""Returns page not found response.""" | ||
return Response(response="The page was not found", status=HttpStatus.NOT_FOUND.code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ pytest-clarity==0.3.0a0 | |
pytest-cov==2.8.1 | ||
pytest-mock==3.0.0 | ||
pytest-sugar==0.9.2 | ||
flask==1.1.2 |
Oops, something went wrong.