forked from github.com/blag
removed types from docstrings now that we have type annotations.
note, the return value still needs to be in there.
This commit is contained in:
48
blag/blag.py
48
blag/blag.py
@@ -43,7 +43,7 @@ def main(arguments: list[str] | None = None) -> None:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
arguments : list[str]
|
arguments
|
||||||
optional parameters, used for testing
|
optional parameters, used for testing
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -60,7 +60,7 @@ def parse_args(args: list[str] | None = None) -> argparse.Namespace:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
args : List[str]
|
args
|
||||||
optional parameters, used for testing
|
optional parameters, used for testing
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
@@ -149,7 +149,7 @@ def get_config(configfile: str) -> configparser.SectionProxy:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
configfile : str
|
configfile
|
||||||
path to configuration file
|
path to configuration file
|
||||||
|
|
||||||
|
|
||||||
@@ -188,8 +188,9 @@ def environment_factory(
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
template_dir : str
|
template_dir
|
||||||
globals_ : dict[str, object]
|
directory containing the templates
|
||||||
|
globals_
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
@@ -216,7 +217,7 @@ def build(args: argparse.Namespace) -> None:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
args : argparse.Namespace
|
args
|
||||||
|
|
||||||
"""
|
"""
|
||||||
os.makedirs(f'{args.output_dir}', exist_ok=True)
|
os.makedirs(f'{args.output_dir}', exist_ok=True)
|
||||||
@@ -290,16 +291,17 @@ def process_markdown(
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
convertibles : list[tuple[str, str]]
|
convertibles
|
||||||
relative paths to markdown- (src) html- (dest) files
|
relative paths to markdown- (src) html- (dest) files
|
||||||
input_dir : str
|
input_dir
|
||||||
output_dir : str
|
output_dir
|
||||||
page_template, archive_template : jinja2 template
|
page_template, archive_template
|
||||||
templats for pages and articles
|
templats for pages and articles
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
articles, pages : list[tuple[str, dict[str, Any]]]
|
list[tuple[str, dict[str, Any]]], list[tuple[str, dict[str, Any]]]
|
||||||
|
articles and pages
|
||||||
|
|
||||||
"""
|
"""
|
||||||
logger.info("Converting Markdown files...")
|
logger.info("Converting Markdown files...")
|
||||||
@@ -346,17 +348,17 @@ def generate_feed(
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
articles : list[tuple[str, dict[str, Any]]]
|
articles
|
||||||
list of relative output path and article dictionary
|
list of relative output path and article dictionary
|
||||||
output_dir : str
|
output_dir
|
||||||
where the feed is stored
|
where the feed is stored
|
||||||
base_url : str
|
base_url
|
||||||
base url
|
base url
|
||||||
blog_title : str
|
blog_title
|
||||||
blog title
|
blog title
|
||||||
blog_description : str
|
blog_description
|
||||||
blog description
|
blog description
|
||||||
blog_author : str
|
blog_author
|
||||||
blog author
|
blog author
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -395,11 +397,11 @@ def generate_archive(
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
articles : list[tuple[str, dict[str, Any]]]
|
articles
|
||||||
List of articles. Each article has the destination path and a
|
List of articles. Each article has the destination path and a
|
||||||
dictionary with the content.
|
dictionary with the content.
|
||||||
template : jinja2.Template instance
|
template
|
||||||
output_dir : str
|
output_dir
|
||||||
|
|
||||||
"""
|
"""
|
||||||
archive = []
|
archive = []
|
||||||
@@ -423,11 +425,11 @@ def generate_tags(
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
articles : list[tuple[str, dict[str, Any]]]
|
articles
|
||||||
List of articles. Each article has the destination path and a
|
List of articles. Each article has the destination path and a
|
||||||
dictionary with the content.
|
dictionary with the content.
|
||||||
tags_template, tag_template : jinja2.Template instance
|
tags_template, tag_template
|
||||||
output_dir : str
|
output_dir
|
||||||
|
|
||||||
"""
|
"""
|
||||||
logger.info("Generating Tag-pages.")
|
logger.info("Generating Tag-pages.")
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ def get_last_modified(dirs: list[str]) -> float:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
dirs : list[str]
|
dirs
|
||||||
list of directories to search
|
list of directories to search
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
@@ -63,7 +63,8 @@ def autoreload(args: argparse.Namespace) -> None:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
args : argparse.Namespace
|
args
|
||||||
|
contains the input-, template- and static dir
|
||||||
|
|
||||||
"""
|
"""
|
||||||
dirs = [args.input_dir, args.template_dir, args.static_dir]
|
dirs = [args.input_dir, args.template_dir, args.static_dir]
|
||||||
@@ -85,7 +86,8 @@ def serve(args: argparse.Namespace) -> None:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
args : arparse.Namespace
|
args
|
||||||
|
contains the input-, template- and static dir
|
||||||
|
|
||||||
"""
|
"""
|
||||||
httpd = HTTPServer(('', 8000), partial(SimpleHTTPRequestHandler,
|
httpd = HTTPServer(('', 8000), partial(SimpleHTTPRequestHandler,
|
||||||
|
|||||||
@@ -54,12 +54,14 @@ def convert_markdown(
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
md : markdown.Markdown instance
|
md
|
||||||
markdown : str
|
the Markdown instance
|
||||||
|
markdown
|
||||||
|
the markdown text that should be converted
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
str, dict[str, str] :
|
str, dict[str, str]
|
||||||
html and metadata
|
html and metadata
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -16,14 +16,15 @@ def get_input(question: str, default: str) -> str:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
question : str
|
question
|
||||||
the question the user is presented
|
the question the user is presented
|
||||||
default : str
|
default
|
||||||
the default value that will be used if no answer was given
|
the default value that will be used if no answer was given
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
str
|
str
|
||||||
|
the answer
|
||||||
|
|
||||||
"""
|
"""
|
||||||
reply = input(f"{question} [{default}]: ")
|
reply = input(f"{question} [{default}]: ")
|
||||||
@@ -40,7 +41,8 @@ def quickstart(args: argparse.Namespace | None) -> None:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
args : argparse.Namespace
|
args
|
||||||
|
not used
|
||||||
|
|
||||||
"""
|
"""
|
||||||
base_url = get_input(
|
base_url = get_input(
|
||||||
|
|||||||
Reference in New Issue
Block a user