python3Packages.mkdocs-macros: init at 0.7.0

This commit is contained in:
tljuniper 2022-05-25 10:16:14 +02:00
parent 94dc19d5f9
commit f3b7a7d654
4 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,43 @@
{ lib
, callPackage
, buildPythonPackage
, fetchPypi
, mkdocs
, mkdocs-macros
, mkdocs-material
, jinja2
, dateutil
, termcolor
, pyyaml
, runCommand
, setuptools
}:
buildPythonPackage rec {
pname = "mkdocs-macros-plugin";
version = "0.7.0";
src = fetchPypi {
inherit pname version;
sha256 = "sha256:0206cm0153vzp10c8a15bi2znisq5pv59zi9vrcm74pnpk5f2r4y";
};
propagatedBuildInputs = [
jinja2
dateutil
termcolor
pyyaml
mkdocs
];
passthru.tests.example-doc = callPackage ./tests.nix { };
pythonImportsCheck = [ "mkdocs_macros" ];
meta = with lib; {
homepage = "https://github.com/fralau/mkdocs_macros_plugin";
description = "Create richer and more beautiful pages in MkDocs, by using variables and calls to macros in the markdown code.";
license = licenses.mit;
maintainers = with maintainers; [ tljuniper ];
};
}

View File

@ -0,0 +1,27 @@
{ lib
, callPackage
, buildPythonPackage
, fetchPypi
, runCommand
, setuptools
}:
# Is required for properly testing mkdocs-macros
buildPythonPackage rec {
pname = "mkdocs-macros-test";
version = "0.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "sha256:1w12skm8l0r2x6z1va996lvq6z1873d0xzql9n0aja0g0v6s7ay5";
};
pythonImportsCheck = [ "mkdocs_macros_test" ];
meta = with lib; {
homepage = "https://github.com/fralau/mkdocs-macros-test";
description = "Implementation of a (model) pluglet for mkdocs-macros";
license = licenses.mit;
maintainers = with maintainers; [ tljuniper ];
};
}

View File

@ -0,0 +1,49 @@
{ setuptools
, mkdocs
, mkdocs-macros
, mkdocs-material
, runCommand
, callPackage
}:
let
inherit (mkdocs-macros) pname version src;
mkdocs-macros-test = callPackage ./mkdocs-macros-test.nix { };
env = {
nativeBuildInputs = [
setuptools
mkdocs
mkdocs-macros
mkdocs-macros-test
mkdocs-material
];
};
in
runCommand "mkdocs-macros-example-docs" env ''
set -euo pipefail
mkdir $out
base_dir=${pname}-${version}/test
tar --extract "--file=${src}"
for test_dir in $base_dir/*/; do
pushd $test_dir
mkdocs build --site-dir=$out/$test_dir
popd
done
# Do some static checks on the generated content
pushd $out/$base_dir
# Non-existent variables
cat debug/index.html | grep "another one: that"
# File inclusion
cat module/index.html | grep "part from an <em>included</em> file!"
# Variable replacement
cat module_dir/index.html | grep "total costs is 50 euros"
# New syntax with square brackets
cat new_syntax/index.html | grep "expensive"
# General info on macros
cat simple/index.html | grep "Macros Plugin Environment"
''

View File

@ -5338,6 +5338,7 @@ in {
mkdocs = callPackage ../development/python-modules/mkdocs { };
mkdocs-drawio-exporter = callPackage ../development/python-modules/mkdocs-drawio-exporter { };
mkdocs-macros = callPackage ../development/python-modules/mkdocs-macros { };
mkdocs-material = callPackage ../development/python-modules/mkdocs-material { };
mkdocs-material-extensions = callPackage ../development/python-modules/mkdocs-material/mkdocs-material-extensions.nix { };
mkdocs-minify = callPackage ../development/python-modules/mkdocs-minify { };