Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#29 [minor tweak to mashihua's branch] #32

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = "hello@sergey.fyi"}]
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