Formatting

This commit is contained in:
squidfunk 2022-10-01 15:31:23 +02:00 committed by Martin Donath
parent c383892aae
commit 31518177b3
4 changed files with 16 additions and 12 deletions

View File

@ -20,6 +20,7 @@
import logging
import os
import posixpath
import re
import requests
import sys
@ -28,10 +29,9 @@ from collections import defaultdict
from hashlib import md5
from io import BytesIO
from mkdocs.commands.build import DuplicateFilter
from mkdocs.config.base import Config
from mkdocs.config import config_options as opt
from mkdocs.config.base import Config
from mkdocs.plugins import BasePlugin
import posixpath
from shutil import copyfile
from tempfile import TemporaryFile
from zipfile import ZipFile
@ -47,7 +47,7 @@ except ImportError:
# Class
# -----------------------------------------------------------------------------
# Configuration scheme
# Social plugin configuration scheme
class SocialPluginConfig(Config):
enabled = opt.Type(bool, default = True)
cache_dir = opt.Type(str, default = ".cache/plugin/social")
@ -55,9 +55,11 @@ class SocialPluginConfig(Config):
# Options for social cards
cards = opt.Type(bool, default = True)
cards_dir = opt.Type(str, default = "assets/images/social")
cards_color = opt.Type(dict, default = {})
cards_color = opt.Type(dict, default = dict())
cards_font = opt.Optional(opt.Type(str))
# -----------------------------------------------------------------------------
# Social plugin
class SocialPlugin(BasePlugin[SocialPluginConfig]):

View File

@ -34,10 +34,11 @@ from mkdocs.plugins import BasePlugin
# Class
# -----------------------------------------------------------------------------
# Configuration scheme
# Tags plugin configuration scheme
class TagsPluginConfig(Config):
tags_file = opt.Optional(opt.Type(str))
# -----------------------------------------------------------------------------
# Tags plugin
class TagsPlugin(BasePlugin[TagsPluginConfig]):
@ -120,7 +121,6 @@ class TagsPlugin(BasePlugin[TagsPluginConfig]):
classes = " ".join(classes)
content = [f"## <span class=\"{classes}\">{tag}</span>", ""]
for page in pages:
url = utils.get_relative_url(
page.file.src_uri,
self.tags_file.src_uri

View File

@ -20,6 +20,7 @@
import logging
import os
import posixpath
import re
import requests
import sys
@ -28,10 +29,9 @@ from collections import defaultdict
from hashlib import md5
from io import BytesIO
from mkdocs.commands.build import DuplicateFilter
from mkdocs.config.base import Config
from mkdocs.config import config_options as opt
from mkdocs.config.base import Config
from mkdocs.plugins import BasePlugin
import posixpath
from shutil import copyfile
from tempfile import TemporaryFile
from zipfile import ZipFile
@ -47,7 +47,7 @@ except ImportError:
# Class
# -----------------------------------------------------------------------------
# Configuration scheme
# Social plugin configuration scheme
class SocialPluginConfig(Config):
enabled = opt.Type(bool, default = True)
cache_dir = opt.Type(str, default = ".cache/plugin/social")
@ -55,9 +55,11 @@ class SocialPluginConfig(Config):
# Options for social cards
cards = opt.Type(bool, default = True)
cards_dir = opt.Type(str, default = "assets/images/social")
cards_color = opt.Type(dict, default = {})
cards_color = opt.Type(dict, default = dict())
cards_font = opt.Optional(opt.Type(str))
# -----------------------------------------------------------------------------
# Social plugin
class SocialPlugin(BasePlugin[SocialPluginConfig]):

View File

@ -34,10 +34,11 @@ from mkdocs.plugins import BasePlugin
# Class
# -----------------------------------------------------------------------------
# Configuration scheme
# Tags plugin configuration scheme
class TagsPluginConfig(Config):
tags_file = opt.Optional(opt.Type(str))
# -----------------------------------------------------------------------------
# Tags plugin
class TagsPlugin(BasePlugin[TagsPluginConfig]):
@ -120,7 +121,6 @@ class TagsPlugin(BasePlugin[TagsPluginConfig]):
classes = " ".join(classes)
content = [f"## <span class=\"{classes}\">{tag}</span>", ""]
for page in pages:
url = utils.get_relative_url(
page.file.src_uri,
self.tags_file.src_uri