python3Packages.mkdocs-graphviz: init at 1.5

Changed files
+74
pkgs
development
python-modules
top-level
+47
pkgs/development/python-modules/mkdocs-graphviz/default.nix
···
+
{
+
lib,
+
buildPythonPackage,
+
fetchFromGitLab,
+
replaceVars,
+
graphviz,
+
setuptools,
+
markdown,
+
}:
+
+
buildPythonPackage rec {
+
pname = "mkdocs-graphviz";
+
version = "1.5";
+
pyproject = true;
+
+
src = fetchFromGitLab {
+
owner = "rod2ik";
+
repo = "mkdocs-graphviz";
+
tag = version;
+
hash = "sha256-5pc5RpOrDSONZcgIQMNsVxYwFyJ+PMcIt0GXDxCEyOg=";
+
};
+
+
patches = [
+
# Replace the path to the `graphviz` commands to use the one provided by Nixpkgs.
+
(replaceVars ./replace-path-to-dot.patch {
+
command = "\"${graphviz}/bin/\" + command";
+
})
+
];
+
+
build-system = [ setuptools ];
+
+
dependencies = [
+
markdown
+
];
+
+
pythonImportsCheck = [ "mkdocs_graphviz" ];
+
+
# Tests are not available in the source code.
+
doCheck = false;
+
+
meta = {
+
description = "Configurable Python markdown extension for graphviz and Mkdocs";
+
homepage = "https://gitlab.com/rod2ik/mkdocs-graphviz";
+
license = lib.licenses.gpl3Only;
+
maintainers = with lib.maintainers; [ drupol ];
+
};
+
}
+25
pkgs/development/python-modules/mkdocs-graphviz/replace-path-to-dot.patch
···
+
diff --git i/mkdocs_graphviz.py w/mkdocs_graphviz.py
+
index 3aa190f..390e540 100644
+
--- i/mkdocs_graphviz.py
+
+++ w/mkdocs_graphviz.py
+
@@ -372,7 +372,7 @@ class MkdocsGraphvizPreprocessor(markdown.preprocessors.Preprocessor):
+
+
# RAW GRAPHVIZ BLOCK CONTENT
+
content = m.group('content')
+
- args = [command, '-T'+filetype]
+
+ args = [@command@, '-T'+filetype]
+
+
try:
+
bgcolor = self.config['bgcolor'][0]
+
@@ -384,9 +384,9 @@ class MkdocsGraphvizPreprocessor(markdown.preprocessors.Preprocessor):
+
edge_fontcolor = self.config['edge_fontcolor'][0]
+
+
if self.config['bgcolor'][0] == 'None' or self.config['bgcolor'][0] == 'none':
+
- args = [command, '-Gbgcolor=none', f'-Gcolor={graph_color}', f'-Gfontcolor={graph_fontcolor}', f'-Ncolor={node_color}', f'-Nfontcolor={node_fontcolor}', f'-Ecolor={edge_color}', f'-Efontcolor={edge_fontcolor}', '-T'+filetype]
+
+ args = [@command@, '-Gbgcolor=none', f'-Gcolor={graph_color}', f'-Gfontcolor={graph_fontcolor}', f'-Ncolor={node_color}', f'-Nfontcolor={node_fontcolor}', f'-Ecolor={edge_color}', f'-Efontcolor={edge_fontcolor}', '-T'+filetype]
+
else:
+
- args = [command, f'-Gcolor={graph_color}', f'-Gfontcolor={graph_fontcolor}', f'-Gbgcolor={bgcolor}', f'-Ncolor={node_color}', f'-Nfontcolor={node_fontcolor}', f'-Ecolor={edge_color}', f'-Efontcolor={edge_fontcolor}', '-T'+filetype]
+
+ args = [@command@, f'-Gcolor={graph_color}', f'-Gfontcolor={graph_fontcolor}', f'-Gbgcolor={bgcolor}', f'-Ncolor={node_color}', f'-Nfontcolor={node_fontcolor}', f'-Ecolor={edge_color}', f'-Efontcolor={edge_fontcolor}', '-T'+filetype]
+
+
proc = subprocess.Popen(
+
args,
+2
pkgs/top-level/python-packages.nix
···
mkdocs-glightbox = callPackage ../development/python-modules/mkdocs-glightbox { };
+
mkdocs-graphviz = callPackage ../development/python-modules/mkdocs-graphviz { };
+
mkdocs-jupyter = callPackage ../development/python-modules/mkdocs-jupyter { };
mkdocs-linkcheck = callPackage ../development/python-modules/mkdocs-linkcheck { };