wordpress-markdown-blog-loader 1.7.4__tar.gz → 1.8.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.
Files changed (25) hide show
  1. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/PKG-INFO +19 -3
  2. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/README.md +18 -2
  3. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/pyproject.toml +1 -1
  4. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/api.py +1 -1
  5. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/blog.py +50 -2
  6. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/html_to_gutenberg.py +22 -0
  7. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader.egg-info/PKG-INFO +19 -3
  8. wordpress_markdown_blog_loader-1.8.0/tests/test_blog.py +52 -0
  9. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/tests/test_html_to_gutenberg.py +38 -0
  10. wordpress_markdown_blog_loader-1.7.4/tests/test_blog.py +0 -19
  11. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/LICENSE +0 -0
  12. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/setup.cfg +0 -0
  13. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/__init__.py +0 -0
  14. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/__main__.py +0 -0
  15. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/check_links.py +0 -0
  16. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/download.py +0 -0
  17. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/name_to_email.py +0 -0
  18. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/new.py +0 -0
  19. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/remove_newlines.py +0 -0
  20. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader/upload.py +0 -0
  21. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader.egg-info/SOURCES.txt +0 -0
  22. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader.egg-info/dependency_links.txt +0 -0
  23. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader.egg-info/entry_points.txt +0 -0
  24. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader.egg-info/requires.txt +0 -0
  25. {wordpress_markdown_blog_loader-1.7.4 → wordpress_markdown_blog_loader-1.8.0}/src/wordpress_markdown_blog_loader.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wordpress-markdown-blog-loader
3
- Version: 1.7.4
3
+ Version: 1.8.0
4
4
  Summary: load markdown blogs into wordpress
5
5
  Author-email: Mark van Holsteijn <markvanholsteijn@binx.io>
6
6
  License: APL2
@@ -56,6 +56,7 @@ in your favorite editor and keeps all your blogs in git.
56
56
  ## features
57
57
  - converts markdown into plain html, with syntax hightlighting support
58
58
  - uploads and synchronizes any locally referenced images
59
+ - embeds audio players from locally referenced sound files
59
60
  - generates an opengraph image including the title, subtitle and author in Binx.io or xebia.com style
60
61
  - sets the Rankmath focus keywords
61
62
  - sets the canonical url, if specified
@@ -101,7 +102,7 @@ We recommend to store your application password in 1password and set the enviro
101
102
  WP_APP_PASSWORD using the [1password CLI](https://developer.1password.com/docs/cli):
102
103
 
103
104
  ```shell
104
- WP_APP_PASSWORD="$(op read "op://Private/wordpress app password/password")" wp-md ...
105
+ WP_APP_PASSWORD="op://Private/wordpress app password/password" wp-md ...
105
106
  ```
106
107
 
107
108
  ## Never touch the WP editor again
@@ -119,7 +120,7 @@ alias wp-md='docker run \
119
120
  -v $HOME:$HOME \
120
121
  -v $HOME/.wordpress.ini:/root/.wordpress.ini \
121
122
  -v $PWD:/$PWD \
122
- -w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.7.4
123
+ -w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.8.0
123
124
  ```'
124
125
  Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
125
126
 
@@ -173,6 +174,21 @@ To add an image to your blog, add the images in the ./images subdirectory and ad
173
174
  ![](./images/architecture.png)
174
175
  ```
175
176
 
177
+ ## adding audio
178
+ To embed an audio player, add the sound file in a subdirectory (for example `./audio`)
179
+ and add an `::: audio` directive on its own line, with a relative reference. For instance:
180
+
181
+ ```markdown
182
+ ## Listen to this section
183
+
184
+ ::: audio ./audio/section-one.mp3
185
+ ```
186
+
187
+ The sound file is uploaded and synchronized just like an image, and rendered as a native
188
+ Wordpress audio block (a player with controls) at that position. Drop one directive under
189
+ each heading to give every section its own player. Remote URLs (`https://...`) are embedded
190
+ as-is without uploading.
191
+
176
192
  ## uploading a blog
177
193
  To upload a blog, type:
178
194
 
@@ -5,6 +5,7 @@ in your favorite editor and keeps all your blogs in git.
5
5
  ## features
6
6
  - converts markdown into plain html, with syntax hightlighting support
7
7
  - uploads and synchronizes any locally referenced images
8
+ - embeds audio players from locally referenced sound files
8
9
  - generates an opengraph image including the title, subtitle and author in Binx.io or xebia.com style
9
10
  - sets the Rankmath focus keywords
10
11
  - sets the canonical url, if specified
@@ -50,7 +51,7 @@ We recommend to store your application password in 1password and set the enviro
50
51
  WP_APP_PASSWORD using the [1password CLI](https://developer.1password.com/docs/cli):
51
52
 
52
53
  ```shell
53
- WP_APP_PASSWORD="$(op read "op://Private/wordpress app password/password")" wp-md ...
54
+ WP_APP_PASSWORD="op://Private/wordpress app password/password" wp-md ...
54
55
  ```
55
56
 
56
57
  ## Never touch the WP editor again
@@ -68,7 +69,7 @@ alias wp-md='docker run \
68
69
  -v $HOME:$HOME \
69
70
  -v $HOME/.wordpress.ini:/root/.wordpress.ini \
70
71
  -v $PWD:/$PWD \
71
- -w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.7.4
72
+ -w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.8.0
72
73
  ```'
73
74
  Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
74
75
 
@@ -122,6 +123,21 @@ To add an image to your blog, add the images in the ./images subdirectory and ad
122
123
  ![](./images/architecture.png)
123
124
  ```
124
125
 
126
+ ## adding audio
127
+ To embed an audio player, add the sound file in a subdirectory (for example `./audio`)
128
+ and add an `::: audio` directive on its own line, with a relative reference. For instance:
129
+
130
+ ```markdown
131
+ ## Listen to this section
132
+
133
+ ::: audio ./audio/section-one.mp3
134
+ ```
135
+
136
+ The sound file is uploaded and synchronized just like an image, and rendered as a native
137
+ Wordpress audio block (a player with controls) at that position. Drop one directive under
138
+ each heading to give every section its own player. Remote URLs (`https://...`) are embedded
139
+ as-is without uploading.
140
+
125
141
  ## uploading a blog
126
142
  To upload a blog, type:
127
143
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "wordpress-markdown-blog-loader"
7
- version = "1.7.4"
7
+ version = "1.8.0"
8
8
  authors = [{name = "Mark van Holsteijn", email = "markvanholsteijn@binx.io"}]
9
9
  license = {text = "APL2"}
10
10
  description = "load markdown blogs into wordpress"
@@ -650,7 +650,7 @@ class Wordpress(object):
650
650
  )
651
651
  )
