pelican-linkclass 2.1.1__py3-none-any.whl → 2.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pelican-linkclass might be problematic. Click here for more details.
- {pelican_linkclass-2.1.1.dist-info → pelican_linkclass-2.1.3.dist-info}/METADATA +8 -8
- pelican_linkclass-2.1.3.dist-info/RECORD +5 -0
- {pelican_linkclass-2.1.1.dist-info → pelican_linkclass-2.1.3.dist-info}/WHEEL +1 -1
- pelican/plugins/linkclass/__init__.py +0 -1
- pelican/plugins/linkclass/linkclass.py +0 -51
- pelican/plugins/linkclass/mdx_linkclass.py +0 -105
- pelican_linkclass-2.1.1.dist-info/RECORD +0 -8
- {pelican_linkclass-2.1.1.dist-info → pelican_linkclass-2.1.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pelican-linkclass
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.3
|
|
4
4
|
Summary: Pelican plugin to set anchor tag's class attribute to differentiate between internal and external links
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Project-URL: Funding, https://donate.getpelican.com/
|
|
8
|
-
Author-email: Rafael Laboissière <rafael@laboissiere.net>
|
|
5
|
+
Keywords: pelican plugin link class
|
|
6
|
+
Author-Email: Rafael Laboissière <rafael@laboissiere.net>
|
|
9
7
|
License: AGPL-3.0
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Keywords: link class,pelican,plugin
|
|
12
8
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
9
|
Classifier: Environment :: Console
|
|
14
10
|
Classifier: Framework :: Pelican
|
|
@@ -21,13 +17,17 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
21
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
22
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
23
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
21
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
25
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Project-URL: Homepage, https://github.com/pelican-plugins/linkclass
|
|
24
|
+
Project-URL: Issue tracker, https://github.com/pelican-plugins/linkclass/issues
|
|
25
|
+
Project-URL: Funding, https://donate.getpelican.com/
|
|
26
26
|
Requires-Python: <4.0,>=3.8.1
|
|
27
27
|
Requires-Dist: pelican>=4.5
|
|
28
28
|
Requires-Dist: py3dns>=3.2
|
|
29
|
+
Requires-Dist: markdown>=3.4; extra == "markdown"
|
|
29
30
|
Provides-Extra: markdown
|
|
30
|
-
Requires-Dist: markdown>=3.4; extra == 'markdown'
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
|
|
33
33
|
Link Class: A Plugin for Pelican
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
pelican_linkclass-2.1.3.dist-info/METADATA,sha256=vTuxwO6zLUeN8l3jScFLZKtclp8SeRaXjf81MyAzxwI,5368
|
|
2
|
+
pelican_linkclass-2.1.3.dist-info/WHEEL,sha256=N2J68yzZqJh3mI_Wg92rwhw0rtJDFpZj9bwQIMJgaVg,90
|
|
3
|
+
pelican_linkclass-2.1.3.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
4
|
+
tasks.py,sha256=R4_NgphMhr2hskgNHL1nh9MACePHIqcwjEnDz6gAaJ4,3167
|
|
5
|
+
pelican_linkclass-2.1.3.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .linkclass import * # NOQA: F403
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"""Link Class Plugin for Pelican."""
|
|
2
|
-
|
|
3
|
-
# Copyright (C) 2015, 2019, 2023 Rafael Laboissière
|
|
4
|
-
#
|
|
5
|
-
# This program is free software: you can redistribute it and/or modify it
|
|
6
|
-
# under the terms of the GNU General Affero Public License as published by
|
|
7
|
-
# the Free Software Foundation, either version 3 of the License, or (at
|
|
8
|
-
# your option) any later version.
|
|
9
|
-
#
|
|
10
|
-
# This program is distributed in the hope that it will be useful, but
|
|
11
|
-
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
-
# Affero General Public License for more details.
|
|
14
|
-
#
|
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
# along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
from pelican import signals
|
|
20
|
-
|
|
21
|
-
from .mdx_linkclass import LC_CONFIG, LinkClassExtension
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def addLinkClass(gen):
|
|
25
|
-
"""Add LinkClass connector."""
|
|
26
|
-
if not gen.settings.get("MARKDOWN"):
|
|
27
|
-
from pelican.settings import DEFAULT_CONFIG
|
|
28
|
-
|
|
29
|
-
gen.settings["MARKDOWN"] = DEFAULT_CONFIG["MARKDOWN"]
|
|
30
|
-
|
|
31
|
-
if gen.settings.get("LINKCLASS"):
|
|
32
|
-
for param, default in gen.settings.get("LINKCLASS"):
|
|
33
|
-
LC_CONFIG[param] = default
|
|
34
|
-
|
|
35
|
-
if LinkClassExtension not in gen.settings["MARKDOWN"]:
|
|
36
|
-
config = {}
|
|
37
|
-
for key, value in LC_CONFIG.items():
|
|
38
|
-
config[key] = value
|
|
39
|
-
for key, value in gen.settings.items():
|
|
40
|
-
if key in LC_CONFIG:
|
|
41
|
-
config[key] = value
|
|
42
|
-
lcobj = LinkClassExtension(config)
|
|
43
|
-
try:
|
|
44
|
-
gen.settings["MARKDOWN"]["extensions"].append(lcobj)
|
|
45
|
-
except KeyError:
|
|
46
|
-
gen.settings["MARKDOWN"]["extensions"] = [lcobj]
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def register():
|
|
50
|
-
"""Register the Link Class plugin with Pelican."""
|
|
51
|
-
signals.initialized.connect(addLinkClass)
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"""Markdown extension for the Link Class plugin for Pelican."""
|
|
2
|
-
|
|
3
|
-
# Copyright (C) 2015, 2017, 2019, 2023 Rafael Laboissière
|
|
4
|
-
#
|
|
5
|
-
# This program is free software: you can redistribute it and/or modify it
|
|
6
|
-
# under the terms of the GNU General Affero Public License as published by
|
|
7
|
-
# the Free Software Foundation, either version 3 of the License, or (at
|
|
8
|
-
# your option) any later version.
|
|
9
|
-
#
|
|
10
|
-
# This program is distributed in the hope that it will be useful, but
|
|
11
|
-
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
-
# Affero General Public License for more details.
|
|
14
|
-
#
|
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
# along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import re
|
|
20
|
-
|
|
21
|
-
from markdown.extensions import Extension
|
|
22
|
-
from markdown.inlinepatterns import (
|
|
23
|
-
LINK_RE,
|
|
24
|
-
REFERENCE_RE,
|
|
25
|
-
LinkInlineProcessor,
|
|
26
|
-
ReferenceInlineProcessor,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
LC_CONFIG = {"INTERNAL_CLASS": "internal", "EXTERNAL_CLASS": "external"}
|
|
30
|
-
LC_HELP = {
|
|
31
|
-
"INTERNAL_CLASS": "Name of the CSS class for internal links",
|
|
32
|
-
"EXTERNAL_CLASS": "Name of the CSS class for external links",
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def add_class(elm, config):
|
|
37
|
-
"""Utlity function for adding the appropriate class attribute."""
|
|
38
|
-
try:
|
|
39
|
-
m = re.match("^https?://", elm.get("href"))
|
|
40
|
-
elm.set("class", m and config["EXTERNAL_CLASS"] or config["INTERNAL_CLASS"])
|
|
41
|
-
except AttributeError:
|
|
42
|
-
pass
|
|
43
|
-
return elm
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class LinkClassExtension(Extension):
|
|
47
|
-
"""Markdown extension for the Link Class plugin."""
|
|
48
|
-
|
|
49
|
-
def __init__(self, config):
|
|
50
|
-
"""Initialize the class object."""
|
|
51
|
-
for key, value in LC_CONFIG.items():
|
|
52
|
-
self.config[key] = [value, LC_HELP[key]]
|
|
53
|
-
super().__init__(**config)
|
|
54
|
-
|
|
55
|
-
def extendMarkdown(self, md):
|
|
56
|
-
"""Register the Markdown extension."""
|
|
57
|
-
# LinkClass instances is added to the list of inline pattern
|
|
58
|
-
# processors, with higher priority than the processor defined for the
|
|
59
|
-
# "link" and the "reference" objects, such that the normal behavior is
|
|
60
|
-
# overridden.
|
|
61
|
-
LinkClassPattern = LinkClass(LINK_RE, self.getConfigs())
|
|
62
|
-
LinkClassPattern.md = md
|
|
63
|
-
md.inlinePatterns.register(LinkClassPattern, "linkclass", 200)
|
|
64
|
-
ReferenceClassPattern = ReferenceClass(REFERENCE_RE, self.getConfigs())
|
|
65
|
-
ReferenceClassPattern.md = md
|
|
66
|
-
md.inlinePatterns.register(ReferenceClassPattern, "referenceclass", 200)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
class LinkClass(LinkInlineProcessor):
|
|
70
|
-
"""Markdown inline pattern processor for adding class attribute to inline-style hyperlinks.""" # NOQA: E501
|
|
71
|
-
|
|
72
|
-
def __init__(self, pattern, config):
|
|
73
|
-
"""Initialize the Markdwon inline pattern processor."""
|
|
74
|
-
super().__init__(pattern)
|
|
75
|
-
# Store the configuration dict
|
|
76
|
-
self.config = config
|
|
77
|
-
|
|
78
|
-
def handleMatch(self, m, data):
|
|
79
|
-
"""Add the class attribute to the generated <a> element."""
|
|
80
|
-
# Build the <a> element using the parent class
|
|
81
|
-
elm, start, end = super().handleMatch(m, data)
|
|
82
|
-
# Return the <a> element with added class
|
|
83
|
-
return add_class(elm, self.config), start, end
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class ReferenceClass(ReferenceInlineProcessor):
|
|
87
|
-
"""Markdown inline pattern processor for adding class attribute to inline-style references.""" # NOQA: E501
|
|
88
|
-
|
|
89
|
-
def __init__(self, pattern, config):
|
|
90
|
-
"""Initialize the Markdwon inline pattern processor."""
|
|
91
|
-
super().__init__(pattern)
|
|
92
|
-
# Store the configuration dict
|
|
93
|
-
self.config = config
|
|
94
|
-
|
|
95
|
-
def handleMatch(self, m, data):
|
|
96
|
-
"""Add the class attribute to the generated <a> element."""
|
|
97
|
-
# Build the <a> element using the parent class
|
|
98
|
-
elm, start, end = super().handleMatch(m, data)
|
|
99
|
-
# Return the <a> element with added class
|
|
100
|
-
return add_class(elm, self.config), start, end
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def makeExtension(config=None):
|
|
104
|
-
"""Register the MarkDown extension."""
|
|
105
|
-
return LinkClassExtension(config=config)
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
tasks.py,sha256=R4_NgphMhr2hskgNHL1nh9MACePHIqcwjEnDz6gAaJ4,3167
|
|
2
|
-
pelican/plugins/linkclass/__init__.py,sha256=re7EWl6N43Ej9nzpMFA7ajrG5TBjlQAQmoYRK27mo28,39
|
|
3
|
-
pelican/plugins/linkclass/linkclass.py,sha256=CtfkYJhNq9_g4hy40gvhfIk8f-CvI4QBLrhyHEbfVRg,1790
|
|
4
|
-
pelican/plugins/linkclass/mdx_linkclass.py,sha256=bISYENA4fq1z-ZY5z0TH6qCA5HRbsc4M4oZTd1yIZ0Q,3978
|
|
5
|
-
pelican_linkclass-2.1.1.dist-info/METADATA,sha256=MBVaC75kdPIGv4RbcBSdrO5DjjRfRvXSv5pQuGiHNyk,5339
|
|
6
|
-
pelican_linkclass-2.1.1.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
|
|
7
|
-
pelican_linkclass-2.1.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
8
|
-
pelican_linkclass-2.1.1.dist-info/RECORD,,
|
|
File without changes
|