wordpress-markdown-blog-loader 1.3.2__tar.gz → 1.4.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.
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/PKG-INFO +4 -4
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/README.md +3 -3
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/setup.py +1 -1
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/api.py +13 -11
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/blog.py +9 -9
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/upload.py +6 -3
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader.egg-info/PKG-INFO +4 -4
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/LICENSE +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/setup.cfg +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/__init__.py +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/__main__.py +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/check_links.py +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/download.py +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/name_to_email.py +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/new.py +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader/remove_newlines.py +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader.egg-info/SOURCES.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader.egg-info/dependency_links.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader.egg-info/entry_points.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader.egg-info/not-zip-safe +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader.egg-info/requires.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/src/wordpress_markdown_blog_loader.egg-info/top_level.txt +0 -0
- {wordpress_markdown_blog_loader-1.3.2 → wordpress_markdown_blog_loader-1.4.1}/tests/test_blog.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wordpress-markdown-blog-loader
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
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
|
|
@@ -42,7 +42,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
42
42
|
- converts markdown into plain html, with syntax hightlighting support
|
|
43
43
|
- uploads and synchronizes any locally referenced images
|
|
44
44
|
- generates an opengraph image including the title, subtitle and author in Binx.io or xebia.com style
|
|
45
|
-
- sets the
|
|
45
|
+
- sets the Rankmath focus keywords
|
|
46
46
|
- sets the canonical url, if specified
|
|
47
47
|
|
|
48
48
|
## caveats
|
|
@@ -52,7 +52,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
52
52
|
|
|
53
53
|
## required Wordpress Plugins
|
|
54
54
|
|
|
55
|
-
- [
|
|
55
|
+
- [Rankmath](https://rankmath.com/wordpress/plugin/seo-suite)
|
|
56
56
|
- [REST API Meta Support](https://wordpress.org/plugins/rest-api-meta-support/)
|
|
57
57
|
|
|
58
58
|
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 +103,7 @@ alias wp-md='docker run \
|
|
|
103
103
|
-v $HOME:$HOME \
|
|
104
104
|
-v $HOME/.wordpress.ini:/root/.wordpress.ini \
|
|
105
105
|
-v $PWD:/$PWD \
|
|
106
|
-
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.
|
|
106
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.4.1
|
|
107
107
|
```'
|
|
108
108
|
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
109
109
|
|
|
@@ -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.1
|
|
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.1",
|
|
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]:
|
|
@@ -269,7 +270,7 @@ class Wordpress(object):
|
|
|
269
270
|
self._media: List[Medium] = {}
|
|
270
271
|
self.headers = {
|
|
271
272
|
"accept": "application/json",
|
|
272
|
-
"User-Agent": "
|
|
273
|
+
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15",
|
|
273
274
|
}
|
|
274
275
|
self.session = requests.Session()
|
|
275
276
|
|
|
@@ -338,11 +339,12 @@ class Wordpress(object):
|
|
|
338
339
|
if len(users) == 0:
|
|
339
340
|
raise ValueError(f"author '{name}' not found on {self.endpoint.host}")
|
|
340
341
|
elif len(users) > 1:
|
|
341
|
-
user = next(filter(lambda u: email and u.email == email, users), None)
|
|
342
|
+
user = next(filter(lambda u: email and u.email and u.email.lower() == email.lower(), users), None)
|
|
342
343
|
if not user:
|
|
343
344
|
raise ValueError(
|
|
344
|
-
f"Multiple authors named '{name}' found, none with email {email}"
|
|
345
|
+
f"Multiple authors named '{name}' found, none with email {email} (possible: { {u.email for u in users} })."
|
|
345
346
|
)
|
|
347
|
+
return user
|
|
346
348
|
return users[0]
|
|
347
349
|
|
|
348
350
|
def posts(self, query: dict = None) -> Iterator["Post"]:
|
|
@@ -546,4 +548,4 @@ class Wordpress(object):
|
|
|
546
548
|
"invalid tag '{}' try one of\n {}".format(
|
|
547
549
|
tag, ",\n ".join(self.tags.keys())
|
|
548
550
|
)
|
|
549
|
-
)
|
|
551
|
+
)
|
|
@@ -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
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wordpress-markdown-blog-loader
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
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
|
|
@@ -42,7 +42,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
42
42
|
- converts markdown into plain html, with syntax hightlighting support
|
|
43
43
|
- uploads and synchronizes any locally referenced images
|
|
44
44
|
- generates an opengraph image including the title, subtitle and author in Binx.io or xebia.com style
|
|
45
|
-
- sets the
|
|
45
|
+
- sets the Rankmath focus keywords
|
|
46
46
|
- sets the canonical url, if specified
|
|
47
47
|
|
|
48
48
|
## caveats
|
|
@@ -52,7 +52,7 @@ in your favorite editor and keeps all your blogs in git.
|
|
|
52
52
|
|
|
53
53
|
## required Wordpress Plugins
|
|
54
54
|
|
|
55
|
-
- [
|
|
55
|
+
- [Rankmath](https://rankmath.com/wordpress/plugin/seo-suite)
|
|
56
56
|
- [REST API Meta Support](https://wordpress.org/plugins/rest-api-meta-support/)
|
|
57
57
|
|
|
58
58
|
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 +103,7 @@ alias wp-md='docker run \
|
|
|
103
103
|
-v $HOME:$HOME \
|
|
104
104
|
-v $HOME/.wordpress.ini:/root/.wordpress.ini \
|
|
105
105
|
-v $PWD:/$PWD \
|
|
106
|
-
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.
|
|
106
|
+
-w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.4.1
|
|
107
107
|
```'
|
|
108
108
|
Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
|
|
109
109
|
|
|
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.2 → wordpress_markdown_blog_loader-1.4.1}/tests/test_blog.py
RENAMED
|
File without changes
|