wordpress-markdown-blog-loader 1.3.3__tar.gz → 1.4.2__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.3.3 → wordpress_markdown_blog_loader-1.4.2}/PKG-INFO +15 -5
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/README.md +3 -3
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/setup.py +1 -1
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/api.py +15 -11
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/blog.py +9 -9
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/upload.py +6 -3
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader.egg-info/PKG-INFO +15 -5
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/LICENSE +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/setup.cfg +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/__init__.py +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/__main__.py +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/check_links.py +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/download.py +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/name_to_email.py +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/new.py +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader/remove_newlines.py +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader.egg-info/SOURCES.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader.egg-info/dependency_links.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader.egg-info/entry_points.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader.egg-info/not-zip-safe +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader.egg-info/requires.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/src/wordpress_markdown_blog_loader.egg-info/top_level.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.3 → wordpress_markdown_blog_loader-1.4.2}/tests/test_blog.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: wordpress-markdown-blog-loader
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.2
|
|
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
|
|
@@ -33,6 +33,16 @@ Requires-Dist: lxml
|
|
|
33
33
|
Requires-Dist: python-slugify
|
|
34
34
|
Requires-Dist: unidecode
|
|
35
35
|
Requires-Dist: stopwords
|
|
36
|
+
Dynamic: author
|
|
37
|
+
Dynamic: author-email
|
|
38
|
+
Dynamic: classifier
|
|
39
|
+
Dynamic: description
|
|
40
|
+
Dynamic: description-content-type
|
|
41
|
+
Dynamic: home-page
|
|
42
|
+
Dynamic: license
|
|
43
|
+
Dynamic: platform
|
|
44
|
+
Dynamic: requires-dist
|
|
45
|
+
Dynamic: summary
|
|
36
46
|
|
|
37
47
|
# wordpress-markdown-blog-loader
|
|
38
48
|
This utility loads markdown blogs into Wordpress as a post. It allows you to work on your blog
|
|
@@ -42,7 +52,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
42
52
|
- converts markdown into plain html, with syntax hightlighting support
|
|
43
53
|
- uploads and synchronizes any locally referenced images
|
|
44
54
|
- generates an opengraph image including the title, subtitle and author in Binx.io or xebia.com style
|
|
45
|
-
- sets the
|
|
55
|
+
- sets the Rankmath focus keywords
|
|
46
56
|
- sets the canonical url, if specified
|
|
47
57
|
|
|
48
58
|
## caveats
|
|
@@ -52,7 +62,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
52
62
|
|
|
53
63
|
## required Wordpress Plugins
|
|
54
64
|
|
|
55
|
-
- [
|
|
65
|
+
- [Rankmath](https://rankmath.com/wordpress/plugin/seo-suite)
|
|
56
66
|
- [REST API Meta Support](https://wordpress.org/plugins/rest-api-meta-support/)
|
|
57
67
|
|
|
58
68
|
Furthermore, you have to enable the Rest API for the [Custom Field Group](https://www.advancedcustomfields.com/resources/wp-rest-api-integration/#enabling-the-rest-api-for-your-acf-fields) for the field `show_header_image`.
|
|
@@ -103,7 +113,7 @@ alias wp-md='docker run \
|
|
|
103
113
|
-v $HOME:$HOME \
|
|
104
114
|
-v $HOME/.wordpress.ini:/root/.wordpress.ini \
|
|
105
115
|
-v $PWD:/$PWD \
|
|
106
|
-
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.
|
|
116
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.4.2
|
|
107
117
|
```'
|
|
108
118
|
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
109
119
|
|
|
@@ -6,7 +6,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
6
6
|
- converts markdown into plain html, with syntax hightlighting support
|
|
7
7
|
- uploads and synchronizes any locally referenced images
|
|
8
8
|
- generates an opengraph image including the title, subtitle and author in Binx.io or xebia.com style
|
|
9
|
-
- sets the
|
|
9
|
+
- sets the Rankmath focus keywords
|
|
10
10
|
- sets the canonical url, if specified
|
|
11
11
|
|
|
12
12
|
## caveats
|
|
@@ -16,7 +16,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
16
16
|
|
|
17
17
|
## required Wordpress Plugins
|
|
18
18
|
|
|
19
|
-
- [
|
|
19
|
+
- [Rankmath](https://rankmath.com/wordpress/plugin/seo-suite)
|
|
20
20
|
- [REST API Meta Support](https://wordpress.org/plugins/rest-api-meta-support/)
|
|
21
21
|
|
|
22
22
|
Furthermore, you have to enable the Rest API for the [Custom Field Group](https://www.advancedcustomfields.com/resources/wp-rest-api-integration/#enabling-the-rest-api-for-your-acf-fields) for the field `show_header_image`.
|
|
@@ -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.4.2
|
|
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
|
|
|
@@ -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.4.2",
|
|
31
31
|
url="https://github.com/binxio/wordpress-markdown-blog-loader",
|
|
32
32
|
license="APL2",
|
|
33
33
|
author="Mark van Holsteijn",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import configparser
|
|
2
|
+
import json
|
|
2
3
|
import logging
|
|
3
4
|
import mimetypes
|
|
4
5
|
import os
|
|
5
6
|
import re
|
|
7
|
+
import sys
|
|
6
8
|
from datetime import datetime
|
|
7
9
|
from functools import cache
|
|
8
10
|
from os.path import expanduser
|
|
@@ -238,16 +240,15 @@ class Post(dict):
|
|
|
238
240
|
"""
|
|
239
241
|
returns urls to the og:image links
|
|
240
242
|
"""
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
)
|
|
243
|
+
result = []
|
|
244
|
+
for name in ["rank_math_facebook_image", "rank_math_facebook_image"]:
|
|
245
|
+
if image := post.get("meta", {}).get(name):
|
|
246
|
+
result.append(image)
|
|
247
|
+
return result
|
|
247
248
|
|
|
248
249
|
@property
|
|
249
250
|
def og_description(self) -> Optional[str]:
|
|
250
|
-
return self.get("
|
|
251
|
+
return self.get("meta", {}).get("rank_math_twitter_description")
|
|
251
252
|
|
|
252
253
|
@property
|
|
253
254
|
def permalink_template(self) -> Optional[str]:
|
|
@@ -330,7 +331,9 @@ class Wordpress(object):
|
|
|
330
331
|
|
|
331
332
|
users = []
|
|
332
333
|
try:
|
|
333
|
-
|
|
334
|
+
# The email field is only returned when the context edit is passed.
|
|
335
|
+
# See: https://developer.wordpress.org/rest-api/reference/users/
|
|
336
|
+
users = self.users({"search": name, "context": "edit"})
|
|
334
337
|
except PermissionDenied as error:
|
|
335
338
|
logging.error("You have no permission to search for other users.\n Make sure your author name '%s' matches your WP display name '%s' or visa versa", name, user.name)
|
|
336
339
|
exit(1)
|
|
@@ -338,11 +341,12 @@ class Wordpress(object):
|
|
|
338
341
|
if len(users) == 0:
|
|
339
342
|
raise ValueError(f"author '{name}' not found on {self.endpoint.host}")
|
|
340
343
|
elif len(users) > 1:
|
|
341
|
-
user = next(filter(lambda u: email and u.email == email, users), None)
|
|
344
|
+
user = next(filter(lambda u: email and u.email and u.email.lower() == email.lower(), users), None)
|
|
342
345
|
if not user:
|
|
343
346
|
raise ValueError(
|
|
344
|
-
f"Multiple authors named '{name}' found, none with email {email}"
|
|
347
|
+
f"Multiple authors named '{name}' found, none with email {email} (possible: { {u.email for u in users} })."
|
|
345
348
|
)
|
|
349
|
+
return user
|
|
346
350
|
return users[0]
|
|
347
351
|
|
|
348
352
|
def posts(self, query: dict = None) -> Iterator["Post"]:
|
|
@@ -546,4 +550,4 @@ class Wordpress(object):
|
|
|
546
550
|
"invalid tag '{}' try one of\n {}".format(
|
|
547
551
|
tag, ",\n ".join(self.tags.keys())
|
|
548
552
|
)
|
|
549
|
-
)
|
|
553
|
+
)
|
|
@@ -74,15 +74,16 @@ class Blog(object):
|
|
|
74
74
|
@property
|
|
75
75
|
def focus_keywords(self):
|
|
76
76
|
"""
|
|
77
|
-
|
|
77
|
+
Keywords to determine SEO effectiveness. Can only be uploaded, not
|
|
78
78
|
retrieved. You just gotto love WP 😬
|
|
79
79
|
"""
|
|
80
80
|
return self.blog.metadata.get("focus-keywords")
|
|
81
81
|
|
|
82
|
+
|
|
82
83
|
@focus_keywords.setter
|
|
83
84
|
def focus_keywords(self, value):
|
|
84
85
|
if value:
|
|
85
|
-
self.blog.metadata["focus-keywords"] = value
|
|
86
|
+
self.blog.metadata["focus-keywords"] = " ".join(value) if isinstance(value, list) else value
|
|
86
87
|
else:
|
|
87
88
|
self.blog.metadata.pop("focus-keywords", "")
|
|
88
89
|
|
|
@@ -379,16 +380,15 @@ class Blog(object):
|
|
|
379
380
|
|
|
380
381
|
metadesc = self.og_description if self.og_description else self.excerpt
|
|
381
382
|
result["meta"] = {
|
|
382
|
-
"
|
|
383
|
-
"
|
|
384
|
-
"yoast_wpseo_twitter-description": metadesc,
|
|
383
|
+
"rank_math_facebook_description": metadesc,
|
|
384
|
+
"rank_math_twitter_description": metadesc,
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
if self.canonical:
|
|
388
|
-
result["meta"]["
|
|
388
|
+
result["meta"]["rank_math_canonical_url"] = self.canonical
|
|
389
389
|
|
|
390
390
|
if self.focus_keywords:
|
|
391
|
-
result["meta"]["
|
|
391
|
+
result["meta"]["rank_math_focus_keyword"] = ','.join(self.focus_keywords.split())
|
|
392
392
|
|
|
393
393
|
return result
|
|
394
394
|
|
|
@@ -421,8 +421,8 @@ class Blog(object):
|
|
|
421
421
|
blog.slug = post.slug
|
|
422
422
|
blog.status = post.status
|
|
423
423
|
blog.brand = wordpress.endpoint.host
|
|
424
|
-
blog.canonical = post.get("
|
|
425
|
-
"
|
|
424
|
+
blog.canonical = post.get("meta", {}).get(
|
|
425
|
+
"rank_math_canonical_url", blog.canonical
|
|
426
426
|
)
|
|
427
427
|
|
|
428
428
|
if post.permalink_template and not blog.permalink_template:
|
|
@@ -39,16 +39,19 @@ def upsert_post(wp: Wordpress, blog: Blog) -> int:
|
|
|
39
39
|
|
|
40
40
|
if blog.og_image:
|
|
41
41
|
og_image = wp.upload_media(f"{blog.slug}-og-banner", blog.og_image_path)
|
|
42
|
-
post_og_images =
|
|
42
|
+
post_og_images = []
|
|
43
|
+
for name in ["rank_math_facebook_image","rank_math_facebook_image"]:
|
|
44
|
+
post_og_images.append(post.get("meta", {}).get(name))
|
|
43
45
|
if not next(
|
|
44
|
-
filter(lambda b: b.get("url") == og_image.url, post_og_images), None
|
|
46
|
+
filter(lambda b: b and b.get("url") == og_image.url, post_og_images), None
|
|
45
47
|
):
|
|
46
48
|
logging.info("updating opengraph image to %s", og_image.url)
|
|
47
49
|
updated_post = wp.update_post(
|
|
48
50
|
blog.guid,
|
|
49
51
|
{
|
|
50
52
|
"meta": {
|
|
51
|
-
"
|
|
53
|
+
"rank_math_facebook_image": og_image.url,
|
|
54
|
+
"rank_math_twitter_image": og_image.url,
|
|
52
55
|
}
|
|
53
56
|
},
|
|
54
57
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: wordpress-markdown-blog-loader
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.2
|
|
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
|
|
@@ -33,6 +33,16 @@ Requires-Dist: lxml
|
|
|
33
33
|
Requires-Dist: python-slugify
|
|
34
34
|
Requires-Dist: unidecode
|
|
35
35
|
Requires-Dist: stopwords
|
|
36
|
+
Dynamic: author
|
|
37
|
+
Dynamic: author-email
|
|
38
|
+
Dynamic: classifier
|
|
39
|
+
Dynamic: description
|
|
40
|
+
Dynamic: description-content-type
|
|
41
|
+
Dynamic: home-page
|
|
42
|
+
Dynamic: license
|
|
43
|
+
Dynamic: platform
|
|
44
|
+
Dynamic: requires-dist
|
|
45
|
+
Dynamic: summary
|
|
36
46
|
|
|
37
47
|
# wordpress-markdown-blog-loader
|
|
38
48
|
This utility loads markdown blogs into Wordpress as a post. It allows you to work on your blog
|
|
@@ -42,7 +52,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
42
52
|
- converts markdown into plain html, with syntax hightlighting support
|
|
43
53
|
- uploads and synchronizes any locally referenced images
|
|
44
54
|
- generates an opengraph image including the title, subtitle and author in Binx.io or xebia.com style
|
|
45
|
-
- sets the
|
|
55
|
+
- sets the Rankmath focus keywords
|
|
46
56
|
- sets the canonical url, if specified
|
|
47
57
|
|
|
48
58
|
## caveats
|
|
@@ -52,7 +62,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
52
62
|
|
|
53
63
|
## required Wordpress Plugins
|
|
54
64
|
|
|
55
|
-
- [
|
|
65
|
+
- [Rankmath](https://rankmath.com/wordpress/plugin/seo-suite)
|
|
56
66
|
- [REST API Meta Support](https://wordpress.org/plugins/rest-api-meta-support/)
|
|
57
67
|
|
|
58
68
|
Furthermore, you have to enable the Rest API for the [Custom Field Group](https://www.advancedcustomfields.com/resources/wp-rest-api-integration/#enabling-the-rest-api-for-your-acf-fields) for the field `show_header_image`.
|
|
@@ -103,7 +113,7 @@ alias wp-md='docker run \
|
|
|
103
113
|
-v $HOME:$HOME \
|
|
104
114
|
-v $HOME/.wordpress.ini:/root/.wordpress.ini \
|
|
105
115
|
-v $PWD:/$PWD \
|
|
106
|
-
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.
|
|
116
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.4.2
|
|
107
117
|
```'
|
|
108
118
|
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
109
119
|
|
|
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.3.3 → wordpress_markdown_blog_loader-1.4.2}/tests/test_blog.py
RENAMED
|
File without changes
|