markdowndata 0.0.3__py3-none-any.whl → 0.0.5__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.
markdowndata/__init__.py CHANGED
@@ -1,6 +1,10 @@
1
1
  from .process_markdown import MarkDataParser
2
2
 
3
- def load(file):
3
+
4
+ def loads(text):
4
5
  parser = MarkDataParser()
5
- parser.load(file.name)
6
- return parser.data
6
+ return parser.loads(text)
7
+
8
+
9
+ def load(file):
10
+ return loads(file.read())
@@ -1,4 +1,5 @@
1
- from typing import Union, List, IO
1
+ from typing import List
2
+ from .content_parser import parse_content_block
2
3
  from .section_tree import split_sections, build_section_tree
3
4
  from .utils import Node
4
5
 
@@ -11,20 +12,18 @@ class MarkDataParser:
11
12
  def __init__(self):
12
13
  self.data = {}
13
14
 
14
- def load(self, file: Union[str, IO]) -> dict:
15
+ def loads(self, text: str) -> dict:
15
16
  """
16
17
  Loads markdown content from a file path or file-like object, parses it,
17
18
  and builds a nested dictionary of structured data.
18
19
  """
19
- if isinstance(file, str):
20
- with open(file, 'r') as f:
21
- text = f.read()
22
- else:
23
- text = file.read()
24
-
25
20
  # Split the text into Section objects based on markdown headers
26
21
  sections = split_sections(text)
27
22
 
23
+ # If no sections are found, parse the content block directly
24
+ if not sections:
25
+ return parse_content_block(text)
26
+
28
27
  # Build a hierarchical tree of sections and subsections
29
28
  section_tree = build_section_tree(sections)
30
29
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: markdowndata
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Tool to convert markdown tables into json objects
5
5
  License: MIT
6
6
  Author: Gordon Bean
@@ -0,0 +1,9 @@
1
+ markdowndata/__init__.py,sha256=YWWuimxElvXp_jFOYzSAQ7zhtaGU2-jFmKYJq9Mtqp4,171
2
+ markdowndata/content_parser.py,sha256=FdapNfkvCj71K5lUSGQh0H1jS5vF36-l1EImsX28J2o,5387
3
+ markdowndata/process_markdown.py,sha256=ajJBMp2J5ipPUf4r3nxbl2JFdwKWV-82YL79RmWVrDA,2182
4
+ markdowndata/section_tree.py,sha256=X4kPqHCa_2hkiq6roOHUc22G3pNIQjpUv_ni_J14XXQ,2060
5
+ markdowndata/utils.py,sha256=jVTKEGZiLCKdv1cS-73iMf_GaXT6cBc3cl9tp_fjKOw,2040
6
+ markdowndata-0.0.5.dist-info/LICENSE,sha256=K-k1T7XcwAVVmLsHhfWMye6r7p45xz3xwv5S5FBSyZE,1074
7
+ markdowndata-0.0.5.dist-info/METADATA,sha256=4-ewjm9G3G8jmK0eU6DzWlnLtR7XGzxtICghQGj1cDw,633
8
+ markdowndata-0.0.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
9
+ markdowndata-0.0.5.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- markdowndata/__init__.py,sha256=TBg-b5wXBdEfdUCOOOc7goTBgJVYPgH-dTb7U2D3n7Y,141
2
- markdowndata/content_parser.py,sha256=FdapNfkvCj71K5lUSGQh0H1jS5vF36-l1EImsX28J2o,5387
3
- markdowndata/process_markdown.py,sha256=cQJ0yQZpCzFC6AbXpZGWZWLN5XODLS9OqfkXWLL_usU,2166
4
- markdowndata/section_tree.py,sha256=X4kPqHCa_2hkiq6roOHUc22G3pNIQjpUv_ni_J14XXQ,2060
5
- markdowndata/utils.py,sha256=jVTKEGZiLCKdv1cS-73iMf_GaXT6cBc3cl9tp_fjKOw,2040
6
- markdowndata-0.0.3.dist-info/LICENSE,sha256=K-k1T7XcwAVVmLsHhfWMye6r7p45xz3xwv5S5FBSyZE,1074
7
- markdowndata-0.0.3.dist-info/METADATA,sha256=W5askwPGg46BYTkOH7OX_7j_z1ndqpnN4OiZK-w7kCE,633
8
- markdowndata-0.0.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
9
- markdowndata-0.0.3.dist-info/RECORD,,