md2api 0.4.2__tar.gz → 0.5.0__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.
md2api-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: md2api
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary:
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: sumeshi
|
|
7
|
+
Author-email: sum3sh1@protonmail.com
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Requires-Dist: GitPython (>=3.1.43,<4.0.0)
|
|
14
|
+
Requires-Dist: markdown (>=3.6,<4.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "md2api"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.0"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["sumeshi <sum3sh1@protonmail.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -9,9 +9,9 @@ license = "MIT"
|
|
|
9
9
|
md2api = 'md2api.run:main'
|
|
10
10
|
|
|
11
11
|
[tool.poetry.dependencies]
|
|
12
|
-
python = "^3.
|
|
13
|
-
markdown = "^3.
|
|
14
|
-
GitPython = "^3.1.
|
|
12
|
+
python = "^3.11"
|
|
13
|
+
markdown = "^3.6"
|
|
14
|
+
GitPython = "^3.1.43"
|
|
15
15
|
|
|
16
16
|
[tool.poetry.dev-dependencies]
|
|
17
17
|
|
|
@@ -99,6 +99,41 @@ def create_posts_index(output_path: Path, documents: list[Document]):
|
|
|
99
99
|
document_path = index_path / Path('index.html')
|
|
100
100
|
document_path.write_text(json.dumps(sorted([index._asdict() for index in indices], key=lambda i: i.get('published_at'))))
|
|
101
101
|
|
|
102
|
+
def create_category_index(output_path: Path, documents: list[Document]):
|
|
103
|
+
index_path = output_path / Path('posts')
|
|
104
|
+
|
|
105
|
+
indices: list[Index] = [
|
|
106
|
+
Index(
|
|
107
|
+
title=document.title,
|
|
108
|
+
heading=document.heading,
|
|
109
|
+
path='/' + str(Path('posts') / document.path),
|
|
110
|
+
description=extract_description(document.html_text),
|
|
111
|
+
published_at=document.published_at
|
|
112
|
+
)for document in documents
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
category_names = dict()
|
|
116
|
+
|
|
117
|
+
for document in documents:
|
|
118
|
+
category_name = document.path.split('/')[0]
|
|
119
|
+
postIndex = Index(
|
|
120
|
+
title=document.title,
|
|
121
|
+
heading=document.heading,
|
|
122
|
+
path='/' + str(Path('posts') / document.path),
|
|
123
|
+
description=extract_description(document.html_text),
|
|
124
|
+
published_at=document.published_at
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
if category_name not in category_names.keys():
|
|
128
|
+
category_names[category_name] = [postIndex]
|
|
129
|
+
else:
|
|
130
|
+
category_names[category_name] = category_names[category_name].append(postIndex)
|
|
131
|
+
|
|
132
|
+
for category, posts in category_names.items():
|
|
133
|
+
document_path = index_path / Path(category) / Path('index.html')
|
|
134
|
+
document_path.write_text(json.dumps(sorted([post._asdict() for post in posts], key=lambda i: i.get('published_at'))))
|
|
135
|
+
# print(json.dumps(sorted([index._asdict() for category_name in category_names], key=lambda i: i.get('published_at'))))
|
|
136
|
+
|
|
102
137
|
|
|
103
138
|
def create_sitemap_xml(output_path: Path, site_url: str, post_dir: str, pages: list[Document]) -> str:
|
|
104
139
|
urlset = ElementTree.Element('urlset')
|
|
@@ -147,6 +182,7 @@ def main():
|
|
|
147
182
|
|
|
148
183
|
create_posts(output_path=output_path, documents=documents)
|
|
149
184
|
create_posts_index(output_path=output_path, documents=documents)
|
|
185
|
+
create_category_index(output_path=output_path, documents=documents)
|
|
150
186
|
create_sitemap_xml(output_path=output_path, site_url=site_url, post_dir=post_dir, pages=documents)
|
|
151
187
|
|
|
152
188
|
|
md2api-0.4.2/PKG-INFO
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: md2api
|
|
3
|
-
Version: 0.4.2
|
|
4
|
-
Summary:
|
|
5
|
-
License: MIT
|
|
6
|
-
Author: sumeshi
|
|
7
|
-
Author-email: sum3sh1@protonmail.com
|
|
8
|
-
Requires-Python: >=3.9,<4.0
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Requires-Dist: GitPython (>=3.1.20,<4.0.0)
|
|
14
|
-
Requires-Dist: markdown (>=3.3.4,<4.0.0)
|
md2api-0.4.2/setup.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from setuptools import setup
|
|
3
|
-
|
|
4
|
-
package_dir = \
|
|
5
|
-
{'': 'src'}
|
|
6
|
-
|
|
7
|
-
packages = \
|
|
8
|
-
['md2api']
|
|
9
|
-
|
|
10
|
-
package_data = \
|
|
11
|
-
{'': ['*']}
|
|
12
|
-
|
|
13
|
-
install_requires = \
|
|
14
|
-
['GitPython>=3.1.20,<4.0.0', 'markdown>=3.3.4,<4.0.0']
|
|
15
|
-
|
|
16
|
-
entry_points = \
|
|
17
|
-
{'console_scripts': ['md2api = md2api.run:main']}
|
|
18
|
-
|
|
19
|
-
setup_kwargs = {
|
|
20
|
-
'name': 'md2api',
|
|
21
|
-
'version': '0.4.2',
|
|
22
|
-
'description': '',
|
|
23
|
-
'long_description': None,
|
|
24
|
-
'author': 'sumeshi',
|
|
25
|
-
'author_email': 'sum3sh1@protonmail.com',
|
|
26
|
-
'maintainer': None,
|
|
27
|
-
'maintainer_email': None,
|
|
28
|
-
'url': None,
|
|
29
|
-
'package_dir': package_dir,
|
|
30
|
-
'packages': packages,
|
|
31
|
-
'package_data': package_data,
|
|
32
|
-
'install_requires': install_requires,
|
|
33
|
-
'entry_points': entry_points,
|
|
34
|
-
'python_requires': '>=3.9,<4.0',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
setup(**setup_kwargs)
|
|
File without changes
|