652
652
 
653
- def get_capabilities_by_name(self, slug: str) -> str:
653
+ def get_capability_by_name(self, slug: str) -> str:
654
654
  if slug in self.capabilities:
655
655
  return self.capabilities[slug]
656
656
 
@@ -29,9 +29,14 @@ class Blog(object):
29
29
  self.path: Path = None
30
30
  self.blog: frontmatter.Post = frontmatter.Post(content="")
31
31
  self.uploaded_images: dict[str, Media] = {}
32
+ self.uploaded_audio: dict[str, Medium] = {}
32
33
  self.markdown_image_pattern = re.compile(
33
34
  r'\!\[(?P<alt_text>[^]]*)\]\((?P<url>.*?)(?P<caption>\s*"[^"]*?")?\)'
34
35
  )
36
+ # An audio player directive on its own line: `::: audio path/to/clip.mp3`
37
+ self.audio_directive_pattern = re.compile(
38
+ r"^[ \t]*:::[ \t]+audio[ \t]+(?P<url>\S+)[ \t]*$", re.MULTILINE
39
+ )
35
40
 
36
41
  @staticmethod
37
42
  def load(path: str) -> "Blog":
@@ -306,7 +311,19 @@ class Blog(object):
306
311
  return f"![{match.group('alt_text')}]({image.url}{caption})"
307
312
  return match.group(0)
308
313
 
314
+ def replace_audio_directive(match: re.Match):
315
+ url = match.group("url")
316
+ audio = self.uploaded_audio.get(url)
317
+ src = audio.url if audio else url
318
+ # raw block-level HTML; python-markdown passes it through untouched,
319
+ # and html_to_gutenberg turns it into a wp:audio block.
320
+ return (
321
+ f'<figure class="wp-block-audio">'
322
+ f'<audio controls src="{src}"></audio></figure>'
323
+ )
324
+
309
325
  content = self.markdown_image_pattern.sub(replace_references, self.content)
326
+ content = self.audio_directive_pattern.sub(replace_audio_directive, content)
310
327
  html = markdown(
311
328
  content, extensions=["fenced_code", "attr_list", "tables", "footnotes"],
312
329
  )
@@ -395,9 +412,41 @@ class Blog(object):
395
412
  slug = self.slug + "-" + re.sub(r"[/\.\\]+", "-", path.stem.strip("-"))
396
413
  self.uploaded_images[filename] = wp.upload_media(slug, path)
