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