From 10962099b9ceb757dcb11839e6d88b347d656eb6 Mon Sep 17 00:00:00 2001 From: phil65 Date: Fri, 29 Sep 2023 00:24:45 +0200 Subject: [PATCH] chore: make attr_list a fixed default --- mknodes/basenodes/mkannotations.py | 2 -- mknodes/basenodes/mkclickdoc.py | 3 +-- mknodes/basenodes/mkgrid.py | 10 ++-------- mknodes/basenodes/mkimage.py | 5 +---- mknodes/basenodes/mkimagecompare.py | 4 ---- mknodes/basenodes/mkimageslideshow.py | 4 ---- mknodes/basenodes/mklink.py | 3 +-- mknodes/basenodes/mknode.py | 4 +++- mknodes/basenodes/mktimeline.py | 5 +---- 9 files changed, 9 insertions(+), 31 deletions(-) diff --git a/mknodes/basenodes/mkannotations.py b/mknodes/basenodes/mkannotations.py index b9552ae6..c7300662 100644 --- a/mknodes/basenodes/mkannotations.py +++ b/mknodes/basenodes/mkannotations.py @@ -14,7 +14,6 @@ class MkAnnotation(mkcontainer.MkContainer): """Represents a single annotation. It gets managed by an MkAnnotations node.""" REQUIRED_EXTENSIONS = [ - requirements.Extension("attr_list"), requirements.Extension("md_in_html"), requirements.Extension("pymdownx.superfences"), ] @@ -52,7 +51,6 @@ class MkAnnotations(mkcontainer.MkContainer): items: list[MkAnnotation] REQUIRED_EXTENSIONS = [ - requirements.Extension("attr_list"), requirements.Extension("md_in_html"), requirements.Extension("pymdownx.superfences"), ] diff --git a/mknodes/basenodes/mkclickdoc.py b/mknodes/basenodes/mkclickdoc.py index a41391c0..79a38eac 100644 --- a/mknodes/basenodes/mkclickdoc.py +++ b/mknodes/basenodes/mkclickdoc.py @@ -3,7 +3,7 @@ from typing import Any from mknodes.basenodes import mknode -from mknodes.utils import clihelpers, log, reprhelpers, requirements +from mknodes.utils import clihelpers, log, reprhelpers logger = log.get_logger(__name__) @@ -12,7 +12,6 @@ class MkClickDoc(mknode.MkNode): """Documentation for click / typer CLI apps.""" - REQUIRED_EXTENSIONS = [requirements.Extension("attr_list")] ICON = "material/api" def __init__( diff --git a/mknodes/basenodes/mkgrid.py b/mknodes/basenodes/mkgrid.py index b644d734..864b2f21 100644 --- a/mknodes/basenodes/mkgrid.py +++ b/mknodes/basenodes/mkgrid.py @@ -12,10 +12,7 @@ class MkGridCard(mkcontainer.MkContainer): ICON = "material/square-medium" STATUS = "new" - REQUIRED_EXTENSIONS = [ - requirements.Extension("attr_list"), - requirements.Extension("md_in_html"), - ] + REQUIRED_EXTENSIONS = [requirements.Extension("md_in_html")] def __init__( self, @@ -36,10 +33,7 @@ class MkGrid(mkcontainer.MkContainer): """Node for showing a grid.""" ICON = "material/view-grid" - REQUIRED_EXTENSIONS = [ - requirements.Extension("attr_list"), - requirements.Extension("md_in_html"), - ] + REQUIRED_EXTENSIONS = [requirements.Extension("md_in_html")] items: list[MkGridCard] def __init__( diff --git a/mknodes/basenodes/mkimage.py b/mknodes/basenodes/mkimage.py index 3e94e7fe..dee97ed8 100644 --- a/mknodes/basenodes/mkimage.py +++ b/mknodes/basenodes/mkimage.py @@ -19,10 +19,7 @@ class MkImage(mknode.MkNode): """Image including optional caption.""" ICON = "material/image" - REQUIRED_EXTENSIONS = [ - requirements.Extension("attr_list"), - requirements.Extension("md_in_html"), - ] + REQUIRED_EXTENSIONS = [requirements.Extension("md_in_html")] def __init__( self, diff --git a/mknodes/basenodes/mkimagecompare.py b/mknodes/basenodes/mkimagecompare.py index 22c2e468..79ccf608 100644 --- a/mknodes/basenodes/mkimagecompare.py +++ b/mknodes/basenodes/mkimagecompare.py @@ -22,10 +22,6 @@ class MkImageCompare(mknode.MkNode): """Node to show an Image comparison (using a slider).""" ICON = "material/image-off" - REQUIRED_EXTENSIONS = [ - requirements.Extension("attr_list"), - requirements.Extension("md_in_html"), - ] JS_FILES = [requirements.JSLink(JS_URL, defer=True)] CSS = [requirements.CSSLink(CSS_URL)] diff --git a/mknodes/basenodes/mkimageslideshow.py b/mknodes/basenodes/mkimageslideshow.py index 1b7f27c9..b09105cb 100644 --- a/mknodes/basenodes/mkimageslideshow.py +++ b/mknodes/basenodes/mkimageslideshow.py @@ -25,10 +25,6 @@ class MkImageSlideshow(mknode.MkNode): """Node to show an Image comparison (using a slider).""" ICON = "material/image-multiple" - REQUIRED_EXTENSIONS = [ - requirements.Extension("attr_list"), - requirements.Extension("md_in_html"), - ] JS_FILES = [requirements.JSLink(JS_URL)] def __init__( diff --git a/mknodes/basenodes/mklink.py b/mknodes/basenodes/mklink.py index b4297c55..3f7b0faf 100644 --- a/mknodes/basenodes/mklink.py +++ b/mknodes/basenodes/mklink.py @@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Any from mknodes.basenodes import mknode -from mknodes.utils import log, reprhelpers, requirements +from mknodes.utils import log, reprhelpers if TYPE_CHECKING: @@ -22,7 +22,6 @@ class MkLink(mknode.MkNode): """ ICON = "octicons/link-24" - REQUIRED_EXTENSIONS = [requirements.Extension("attr_list")] # for buttons def __init__( self, diff --git a/mknodes/basenodes/mknode.py b/mknodes/basenodes/mknode.py index b3593862..cb73f8a6 100644 --- a/mknodes/basenodes/mknode.py +++ b/mknodes/basenodes/mknode.py @@ -285,6 +285,8 @@ def get_requirements(self) -> requirements.Requirements: logger.debug("Collecting requirements from tree...") nodes = [*list(self.descendants), self] extensions: dict[str, dict] = { + "attr_list": {}, + "md_in_html": {}, "pymdownx.emoji": {}, "pymdownx.magiclink": dict( repo_url_shorthand=True, @@ -341,7 +343,7 @@ def to_html(self) -> str: md = self.to_markdown() reqs = self.get_requirements() configs = reqs.markdown_extensions - exts = [*list(configs.keys()), "attr_list", "md_in_html"] + exts = list(configs.keys()) return markdown.Markdown(extensions=exts, extension_configs=configs).convert(md) diff --git a/mknodes/basenodes/mktimeline.py b/mknodes/basenodes/mktimeline.py index 9acd3471..3abb0064 100644 --- a/mknodes/basenodes/mktimeline.py +++ b/mknodes/basenodes/mktimeline.py @@ -86,10 +86,7 @@ class MkTimeline(mkcontainer.MkContainer): """Node to show an Image comparison (using a slider).""" ICON = "material/timeline" - REQUIRED_EXTENSIONS = [ - requirements.Extension("attr_list"), - requirements.Extension("md_in_html"), - ] + REQUIRED_EXTENSIONS = [requirements.Extension("md_in_html")] JS_FILES = [ requirements.JSLink(JQUERY_LINK), requirements.JSLink(SCROLLREVEAL_LINK),