Some style cleanup, improved CLI
This commit is contained in:
parent
85e59a6e29
commit
9c98c392ba
@ -5,7 +5,6 @@ import logging
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||||
# TODO: add a way to change log level
|
|
||||||
|
|
||||||
from .common import filepath_or_string, GlobalVars, SiteConfig, dotmap_access
|
from .common import filepath_or_string, GlobalVars, SiteConfig, dotmap_access
|
||||||
from .templating import format_html_template, map_templates, TemplateSelections
|
from .templating import format_html_template, map_templates, TemplateSelections
|
||||||
|
|||||||
@ -1,6 +1,13 @@
|
|||||||
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
|
import logging
|
||||||
|
import http.server
|
||||||
|
|
||||||
from jimsite import build
|
from jimsite import build
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog='Jimsite',
|
prog='Jimsite',
|
||||||
@ -8,8 +15,45 @@ if __name__ == '__main__':
|
|||||||
epilog='Gonna be a hot one!'
|
epilog='Gonna be a hot one!'
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument('-c', '--config', type=str, default='config.yaml', help='Specifies the path to a YAML config file; defaults to config.yaml in the CWD.')
|
parser.add_argument(
|
||||||
|
'-c', '--config', type=str, default='config.yaml',
|
||||||
|
help='Specifies the path to a YAML config file; defaults to config.yaml in the CWD.'
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-v', '--verbose', action='store_true', help = 'Sets log level to DEBUG.'
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-s', '--serve', action='store_true',
|
||||||
|
help = 'Spins up a simple http.server.'
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-d', '--directory', default = './',
|
||||||
|
help = 'Changes the web root for the http.server.'
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-p', '--port', type=int, default=8000,
|
||||||
|
help = 'The port on which the http.server listens.'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
build(config_filepath = args.config)
|
# In verbose mode, set the root logger's level to DEBUG.
|
||||||
|
if args.verbose:
|
||||||
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
logger.critical('Building website.')
|
||||||
|
build(config_filepath = args.config)
|
||||||
|
|
||||||
|
if args.serve:
|
||||||
|
os.chdir(args.directory)
|
||||||
|
server = http.server.HTTPServer(
|
||||||
|
('', args.port), http.server.SimpleHTTPRequestHandler
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.critical(f"Serving website on port {args.port} from local directory '{args.directory}'")
|
||||||
|
server.serve_forever()
|
||||||
@ -47,6 +47,7 @@ class ArticleMetadata(pydantic.BaseModel):
|
|||||||
author: Optional[str] = None
|
author: Optional[str] = None
|
||||||
lastmod: Optional[date] = None
|
lastmod: Optional[date] = None
|
||||||
thumbnail: Optional[str] = None
|
thumbnail: Optional[str] = None
|
||||||
|
# TODO: add thumbnail support
|
||||||
description: Optional[str] = None
|
description: Optional[str] = None
|
||||||
|
|
||||||
class Article(pydantic.BaseModel):
|
class Article(pydantic.BaseModel):
|
||||||
@ -70,8 +71,6 @@ def load_markdown(md: str) -> tuple[Optional[ArticleMetadata], str]:
|
|||||||
# Split the metadata from the contents.
|
# Split the metadata from the contents.
|
||||||
[raw_metadata, raw_article] = md.split('---')
|
[raw_metadata, raw_article] = md.split('---')
|
||||||
|
|
||||||
# TODO: Consider adding an optional postscript document, for things like unescaped CSS.
|
|
||||||
|
|
||||||
# Use YAML to parse the metadata.
|
# Use YAML to parse the metadata.
|
||||||
metadata = yaml.safe_load(raw_metadata)
|
metadata = yaml.safe_load(raw_metadata)
|
||||||
|
|
||||||
|
|||||||
@ -1,174 +0,0 @@
|
|||||||
/*
|
|
||||||
html,body{
|
|
||||||
overflow:hidden;
|
|
||||||
/* text-shadow:
|
|
||||||
-1px -1px 0 #FFF,
|
|
||||||
1px -1px 0 #FFF,
|
|
||||||
-1px 1px 0 #FFF,
|
|
||||||
1px 1px 0 #FFF;*/
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
}
|
|
||||||
.container{
|
|
||||||
position:fixed;
|
|
||||||
top:10%;
|
|
||||||
left:0px;
|
|
||||||
width:95%;/*80% to make scroll bar flush.*/
|
|
||||||
height:85%;
|
|
||||||
/*opacity:0.7;*/
|
|
||||||
background-color:rgba(255,255,255,0.69);
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
/* overflow:none;*/
|
|
||||||
}
|
|
||||||
div{
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navibar{
|
|
||||||
z-index:38;
|
|
||||||
color: black;
|
|
||||||
text-shadow:
|
|
||||||
-1px -1px 0 #FFF,
|
|
||||||
1px -1px 0 #FFF,
|
|
||||||
-1px 1px 0 #FFF,
|
|
||||||
1px 1px 0 #FFF;
|
|
||||||
position:fixed;
|
|
||||||
top:15%;
|
|
||||||
left:0%;
|
|
||||||
width:15%;
|
|
||||||
height:65%;
|
|
||||||
/* list-style-image: url('au14.png');*/
|
|
||||||
font-family:roboto;
|
|
||||||
overflow:auto;
|
|
||||||
overflow-x:hidden;
|
|
||||||
|
|
||||||
margin:0;padding:0;
|
|
||||||
}
|
|
||||||
#navibartable{
|
|
||||||
|
|
||||||
}
|
|
||||||
.navibar{
|
|
||||||
background-image:url('images/portal.jpg');
|
|
||||||
border-radius: 10%;
|
|
||||||
height:10%;pbh
|
|
||||||
|
|
||||||
margin:0;padding:0;
|
|
||||||
}
|
|
||||||
td{
|
|
||||||
border-left: 1px solid #000;
|
|
||||||
border-right: 1px solid #000;
|
|
||||||
border-top: 1px solid #000;
|
|
||||||
border-bottom: 1px solid #000;
|
|
||||||
border-spacing:2px;
|
|
||||||
width:100%;
|
|
||||||
height:100%;
|
|
||||||
margin:0;padding:0;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
.padded{
|
|
||||||
padding-left:3%;
|
|
||||||
padding-botom:2px;
|
|
||||||
}
|
|
||||||
.navibarlink{
|
|
||||||
color: black;
|
|
||||||
text-decoration: none;
|
|
||||||
text-shadow:
|
|
||||||
-1px -1px 0 #FFF,
|
|
||||||
1px -1px 0 #FFF,
|
|
||||||
-1px 1px 0 #FFF,
|
|
||||||
1px 1px 0 #FFF;
|
|
||||||
margin:0;padding:0;
|
|
||||||
}
|
|
||||||
#title{
|
|
||||||
position:fixed;
|
|
||||||
top:15%;
|
|
||||||
left:20%;
|
|
||||||
width:80%;
|
|
||||||
height:10%;
|
|
||||||
font-size:42;
|
|
||||||
font-family:credits;
|
|
||||||
color: black;
|
|
||||||
text-shadow:
|
|
||||||
-1px -1px 0 #FFF,
|
|
||||||
1px -1px 0 #FFF,
|
|
||||||
-1px 1px 0 #FFF,
|
|
||||||
1px 1px 0 #FFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#contentarea{
|
|
||||||
z-index:1;
|
|
||||||
position:fixed;
|
|
||||||
top:25%;
|
|
||||||
left:20%;
|
|
||||||
width:70%;
|
|
||||||
height:65%;
|
|
||||||
font-size:14px;
|
|
||||||
font-family:roboto;
|
|
||||||
color: black;
|
|
||||||
text-shadow:
|
|
||||||
-1px -1px 0 #FFF,
|
|
||||||
1px -1px 0 #FFF,
|
|
||||||
-1px 1px 0 #FFF,
|
|
||||||
1px 1px 0 #FFF;
|
|
||||||
overflow:hidden;
|
|
||||||
overflow-x:hidden;
|
|
||||||
}
|
|
||||||
.content{
|
|
||||||
display:none;
|
|
||||||
overflow: scroll;
|
|
||||||
}
|
|
||||||
#logo{
|
|
||||||
height:6%;
|
|
||||||
position:fixed;
|
|
||||||
top:2%;
|
|
||||||
width:100%;
|
|
||||||
font-family: schwifty;
|
|
||||||
font-size:100%;
|
|
||||||
color:#00B1C1;
|
|
||||||
text-shadow:
|
|
||||||
|
|
||||||
-1px -1px 1px #000000,
|
|
||||||
1px -1px 1px #000000,
|
|
||||||
-1px 1px 1px #000000,
|
|
||||||
1px 1px 1px #000000,
|
|
||||||
-2px -2px 6px #81BC76,
|
|
||||||
2px -2px 6px #81BC76,
|
|
||||||
-2px 2px 6px #81BC76,
|
|
||||||
2px 2px 6px #81BC76;
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
/*font-style: italic;*/
|
|
||||||
}
|
|
||||||
#logop{
|
|
||||||
font-family: schwifty;
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
background-attachment: fixed;
|
|
||||||
background-image:url('images/backgrounds/firstepisode.png');
|
|
||||||
background-size: cover;
|
|
||||||
background-repeat:no-repeat;
|
|
||||||
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
.gradient{
|
|
||||||
/* z-index:-1;
|
|
||||||
position:relative;
|
|
||||||
top:0;
|
|
||||||
left:0;*/
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
width:100%;
|
|
||||||
height:100%;
|
|
||||||
background: linear-gradient(to bottom , rgba(0,0,0,0.6) , rgba(0,0,0,0));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#frame{
|
|
||||||
width:100%;
|
|
||||||
height:90%;
|
|
||||||
}*/
|
|
||||||
@ -49,10 +49,10 @@ table {
|
|||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
}
|
}
|
||||||
b{
|
b, strong{
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
i {
|
i, em{
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
u{
|
u{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user