Merge pull request #173612 from snpschaaf/add-mkdocs-gitlab-plugin

python3Packages.mkdocs-gitlab-plugin: init at 0.1.4
This commit is contained in:
Jacek Galowicz 2022-06-17 18:28:10 +02:00 committed by GitHub
commit 24a298c37d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,37 @@
{ buildPythonPackage
, fetchzip
, isPy3k
, lib
, mkdocs
}:
buildPythonPackage rec {
pname = "mkdocs-gitlab-plugin";
version = "0.1.4";
disabled = !isPy3k;
src = fetchzip {
url = "https://gitlab.inria.fr/vidjil/mkdocs-gitlab-plugin/-/archive/fb87fbfd404839e661a799c540664b1103096a5f/mkdocs-gitlab-plugin-fb87fbfd404839e661a799c540664b1103096a5f.tar.gz";
sha256 = "sha256-z+U0PRwymDDXVNM7a2Yl4pNNVBxpx/BhJnlx6kgyvww=";
};
patches = [ ./mkdocs-gitlab-plugin.diff ];
propagatedBuildInputs = [ mkdocs ];
pythonImportsCheck = [ "mkdocs_gitlab_plugin" ];
meta = with lib; {
description = "MkDocs plugin to transform strings such as #1234, %56, or !789 into links to a Gitlab repository.";
homepage = "https://gitlab.inria.fr/vidjil/mkdocs-gitlab-plugin";
license = licenses.mit;
maintainers = with maintainers; [ snpschaaf ];
longDescription = ''
Plugin for MkDocs.
Transform handles such as #1234, %56, !789, &12 or $34 into links to a gitlab repository,
given by the gitlab_url configuration option.
Before the #/%/!/&/$ is needed either a space, a '(', or a '['.
'';
};
}

View File

@ -0,0 +1,37 @@
diff --git a/mkdocs_gitlab_plugin/plugin.py b/mkdocs_gitlab_plugin/plugin.py
index e8d7ab7..8b883f5 100644
--- a/mkdocs_gitlab_plugin/plugin.py
+++ b/mkdocs_gitlab_plugin/plugin.py
@@ -3,7 +3,7 @@
import re
import mkdocs
-from mkdocs.config import Config
+from mkdocs.config.config_options import Type
from mkdocs.plugins import BasePlugin
class GitlabLinksPlugin(BasePlugin):
@@ -13,8 +13,8 @@ class GitlabLinksPlugin(BasePlugin):
'''
config_scheme = (
- ('gitlab_url', mkdocs.config.config_options.Type(str, default='http://gitlab.com/XXX')),
- ('verbose', mkdocs.config.config_options.Type(bool, default=False))
+ ('gitlab_url', Type(str, default='http://gitlab.com/XXX')),
+ ('verbose', Type(bool, default=False))
)
TOKEN_PATHS = {
diff --git a/mkdocs_gitlab_plugin/test.py b/mkdocs_gitlab_plugin/test.py
index 4a5c35f..d5a19c6 100644
--- a/mkdocs_gitlab_plugin/test.py
+++ b/mkdocs_gitlab_plugin/test.py
@@ -1,7 +1,7 @@
import sys
-from plugin import GitlabLinksPlugin
+from .plugin import GitlabLinksPlugin
if __name__ == '__main__':
plugin = GitlabLinksPlugin()

View File

@ -5437,6 +5437,7 @@ in {
mkdocs = callPackage ../development/python-modules/mkdocs { };
mkdocs-drawio-exporter = callPackage ../development/python-modules/mkdocs-drawio-exporter { };
mkdocs-gitlab = callPackage ../development/python-modules/mkdocs-gitlab-plugin { };
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 { };