1{ buildPythonPackage
2, fetchFromGitHub
3, lib
4, plantuml
5, markdown
6, requests
7, six
8, runCommand
9, writeText
10, plantuml-markdown
11, pythonOlder
12}:
13
14buildPythonPackage rec {
15 pname = "plantuml-markdown";
16 version = "3.9.1";
17 format = "setuptools";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "mikitex70";
23 repo = pname;
24 rev = "refs/tags/${version}";
25 hash = "sha256-5+l3JkK/8S1KFXqa0++l3mIQ2KCpHe9+DiVqasBAZA0=";
26 };
27
28 propagatedBuildInputs = [
29 plantuml
30 markdown
31 requests
32 six
33 ];
34
35 # The package uses a custom script that downloads a certain version of plantuml for testing.
36 doCheck = false;
37
38 pythonImportsCheck = [
39 "plantuml_markdown"
40 ];
41
42 passthru.tests.example-doc =
43 let
44 exampleDoc = writeText "plantuml-markdown-example-doc.md" ''
45 ```plantuml
46 Bob -> Alice: Hello
47 ```
48 '';
49 in
50 runCommand "plantuml-markdown-example-doc"
51 {
52 nativeBuildInputs = [ plantuml-markdown ];
53 } ''
54 markdown_py -x plantuml_markdown ${exampleDoc} > $out
55
56 ! grep -q "Error" $out
57 '';
58
59 meta = with lib; {
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/${version}";
67 license = licenses.bsd2;
68 maintainers = with maintainers; [ nikstur ];
69 };
70}