Merge pull request #173267 from tljuniper/add-mkdocs-macros-plugin

python3Packages.mkdocs-macros: init at 0.7.0
This commit is contained in:
Jacek Galowicz 2022-05-25 13:22:31 +02:00 committed by GitHub
commit f16159714c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 126 additions and 0 deletions

View File

@ -12835,6 +12835,12 @@
fingerprint = "556A 403F B0A2 D423 F656 3424 8489 B911 F9ED 617B";
}];
};
tljuniper = {
email = "tljuniper1@gmail.com";
github = "tljuniper";
githubId = 48209000;
name = "Anna Gillert";
};
tmarkovski = {
email = "tmarkovski@gmail.com";
github = "tmarkovski";

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 { };