1{ 2 buildPythonPackage, 3 fetchFromGitHub, 4 pkgs, # Only for pkgs.plantuml, 5 lib, 6 plantuml, 7 markdown, 8 requests, 9 six, 10 runCommand, 11 writeText, 12 plantuml-markdown, 13}: 14 15buildPythonPackage rec { 16 pname = "plantuml-markdown"; 17 version = "3.11.1"; 18 format = "setuptools"; 19 20 src = fetchFromGitHub { 21 owner = "mikitex70"; 22 repo = "plantuml-markdown"; 23 tag = version; 24 hash = "sha256-DgHWqwPsZ5q1XqrfaAiUslKnJdHX4Pzw9lygF3iaxz4="; 25 }; 26 27 postPatch = '' 28 substituteInPlace plantuml_markdown/plantuml_markdown.py \ 29 --replace-fail '"plantuml_cmd": ["plantuml"' '"plantuml_cmd": ["${lib.getExe pkgs.plantuml}"' 30 ''; 31 32 propagatedBuildInputs = [ 33 plantuml 34 markdown 35 requests 36 six 37 ]; 38 39 # The package uses a custom script that downloads a certain version of plantuml for testing. 40 # Missing https://github.com/ezequielramos/http-server-mock which looks unmaintained 41 doCheck = false; 42 43 pythonImportsCheck = [ "plantuml_markdown" ]; 44 45 passthru.tests.example-doc = 46 let 47 exampleDoc = writeText "plantuml-markdown-example-doc.md" '' 48 ```plantuml 49 Bob -> Alice: Hello 50 ``` 51 ''; 52 in 53 runCommand "plantuml-markdown-example-doc" { nativeBuildInputs = [ plantuml-markdown ]; } '' 54 markdown_py -x plantuml_markdown ${exampleDoc} > $out 55 56 ! grep -q "Error" $out 57 ''; 58 59 meta = { 60 description = "PlantUML plugin for Python-Markdown"; 61 longDescription = '' 62 This plugin implements a block extension which can be used to specify a PlantUML 63 diagram which will be converted into an image and inserted in the document. 64 ''; 65 homepage = "https://github.com/mikitex70/plantuml-markdown"; 66 changelog = "https://github.com/mikitex70/plantuml-markdown/releases/tag/${src.tag}"; 67 license = lib.licenses.bsd2; 68 maintainers = with lib.maintainers; [ nikstur ]; 69 }; 70}