markdown_convert 1.2.45__py3-none-any.whl → 1.2.46__py3-none-any.whl
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.
- markdown_convert/modules/transform.py +11 -7
- {markdown_convert-1.2.45.dist-info → markdown_convert-1.2.46.dist-info}/METADATA +1 -1
- {markdown_convert-1.2.45.dist-info → markdown_convert-1.2.46.dist-info}/RECORD +6 -6
- {markdown_convert-1.2.45.dist-info → markdown_convert-1.2.46.dist-info}/WHEEL +0 -0
- {markdown_convert-1.2.45.dist-info → markdown_convert-1.2.46.dist-info}/entry_points.txt +0 -0
- {markdown_convert-1.2.45.dist-info → markdown_convert-1.2.46.dist-info}/licenses/LICENSE +0 -0
|
@@ -34,23 +34,27 @@ def create_html_document(html_content, css_content, csp):
|
|
|
34
34
|
|
|
35
35
|
def create_sections(html_string):
|
|
36
36
|
"""
|
|
37
|
-
Wraps each h2 and its following content in a <section> tag.
|
|
38
|
-
|
|
37
|
+
Wraps each h2 or h3 and its following content in a <section> tag.
|
|
38
|
+
The section ends when the next h2 or h3 is encountered, or the parent ends.
|
|
39
39
|
|
|
40
40
|
Args:
|
|
41
41
|
html_string (str): The input HTML string.
|
|
42
42
|
Returns:
|
|
43
|
-
str: The modified HTML string with
|
|
43
|
+
str: The modified HTML string with sections wrapped.
|
|
44
44
|
"""
|
|
45
45
|
soup = BeautifulSoup(html_string, "html.parser")
|
|
46
46
|
|
|
47
|
-
for
|
|
47
|
+
# Change 1: Search for both h2 and h3 tags
|
|
48
|
+
for header in soup.find_all(["h2", "h3"]):
|
|
49
|
+
# Create the new section
|
|
48
50
|
new_section = soup.new_tag("section")
|
|
49
|
-
|
|
51
|
+
header.insert_before(new_section)
|
|
50
52
|
|
|
51
|
-
current =
|
|
53
|
+
current = header
|
|
54
|
+
|
|
55
|
+
# Change 2: Update loop to stop if it hits an h2 OR h3 (that isn't the current one)
|
|
52
56
|
while current is not None and (
|
|
53
|
-
current ==
|
|
57
|
+
current == header or current.name not in ["h2", "h3"]
|
|
54
58
|
):
|
|
55
59
|
next_sibling = current.next_sibling
|
|
56
60
|
new_section.append(current)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: markdown_convert
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.46
|
|
4
4
|
Summary: Convert Markdown files to PDF from your command line.
|
|
5
5
|
Project-URL: homepage, https://github.com/Julynx/markdown_convert
|
|
6
6
|
Author-email: Julio Cabria <juliocabria@tutanota.com>
|
|
@@ -6,11 +6,11 @@ markdown_convert/modules/__init__.py,sha256=PFPgiQhMXgyfjD8BkfLC_X8AR1jz-dCxfif2
|
|
|
6
6
|
markdown_convert/modules/constants.py,sha256=eUeIFRxZerP3E0Rgp_Nsl0Q38IBELwca5UO3fbUcxRA,1280
|
|
7
7
|
markdown_convert/modules/convert.py,sha256=8pWlE2PSvV9vIaziPWymXnQZqw92PkeTnLmttdQzgaw,8962
|
|
8
8
|
markdown_convert/modules/resources.py,sha256=tnW8JmCrJNBRbzOcaOVG6GX5jPC8Kzj3dA7gX0B935A,2488
|
|
9
|
-
markdown_convert/modules/transform.py,sha256=
|
|
9
|
+
markdown_convert/modules/transform.py,sha256=RNlglAqBKMwHIsywmJXMJMXUTBFxrMkP6s5LwgkNtec,5177
|
|
10
10
|
markdown_convert/modules/utils.py,sha256=NX0WegM8e8MPKNNmweTujAWO8ZghdB8LSGDx20K2E44,655
|
|
11
11
|
markdown_convert/modules/validate.py,sha256=XV_k7cHeifEKDaltF26tCmabs2-Me5msP3enI_eVwfA,1517
|
|
12
|
-
markdown_convert-1.2.
|
|
13
|
-
markdown_convert-1.2.
|
|
14
|
-
markdown_convert-1.2.
|
|
15
|
-
markdown_convert-1.2.
|
|
16
|
-
markdown_convert-1.2.
|
|
12
|
+
markdown_convert-1.2.46.dist-info/METADATA,sha256=8nJ4pfPJrfQsbh8vF7eCg87QV-dDit88cr48K55xqdo,4077
|
|
13
|
+
markdown_convert-1.2.46.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
markdown_convert-1.2.46.dist-info/entry_points.txt,sha256=RCmzC7C0sX-SpzIP2Cr34rhg3lMd7BRx-exaZPfK8bU,68
|
|
15
|
+
markdown_convert-1.2.46.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
|
16
|
+
markdown_convert-1.2.46.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|