ons-mkdocs-theme 0.1__tar.gz

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.
@@ -0,0 +1,26 @@
1
+ Copyright © 2015, Dougal Matthews. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or
4
+ without modification, are permitted provided that the following
5
+ conditions are met:
6
+
7
+ Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in
11
+ the documentation and/or other materials provided with the
12
+ distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
15
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
+ POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.1
2
+ Name: ons-mkdocs-theme
3
+ Version: 0.1
4
+ Summary: ONS MkDocs theme
5
+ Home-page: https://github.com/ONSdigital/ons-docs-site
6
+ Author: Keilan Evans
7
+ Author-email: Keilan Evans <keilan.evans@ons.gov.uk>
8
+ License: Copyright © 2015, Dougal Matthews. All rights reserved.
9
+
10
+ Redistribution and use in source and binary forms, with or
11
+ without modification, are permitted provided that the following
12
+ conditions are met:
13
+
14
+ Redistributions of source code must retain the above copyright
15
+ notice, this list of conditions and the following disclaimer.
16
+ Redistributions in binary form must reproduce the above copyright
17
+ notice, this list of conditions and the following disclaimer in
18
+ the documentation and/or other materials provided with the
19
+ distribution.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
22
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
26
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
29
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
+ POSSIBILITY OF SUCH DAMAGE.
34
+
35
+ Project-URL: Source, https://github.com/ONSdigital/ons-mkdocs-theme
36
+ Classifier: Development Status :: 5 - Production/Stable
37
+ Classifier: Environment :: Web Environment
38
+ Classifier: Framework :: MkDocs
39
+ Classifier: Intended Audience :: Information Technology
40
+ Classifier: License :: OSI Approved :: BSD License
41
+ Classifier: Operating System :: OS Independent
42
+ Classifier: Topic :: Documentation
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: mkdocs>=1.6
46
+ Requires-Dist: mkdocs-material>=9.5
47
+
48
+ <p align="center">
49
+ <img src=".github/assets/logo.svg" width="320px">
50
+ </P>
51
+
52
+ # MkDocs ONS Theme
53
+
54
+ This is an Office for National Statistics (ONS) branded theme that can be used in conjunction
55
+ with MkDocs.
56
+
57
+ The purpose of this theme is to give users a way of generating styled documentation.
@@ -0,0 +1,10 @@
1
+ <p align="center">
2
+ <img src=".github/assets/logo.svg" width="320px">
3
+ </P>
4
+
5
+ # MkDocs ONS Theme
6
+
7
+ This is an Office for National Statistics (ONS) branded theme that can be used in conjunction
8
+ with MkDocs.
9
+
10
+ The purpose of this theme is to give users a way of generating styled documentation.
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ons-mkdocs-theme"
7
+ version = "0.1"
8
+ description = "ONS MkDocs theme"
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ authors = [
12
+ {name = "Keilan Evans", email = "keilan.evans@ons.gov.uk"},
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 5 - Production/Stable",
16
+ "Environment :: Web Environment",
17
+ "Framework :: MkDocs",
18
+ "Intended Audience :: Information Technology",
19
+ "License :: OSI Approved :: BSD License",
20
+ "Operating System :: OS Independent",
21
+ "Topic :: Documentation",
22
+ ]
23
+ dependencies = [
24
+ "mkdocs >= 1.6",
25
+ "mkdocs-material >= 9.5",
26
+ ]
27
+
28
+ [project.urls]
29
+ Source = "https://github.com/ONSdigital/ons-mkdocs-theme"
30
+
31
+ [project.entry-points."mkdocs.themes"]
32
+ ons-mkdocs-theme = "src"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,34 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="ons-mkdocs-theme",
5
+ version="0.1",
6
+ description="ONS MkDocs theme",
7
+ long_description=open("README.md").read(),
8
+ long_description_content_type="text/markdown",
9
+ license="BSD-2-Clause",
10
+ author="Keilan Evans",
11
+ author_email="keilan.evans@ons.gov.uk",
12
+ classifiers=[
13
+ "Development Status :: 5 - Production/Stable",
14
+ "Environment :: Web Environment",
15
+ "Framework :: MkDocs",
16
+ "Intended Audience :: Information Technology",
17
+ "License :: OSI Approved :: BSD License",
18
+ "Operating System :: OS Independent",
19
+ "Topic :: Documentation",
20
+ ],
21
+ packages=find_packages(where="src"),
22
+ package_dir={"": "src"},
23
+ include_package_data=True,
24
+ install_requires=[
25
+ "mkdocs >= 1.6",
26
+ "mkdocs-material >= 9.5",
27
+ ],
28
+ entry_points={
29
+ "mkdocs.themes": [
30
+ "basictheme = src",
31
+ ],
32
+ },
33
+ url="https://github.com/ONSdigital/ons-docs-site",
34
+ )
@@ -0,0 +1,19 @@
1
+ # Copyright (c) 2016-2024 Martin Donath <martin.donath@squidfunk.com>
2
+
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to
5
+ # deal in the Software without restriction, including without limitation the
6
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ # sell copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ # IN THE SOFTWARE.
@@ -0,0 +1,98 @@
1
+ # Copyright (c) 2016-2024 Martin Donath <martin.donath@squidfunk.com>
2
+
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to
5
+ # deal in the Software without restriction, including without limitation the
6
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ # sell copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ # IN THE SOFTWARE.
20
+
21
+ from __future__ import annotations
22
+
23
+ import codecs
24
+ import functools
25
+ import material
26
+ import os
27
+
28
+ from glob import iglob
29
+ from inspect import getfile
30
+ from markdown import Markdown
31
+ from pymdownx import emoji, twemoji_db
32
+ from xml.etree.ElementTree import Element
33
+
34
+ # -----------------------------------------------------------------------------
35
+ # Functions
36
+ # -----------------------------------------------------------------------------
37
+
38
+ # Create twemoji index
39
+ def twemoji(options: object, md: Markdown):
40
+ paths = options.get("custom_icons", [])[:]
41
+ return _load_twemoji_index(tuple(paths))
42
+
43
+ # Create emoji or icon
44
+ def to_svg(
45
+ index: str, shortname: str, alias: str, uc: str | None, alt: str,
46
+ title: str, category: str, options: object, md: Markdown
47
+ ):
48
+ if not uc:
49
+ icons = md.inlinePatterns["emoji"].emoji_index["emoji"]
50
+
51
+ # Create and return element to host icon
52
+ el = Element("span", { "class": options.get("classes", index) })
53
+ el.text = md.htmlStash.store(_load(icons[shortname]["path"]))
54
+ return el
55
+
56
+ # Delegate to `pymdownx.emoji` extension
57
+ return emoji.to_svg(
58
+ index, shortname, alias, uc, alt, title, category, options, md
59
+ )
60
+
61
+ # -----------------------------------------------------------------------------
62
+ # Helper functions
63
+ # -----------------------------------------------------------------------------
64
+
65
+ # Load icon
66
+ @functools.lru_cache(maxsize = None)
67
+ def _load(file: str):
68
+ with codecs.open(file, encoding = "utf-8") as f:
69
+ return f.read()
70
+
71
+ # Load twemoji index and add icons
72
+ @functools.lru_cache(maxsize = None)
73
+ def _load_twemoji_index(paths):
74
+ index = {
75
+ "name": "twemoji",
76
+ "emoji": twemoji_db.emoji,
77
+ "aliases": twemoji_db.aliases
78
+ }
79
+
80
+ # Compute path to theme root and traverse all icon directories
81
+ root = os.path.dirname(getfile(material))
82
+ root = os.path.join(root, "templates", ".icons")
83
+ for path in [*paths, root]:
84
+ base = os.path.normpath(path)
85
+
86
+ # Index icons provided by the theme and via custom icons
87
+ glob = os.path.join(base, "**", "*.svg")
88
+ glob = iglob(os.path.normpath(glob), recursive = True)
89
+ for file in glob:
90
+ icon = file[len(base) + 1:-4].replace(os.path.sep, "-")
91
+
92
+ # Add icon to index
93
+ name = f":{icon}:"
94
+ if not any(name in index[key] for key in ["emoji", "aliases"]):
95
+ index["emoji"][name] = { "name": name, "path": file }
96
+
97
+ # Return index
98
+ return index
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.1
2
+ Name: ons-mkdocs-theme
3
+ Version: 0.1
4
+ Summary: ONS MkDocs theme
5
+ Home-page: https://github.com/ONSdigital/ons-docs-site
6
+ Author: Keilan Evans
7
+ Author-email: Keilan Evans <keilan.evans@ons.gov.uk>
8
+ License: Copyright © 2015, Dougal Matthews. All rights reserved.
9
+
10
+ Redistribution and use in source and binary forms, with or
11
+ without modification, are permitted provided that the following
12
+ conditions are met:
13
+
14
+ Redistributions of source code must retain the above copyright
15
+ notice, this list of conditions and the following disclaimer.
16
+ Redistributions in binary form must reproduce the above copyright
17
+ notice, this list of conditions and the following disclaimer in
18
+ the documentation and/or other materials provided with the
19
+ distribution.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
22
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
26
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
29
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32
+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
+ POSSIBILITY OF SUCH DAMAGE.
34
+
35
+ Project-URL: Source, https://github.com/ONSdigital/ons-mkdocs-theme
36
+ Classifier: Development Status :: 5 - Production/Stable
37
+ Classifier: Environment :: Web Environment
38
+ Classifier: Framework :: MkDocs
39
+ Classifier: Intended Audience :: Information Technology
40
+ Classifier: License :: OSI Approved :: BSD License
41
+ Classifier: Operating System :: OS Independent
42
+ Classifier: Topic :: Documentation
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: mkdocs>=1.6
46
+ Requires-Dist: mkdocs-material>=9.5
47
+
48
+ <p align="center">
49
+ <img src=".github/assets/logo.svg" width="320px">
50
+ </P>
51
+
52
+ # MkDocs ONS Theme
53
+
54
+ This is an Office for National Statistics (ONS) branded theme that can be used in conjunction
55
+ with MkDocs.
56
+
57
+ The purpose of this theme is to give users a way of generating styled documentation.
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ src/extensions/__init__.py
6
+ src/extensions/emoji.py
7
+ src/ons_mkdocs_theme.egg-info/PKG-INFO
8
+ src/ons_mkdocs_theme.egg-info/SOURCES.txt
9
+ src/ons_mkdocs_theme.egg-info/dependency_links.txt
10
+ src/ons_mkdocs_theme.egg-info/entry_points.txt
11
+ src/ons_mkdocs_theme.egg-info/requires.txt
12
+ src/ons_mkdocs_theme.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [mkdocs.themes]
2
+ ons-mkdocs-theme = src
@@ -0,0 +1,2 @@
1
+ mkdocs>=1.6
2
+ mkdocs-material>=9.5