397
414
 
415
+ @property
416
+ def local_audio_references(self) -> set[str]:
417
+ """
418
+ Local audio files referenced by `::: audio <path>` directives.
419
+
420
+ >>> b = Blog()
421
+ >>> b.content = "## H\\n\\n::: audio images/clip.mp3\\n\\ntext\\n"
422
+ >>> sorted(b.local_audio_references)
423
+ ['images/clip.mp3']
424
+ """
425
+ return set(
426
+ filter(
427
+ lambda u: urlparse(u).scheme in ["", "file"],
428
+ map(
429
+ lambda m: m.group("url"),
430
+ re.finditer(self.audio_directive_pattern, self.content),
431
+ ),
432
+ )
433
+ )
434
+
435
+ def upload_local_audio(self, wp: Wordpress):
436
+ self.uploaded_audio = {}
437
+ for filename in self.local_audio_references:
438
+ path = Path(self.dir).joinpath(filename)
439
+ if not path.exists():
440
+ logging.warning("%s does not exist", path)
441
+ continue
442
+
443
+ slug = self.slug + "-" + re.sub(r"[/\.\\]+", "-", path.stem.strip("-"))
444
+ self.uploaded_audio[filename] = wp.upload_media(slug, path)
445
+
398
446
  def to_wordpress(self, wp: Wordpress) -> dict:
399
447
  author = wp.get_unique_user_by_name(self.author, self.email, self.author_id)
400
448
  self.upload_local_images(wp)
449
+ self.upload_local_audio(wp)
401
450
  result = {
402
451
  "title": self.title,
403
452
  "slug": self.slug,
@@ -409,12 +458,11 @@ class Blog(object):
409
458
  "status": self.status,
410
459
  "author": author.id,
411
460
  "categories": [wp.get_category_id_by_name(c) for c in self.categories],
412
- "capabilities": [wp.get_capability_id_by_name(c) for c in self.capabilities],
413
461
  "tags": [wp.get_tag_id_by_name(c) for c in self.tags],
414
462
  "acf": {"show_header_image": bool(self.image)},
415
463
  "industries_taxonomy": [wp.get_industry_by_name(c) for c in self.industries],
416
464
  "partners_taxonomy": [wp.get_partner_by_name(c) for c in self.partners],
417
- "capabilities": [wp.get_capabilities_by_name(c) for c in self.capabilities],
465
+ "capabilities": [wp.get_capability_by_name(c) for c in self.capabilities],
418
466
  }
419
467
  if self.permalink_template:
420
468
  result["permalink_template"] = self.permalink_template
@@ -14,6 +14,10 @@ def _wrap_in_gutenberg_comments(element):
14
14
  return _wrap_list(element)
15
15
  if element.name == "img":
16
16
  return _wrap_image(element)
17
+ if element.name == "figure" and "wp-block-audio" in element.get("class", []):
18
+ return _wrap_audio(element)
19
+ if element.name == "audio":
20
+ return _wrap_audio(element)
17
21
  if element.name == "blockquote":
18
22
  return _wrap_quote(element)
19
23
  return str(element)
@@ -86,6 +90,24 @@ def _wrap_image(element):
86
90
  return f"<!-- wp:image -->\n{str(element)}\n<!-- /wp:image -->"
87
91
 
88
92
 
93
+ def _wrap_audio(element):
94
+ """
95
+ Wrap an audio element in a wp:audio Gutenberg block. Accepts either a bare
96
+ <audio> tag or a <figure class="wp-block-audio"> already wrapping one, and
97
+ always emits the figure form Wordpress expects.
98
+
99
+ >>> from bs4 import BeautifulSoup
100
+ >>> soup = BeautifulSoup('<audio controls src="https://x/c.mp3"></audio>', "html.parser")
101
+ >>> _wrap_audio(soup.audio)
102
+ '<!-- wp:audio -->\\n<figure class="wp-block-audio"><audio controls="" src="https://x/c.mp3"></audio></figure>\\n<!-- /wp:audio -->'
103
+ """
104
+ audio = element if element.name == "audio" else element.find("audio")
105
+ figure = (
106
+ f'<figure class="wp-block-audio">{str(audio)}</figure>' if audio else str(element)
107
+ )
108
+ return f"<!-- wp:audio -->\n{figure}\n<!-- /wp:audio -->"
109
+
110
+
89
111
  def convert(title, html_body):
90
112
  soup = BeautifulSoup(html_body, "html.parser")
91
113
  blocks = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wordpress-markdown-blog-loader
