diff --git a/jimsite/__init__.py b/jimsite/__init__.py index 53d14a8..76f716a 100644 --- a/jimsite/__init__.py +++ b/jimsite/__init__.py @@ -5,7 +5,6 @@ import logging logger = logging.getLogger(__name__) 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 .templating import format_html_template, map_templates, TemplateSelections diff --git a/jimsite/__main__.py b/jimsite/__main__.py index e6cf236..3b8127c 100644 --- a/jimsite/__main__.py +++ b/jimsite/__main__.py @@ -1,6 +1,13 @@ +import os import argparse +import logging +import http.server + from jimsite import build +logger = logging.getLogger(__name__) + + if __name__ == '__main__': parser = argparse.ArgumentParser( prog='Jimsite', @@ -8,8 +15,45 @@ if __name__ == '__main__': 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() - build(config_filepath = args.config) \ No newline at end of file + # 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() \ No newline at end of file diff --git a/jimsite/articles.py b/jimsite/articles.py index a306df4..044eaca 100644 --- a/jimsite/articles.py +++ b/jimsite/articles.py @@ -47,6 +47,7 @@ class ArticleMetadata(pydantic.BaseModel): author: Optional[str] = None lastmod: Optional[date] = None thumbnail: Optional[str] = None + # TODO: add thumbnail support description: Optional[str] = None class Article(pydantic.BaseModel): @@ -70,8 +71,6 @@ def load_markdown(md: str) -> tuple[Optional[ArticleMetadata], str]: # Split the metadata from the contents. [raw_metadata, raw_article] = md.split('---') - # TODO: Consider adding an optional postscript document, for things like unescaped CSS. - # Use YAML to parse the metadata. metadata = yaml.safe_load(raw_metadata) diff --git a/site/assets/css/deprecated.css b/site/assets/css/deprecated.css deleted file mode 100644 index 87baee4..0000000 --- a/site/assets/css/deprecated.css +++ /dev/null @@ -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%; -}*/ diff --git a/site/assets/css/reset.css b/site/assets/css/reset.css index 4d0352d..e1d2243 100644 --- a/site/assets/css/reset.css +++ b/site/assets/css/reset.css @@ -49,10 +49,10 @@ table { border-collapse: collapse; border-spacing: 0; } -b{ +b, strong{ font-weight:bold; } -i { +i, em{ font-style: italic; } u{