Skip to content

Commit

Permalink
Merge pull request #32 from Filimoa/29
Browse files Browse the repository at this point in the history
#29 [minor tweak to mashihua's branch]
  • Loading branch information
Filimoa authored Apr 24, 2024
2 parents 6d6f1df + 64283d0 commit 56b5a88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "openparse"
description = "Streamlines the process of preparing documents for LLM's."
readme = "README.md"
requires-python = ">=3.8"
version = "0.5.3"
version = "0.5.4"
authors = [{name = "Sergey Filimonov", email = "[email protected]"}]
dependencies = [
"PyMuPDF >= 1.23.2",
Expand Down
12 changes: 10 additions & 2 deletions src/openparse/tables/pymupdf/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@ def output_to_html(headers: List[str], rows: List[List[str]]) -> str:


def output_to_markdown(headers: List[str], rows: List[List[str]]) -> str:
markdown_output = "| " + " | ".join(headers) + " |\n"
markdown_output = ""
if headers is not None:
for header in headers:
safe_header = "" if header is None else header
markdown_output += "| " + safe_header + " "

markdown_output += "|\n"
markdown_output += "|---" * len(headers) + "|\n"

for row in rows:
processed_row = [" " if cell in [None, ""] else cell.replace("\n", " ") for cell in row]
processed_row = [
" " if cell in [None, ""] else cell.replace("\n", " ") for cell in row
]
markdown_output += "| " + " | ".join(processed_row) + " |\n"

return markdown_output
Expand Down
2 changes: 1 addition & 1 deletion src/openparse/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OPEN_PARSE_VERSION = "0.5.3"
OPEN_PARSE_VERSION = "0.5.4"


def version_info() -> str:
Expand Down

0 comments on commit 56b5a88

Please sign in to comment.