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