Merge pull request #173267 from tljuniper/add-mkdocs-macros-plugin
python3Packages.mkdocs-macros: init at 0.7.0
This commit is contained in:
commit
f16159714c
@ -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";
|
||||
|
43
pkgs/development/python-modules/mkdocs-macros/default.nix
Normal file
43
pkgs/development/python-modules/mkdocs-macros/default.nix
Normal 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 ];
|
||||
};
|
||||
}
|
@ -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 ];
|
||||
};
|
||||
}
|
49
pkgs/development/python-modules/mkdocs-macros/tests.nix
Normal file
49
pkgs/development/python-modules/mkdocs-macros/tests.nix
Normal 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"
|
||||
''
|
@ -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 { };
|
||||
|
Loading…
Reference in New Issue
Block a user