3
- Version: 1.7.4
3
+ Version: 1.8.0
4
4
  Summary: load markdown blogs into wordpress
5
5
  Author-email: Mark van Holsteijn <markvanholsteijn@binx.io>
6
6
  License: APL2
@@ -56,6 +56,7 @@ in your favorite editor and keeps all your blogs in git.
56
56
  ## features
57
57
  - converts markdown into plain html, with syntax hightlighting support
58
58
  - uploads and synchronizes any locally referenced images
59
+ - embeds audio players from locally referenced sound files
59
60
  - generates an opengraph image including the title, subtitle and author in Binx.io or xebia.com style
60
61
  - sets the Rankmath focus keywords
61
62
  - sets the canonical url, if specified
@@ -101,7 +102,7 @@ We recommend to store your application password in 1password and set the enviro
101
102
  WP_APP_PASSWORD using the [1password CLI](https://developer.1password.com/docs/cli):
102
103
 
103
104
  ```shell
104
- WP_APP_PASSWORD="$(op read "op://Private/wordpress app password/password")" wp-md ...
105
+ WP_APP_PASSWORD="op://Private/wordpress app password/password" wp-md ...
105
106
  ```
106
107
 
107
108
  ## Never touch the WP editor again
@@ -119,7 +120,7 @@ alias wp-md='docker run \
119
120
  -v $HOME:$HOME \
120
121
  -v $HOME/.wordpress.ini:/root/.wordpress.ini \
121
122
  -v $PWD:/$PWD \
122
- -w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.7.4
123
+ -w $PWD ghcr.io/binxio/wordpress-markdown-blog-loader:1.8.0
123
124
  ```'
124
125
  Assuming that your WordPress app password is stored in the 1password Private vault under the name `wordpress app password`
125
126
 
@@ -173,6 +174,21 @@ To add an image to your blog, add the images in the ./images subdirectory and ad
173
174
  ![](./images/architecture.png)
174
175
  ```
175
176
 
177
+ ## adding audio
178
+ To embed an audio player, add the sound file in a subdirectory (for example `./audio`)
179
+ and add an `::: audio` directive on its own line, with a relative reference. For instance:
180
+
181
+ ```markdown
182
+ ## Listen to this section
183
+
184
+ ::: audio ./audio/section-one.mp3
185
+ ```
186
+
187
+ The sound file is uploaded and synchronized just like an image, and rendered as a native
188
+ Wordpress audio block (a player with controls) at that position. Drop one directive under
189
+ each heading to give every section its own player. Remote URLs (`https://...`) are embedded
190
+ as-is without uploading.
191
+
176
192
  ## uploading a blog
177
193
  To upload a blog, type:
178
194
 
@@ -0,0 +1,52 @@
1
+
2
+ import os
3
+ import unittest
4
+
5
+ from wordpress_markdown_blog_loader.blog import Blog
6
+
7
+ class Test_BlogRender(unittest.TestCase):
8
+ def test_tables(self):
9
+ path = os.path.join(os.path.dirname(__file__), "resources", "tables.md")
10
+ blog = Blog.load(path)
11
+ self.assertIsNotNone(blog.rendered)
12
+ self.assertIn('<table>', blog.rendered)
13
+ self.assertIn('<thead>', blog.rendered)
14
+ self.assertIn('<th>Col B</th>', blog.rendered)
15
+ self.assertIn('<tbody>', blog.rendered)
16
+ self.assertIn('<td style="text-align: left;">Hello</td>', blog.rendered)
17
+
18
+
19
+ class Test_AudioDirective(unittest.TestCase):
20
+ def _blog(self, content):
21
+ blog = Blog()
22
+ blog.title = "Audio post"
23
+ blog.content = content
24
+ return blog
25
+
26
+ def test_local_audio_references(self):
27
+ blog = self._blog(
28
+ "## One\n\n::: audio images/clips/a.mp3\n\ntext\n\n"
29
+ "## Two\n\n::: audio images/clips/b.wav\n\nmore\n"
30
+ )
31
+ self.assertEqual(
32
+ blog.local_audio_references,
33
+ {"images/clips/a.mp3", "images/clips/b.wav"},
34
+ )
35
+
36
+ def test_remote_audio_not_collected_as_local(self):
37
+ blog = self._blog("::: audio https://cdn.example.com/a.mp3\n")
38
+ self.assertEqual(blog.local_audio_references, set())
39
+
40
+ def test_rendered_directive_becomes_audio_block(self):
41
+ # without an uploaded URL it falls back to the raw path (local preview)
42
+ blog = self._blog("## Section\n\n::: audio images/clips/a.mp3\n\ntext\n")
43
+ rendered = blog.rendered
44
+ self.assertIn("<!-- wp:audio -->", rendered)
45
+ self.assertIn('<figure class="wp-block-audio">', rendered)
46
+ self.assertIn('src="images/clips/a.mp3"', rendered)
47
+ # the directive line must not leak through as a paragraph
48
+ self.assertNotIn("::: audio", rendered)
49
+
50
+
51
+ if __name__ == '__main__':
52
+ unittest.main()
@@ -8,6 +8,7 @@ from wordpress_markdown_blog_loader.html_to_gutenberg import (
8
8
  _wrap_pre,
9
9
  _wrap_list,
10
10
  _wrap_image,
11
+ _wrap_audio,
11
12
  _wrap_in_gutenberg_comments,
12
13
  _wrap_quote,
13
14
  convert,
@@ -77,6 +78,31 @@ class TestGutenbergWrapFunctions(unittest.TestCase):
77
78
  self.assertIn('<img alt="desc" src="img.png"/>', res)
78
79
  self.assertTrue(res.endswith("<!-- /wp:image -->"))
79
80
 
81
+ def test_wrap_audio_from_bare_tag(self):
82
+ soup = BeautifulSoup(
83
+ '<audio controls src="https://x/c.mp3"></audio>', "html.parser"
84
+ )
85
+ res = _wrap_audio(soup.audio)
86
+ self.assertTrue(res.startswith("<!-- wp:audio -->"))
87
+ self.assertIn('<figure class="wp-block-audio">', res)
88
+ self.assertIn('src="https://x/c.mp3"', res)
89
+ self.assertIn("<audio", res)
90
+ self.assertTrue(res.endswith("<!-- /wp:audio -->"))
91
+
92
+ def test_wrap_audio_from_figure(self):
93
+ html = '<figure class="wp-block-audio"><audio controls src="https://x/c.mp3"></audio></figure>'
94
+ soup = BeautifulSoup(html, "html.parser")
95
+ res = _wrap_audio(soup.figure)
96
+ self.assertTrue(res.startswith("<!-- wp:audio -->"))
97
+ self.assertIn('<figure class="wp-block-audio">', res)
98
+ self.assertIn('src="https://x/c.mp3"', res)
99
+
100
+ def test_wrap_in_gutenberg_comments_routes_audio_figure(self):
101
+ html = '<figure class="wp-block-audio"><audio controls src="https://x/c.mp3"></audio></figure>'
102
+ soup = BeautifulSoup(html, "html.parser")
103
+ res = _wrap_in_gutenberg_comments(soup.figure)
104
+ self.assertTrue(res.startswith("<!-- wp:audio -->"))
105
+
80
106
  def test_wrap_in_gutenberg_comments_with_comment(self):
81
107
  comment = Comment(" a comment ")
82
108
  res = _wrap_in_gutenberg_comments(comment)
@@ -157,6 +183,18 @@ class TestConvertFunction(unittest.TestCase):
157
183
  self.assertIn("<!-- wp:heading -->", result)
158
184
  self.assertIn("<!-- wp:code -->", result)
159
185
 
186
+ def test_convert_with_audio(self):
187
+ title = "Audio"
188
+ html_body = (
189
+ '<h2>Section</h2>'
190
+ '<figure class="wp-block-audio">'
191
+ '<audio controls src="https://x/c.mp3"></audio></figure>'
192
+ )
193
+ result = convert(title, html_body)
194
+ self.assertIn("<!-- wp:heading -->", result)
195
+ self.assertIn("<!-- wp:audio -->", result)
196
+ self.assertIn('<figure class="wp-block-audio">', result)
197
+
160
198
 
161
199
  if __name__ == "__main__":
162
200
  unittest.main()
@@ -1,19 +0,0 @@
1
-
2
- import os
3
- import unittest
4
-
5
- from wordpress_markdown_blog_loader.blog import Blog
6
-
7
- class Test_BlogRender(unittest.TestCase):
8
- def test_tables(self):
9
- path = os.path.join(os.path.dirname(__file__), "resources", "tables.md")
10
- blog = Blog.load(path)
11
- self.assertIsNotNone(blog.rendered)
12
- self.assertIn('<table>', blog.rendered)
13
- self.assertIn('<thead>', blog.rendered)
14
- self.assertIn('<th>Col B</th>', blog.rendered)
15
- self.assertIn('<tbody>', blog.rendered)
16
- self.assertIn('<td style="text-align: left;">Hello</td>', blog.rendered)
17
-
18
- if __name__ == '__main__':
19
- unittest.main()