wordpress-markdown-blog-loader 1.4.2__tar.gz → 1.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.
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/PKG-INFO +21 -19
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/README.md +20 -18
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/setup.py +1 -1
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/api.py +19 -9
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/blog.py +8 -1
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader.egg-info/PKG-INFO +21 -19
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/LICENSE +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/setup.cfg +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/__init__.py +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/__main__.py +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/check_links.py +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/download.py +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/name_to_email.py +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/new.py +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/remove_newlines.py +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader/upload.py +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader.egg-info/SOURCES.txt +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader.egg-info/dependency_links.txt +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader.egg-info/entry_points.txt +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader.egg-info/not-zip-safe +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader.egg-info/requires.txt +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/src/wordpress_markdown_blog_loader.egg-info/top_level.txt +0 -0
- {wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/tests/test_blog.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: wordpress-markdown-blog-loader
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: load markdown blogs into wordpress
|
|
5
5
|
Home-page: https://github.com/binxio/wordpress-markdown-blog-loader
|
|
6
6
|
Author: Mark van Holsteijn
|
|
@@ -113,7 +113,7 @@ alias wp-md='docker run \
|
|
|
113
113
|
-v $HOME:$HOME \
|
|
114
114
|
-v $HOME/.wordpress.ini:/root/.wordpress.ini \
|
|
115
115
|
-v $PWD:/$PWD \
|
|
116
|
-
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.
|
|
116
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.5.0
|
|
117
117
|
```'
|
|
118
118
|
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
119
119
|
|
|
@@ -137,23 +137,25 @@ A skaffold frontmatter blog is created, and you can start writing in the index.m
|
|
|
137
137
|
## frontmatter properties
|
|
138
138
|
You can set the following properties in the frontmatter:
|
|
139
139
|
|
|
140
|
-
| Name | description
|
|
141
|
-
|
|
142
|
-
| title | of the blog
|
|
143
|
-
| subtitle | of the blog, used in the og.image
|
|
144
|
-
| focus-keywords | the SEO focus keywords
|
|
145
|
-
| excerpt | excerpt of the blog
|
|
146
|
-
| author | display name of the author in Wordpress
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
140
|
+
| Name | description |
|
|
141
|
+
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
142
|
+
| title | of the blog |
|
|
143
|
+
| subtitle | of the blog, used in the og.image |
|
|
144
|
+
| focus-keywords | the SEO focus keywords
|
|
145
|
+
| excerpt | excerpt of the blog |
|
|
146
|
+
| author | display name of the author in Wordpress |
|
|
147
|
+
| email | email address of the author, used to lookup profile picture on gravatar.com |
|
|
148
|
+
| author-id | Wordpress author slug: used to select the appropriate user if multiple users with the same name exists in WP and we cannot read the email address |
|
|
149
|
+
| categories | list of wordpress categories for this blog |
|
|
150
|
+
| slug | slug of the blog |
|
|
151
|
+
| date | on which the blog should be published ISO timestamp format |
|
|
152
|
+
| status | draft or publish. if publish, the blog will be published on the `date` |
|
|
153
|
+
| canonical | url of the blog, to be used in cross posts |
|
|
154
|
+
| image | the banner image of the blog |
|
|
155
|
+
| og.image | the open graph image of the blog, used in links from social media |
|
|
156
|
+
| og.description | the open graph description of the blog, used in links from social media |
|
|
157
|
+
| guid | the physical URL of the blog. Written by wp-md on upload and download |
|
|
158
|
+
| brand | xebia.com or xebia.com. defaults to xebia.com |
|
|
157
159
|
|
|
158
160
|
|
|
159
161
|
## adding images
|
|
@@ -67,7 +67,7 @@ alias wp-md='docker run \
|
|
|
67
67
|
-v $HOME:$HOME \
|
|
68
68
|
-v $HOME/.wordpress.ini:/root/.wordpress.ini \
|
|
69
69
|
-v $PWD:/$PWD \
|
|
70
|
-
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.
|
|
70
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.5.0
|
|
71
71
|
```'
|
|
72
72
|
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
73
73
|
|
|
@@ -91,23 +91,25 @@ A skaffold frontmatter blog is created, and you can start writing in the index.m
|
|
|
91
91
|
## frontmatter properties
|
|
92
92
|
You can set the following properties in the frontmatter:
|
|
93
93
|
|
|
94
|
-
| Name | description
|
|
95
|
-
|
|
96
|
-
| title | of the blog
|
|
97
|
-
| subtitle | of the blog, used in the og.image
|
|
98
|
-
| focus-keywords | the SEO focus keywords
|
|
99
|
-
| excerpt | excerpt of the blog
|
|
100
|
-
| author | display name of the author in Wordpress
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
94
|
+
| Name | description |
|
|
95
|
+
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
96
|
+
| title | of the blog |
|
|
97
|
+
| subtitle | of the blog, used in the og.image |
|
|
98
|
+
| focus-keywords | the SEO focus keywords
|
|
99
|
+
| excerpt | excerpt of the blog |
|
|
100
|
+
| author | display name of the author in Wordpress |
|
|
101
|
+
| email | email address of the author, used to lookup profile picture on gravatar.com |
|
|
102
|
+
| author-id | Wordpress author slug: used to select the appropriate user if multiple users with the same name exists in WP and we cannot read the email address |
|
|
103
|
+
| categories | list of wordpress categories for this blog |
|
|
104
|
+
| slug | slug of the blog |
|
|
105
|
+
| date | on which the blog should be published ISO timestamp format |
|
|
106
|
+
| status | draft or publish. if publish, the blog will be published on the `date` |
|
|
107
|
+
| canonical | url of the blog, to be used in cross posts |
|
|
108
|
+
| image | the banner image of the blog |
|
|
109
|
+
| og.image | the open graph image of the blog, used in links from social media |
|
|
110
|
+
| og.description | the open graph description of the blog, used in links from social media |
|
|
111
|
+
| guid | the physical URL of the blog. Written by wp-md on upload and download |
|
|
112
|
+
| brand | xebia.com or xebia.com. defaults to xebia.com |
|
|
111
113
|
|
|
112
114
|
|
|
113
115
|
## adding images
|
|
@@ -27,7 +27,7 @@ with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
|
|
|
27
27
|
|
|
28
28
|
setup(
|
|
29
29
|
name="wordpress-markdown-blog-loader",
|
|
30
|
-
version="1.
|
|
30
|
+
version="1.5.0",
|
|
31
31
|
url="https://github.com/binxio/wordpress-markdown-blog-loader",
|
|
32
32
|
license="APL2",
|
|
33
33
|
author="Mark van Holsteijn",
|
|
@@ -127,6 +127,10 @@ class User(dict):
|
|
|
127
127
|
def email(self):
|
|
128
128
|
return self.get("email")
|
|
129
129
|
|
|
130
|
+
@property
|
|
131
|
+
def slug(self):
|
|
132
|
+
return self.get("slug")
|
|
133
|
+
|
|
130
134
|
|
|
131
135
|
class Medium(dict):
|
|
132
136
|
def __init__(self, properties: dict):
|
|
@@ -322,7 +326,7 @@ class Wordpress(object):
|
|
|
322
326
|
def get_user_by_id(self, resource_id: int) -> "User":
|
|
323
327
|
return User(self.get("users", resource_id))
|
|
324
328
|
|
|
325
|
-
def get_unique_user_by_name(self, name: str, email: Optional[str]) -> "User":
|
|
329
|
+
def get_unique_user_by_name(self, name: str, email: Optional[str], author_id: Optional[str]) -> "User":
|
|
326
330
|
|
|
327
331
|
user = self.get_user_by_id("me")
|
|
328
332
|
if user and user.name == name:
|
|
@@ -335,19 +339,25 @@ class Wordpress(object):
|
|
|
335
339
|
# See: https://developer.wordpress.org/rest-api/reference/users/
|
|
336
340
|
users = self.users({"search": name, "context": "edit"})
|
|
337
341
|
except PermissionDenied as error:
|
|
338
|
-
logging.
|
|
339
|
-
|
|
342
|
+
logging.warning("Permission denied to read user email addresses")
|
|
343
|
+
users = self.users({"search": name})
|
|
340
344
|
|
|
341
345
|
if len(users) == 0:
|
|
342
346
|
raise ValueError(f"author '{name}' not found on {self.endpoint.host}")
|
|
343
|
-
elif len(users)
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
elif len(users) == 1:
|
|
348
|
+
return users[0]
|
|
349
|
+
|
|
350
|
+
user = next(filter(lambda u: (author_id and u.slug == author_id) or (not author_id and email and u.email and u.email.lower() == email.lower()), users), None)
|
|
351
|
+
if not user:
|
|
352
|
+
if author_id:
|
|
346
353
|
raise ValueError(
|
|
347
|
-
f"Multiple authors named '{name}' found, none with
|
|
354
|
+
f"Multiple authors named '{name}' found, none with author id {author_id} (possible: { {u.slug for u in users} })."
|
|
348
355
|
)
|
|
349
|
-
|
|
350
|
-
|
|
356
|
+
else:
|
|
357
|
+
raise ValueError(
|
|
358
|
+
f"Multiple authors named '{name}' found, but none with email {email} (possible: { {u.email for u in users} })."
|
|
359
|
+
)
|
|
360
|
+
return user
|
|
351
361
|
|
|
352
362
|
def posts(self, query: dict = None) -> Iterator["Post"]:
|
|
353
363
|
for p in self.get_all("posts", query):
|
|
@@ -95,6 +95,13 @@ class Blog(object):
|
|
|
95
95
|
def author(self):
|
|
96
96
|
return self.blog.metadata.get("author")
|
|
97
97
|
|
|
98
|
+
@property
|
|
99
|
+
def author_id(self):
|
|
100
|
+
""" useful of the author has multiple user accounts on WP and we are not allowed to read
|
|
101
|
+
user's email addresses.
|
|
102
|
+
"""
|
|
103
|
+
return self.blog.metadata.get("author-id")
|
|
104
|
+
|
|
98
105
|
@author.setter
|
|
99
106
|
def author(self, author):
|
|
100
107
|
self.blog.metadata["author"] = author
|
|
@@ -353,7 +360,7 @@ class Blog(object):
|
|
|
353
360
|
self.uploaded_images[filename] = wp.upload_media(slug, path)
|
|
354
361
|
|
|
355
362
|
def to_wordpress(self, wp: Wordpress) -> dict:
|
|
356
|
-
author = wp.get_unique_user_by_name(self.author, self.email)
|
|
363
|
+
author = wp.get_unique_user_by_name(self.author, self.email, self.author_id)
|
|
357
364
|
self.upload_local_images(wp)
|
|
358
365
|
result = {
|
|
359
366
|
"title": self.title,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: wordpress-markdown-blog-loader
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: load markdown blogs into wordpress
|
|
5
5
|
Home-page: https://github.com/binxio/wordpress-markdown-blog-loader
|
|
6
6
|
Author: Mark van Holsteijn
|
|
@@ -113,7 +113,7 @@ alias wp-md='docker run \
|
|
|
113
113
|
-v $HOME:$HOME \
|
|
114
114
|
-v $HOME/.wordpress.ini:/root/.wordpress.ini \
|
|
115
115
|
-v $PWD:/$PWD \
|
|
116
|
-
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.
|
|
116
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.5.0
|
|
117
117
|
```'
|
|
118
118
|
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
119
119
|
|
|
@@ -137,23 +137,25 @@ A skaffold frontmatter blog is created, and you can start writing in the index.m
|
|
|
137
137
|
## frontmatter properties
|
|
138
138
|
You can set the following properties in the frontmatter:
|
|
139
139
|
|
|
140
|
-
| Name | description
|
|
141
|
-
|
|
142
|
-
| title | of the blog
|
|
143
|
-
| subtitle | of the blog, used in the og.image
|
|
144
|
-
| focus-keywords | the SEO focus keywords
|
|
145
|
-
| excerpt | excerpt of the blog
|
|
146
|
-
| author | display name of the author in Wordpress
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
140
|
+
| Name | description |
|
|
141
|
+
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
142
|
+
| title | of the blog |
|
|
143
|
+
| subtitle | of the blog, used in the og.image |
|
|
144
|
+
| focus-keywords | the SEO focus keywords
|
|
145
|
+
| excerpt | excerpt of the blog |
|
|
146
|
+
| author | display name of the author in Wordpress |
|
|
147
|
+
| email | email address of the author, used to lookup profile picture on gravatar.com |
|
|
148
|
+
| author-id | Wordpress author slug: used to select the appropriate user if multiple users with the same name exists in WP and we cannot read the email address |
|
|
149
|
+
| categories | list of wordpress categories for this blog |
|
|
150
|
+
| slug | slug of the blog |
|
|
151
|
+
| date | on which the blog should be published ISO timestamp format |
|
|
152
|
+
| status | draft or publish. if publish, the blog will be published on the `date` |
|
|
153
|
+
| canonical | url of the blog, to be used in cross posts |
|
|
154
|
+
| image | the banner image of the blog |
|
|
155
|
+
| og.image | the open graph image of the blog, used in links from social media |
|
|
156
|
+
| og.description | the open graph description of the blog, used in links from social media |
|
|
157
|
+
| guid | the physical URL of the blog. Written by wp-md on upload and download |
|
|
158
|
+
| brand | xebia.com or xebia.com. defaults to xebia.com |
|
|
157
159
|
|
|
158
160
|
|
|
159
161
|
## adding images
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wordpress_markdown_blog_loader-1.4.2 → wordpress_markdown_blog_loader-1.5.0}/tests/test_blog.py
RENAMED
|
File without changes
|