Skip to content

Commit

Permalink
Fix an issue with relative paths as arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
hunyadi committed Oct 25, 2024
1 parent 4e8a8d8 commit 0e805cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions md2conf/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(
def synchronize(self, path: Path) -> None:
"Synchronizes a single Markdown page or a directory of Markdown pages."

path = path.resolve(True)
if path.is_dir():
self.synchronize_directory(path)
elif path.is_file():
Expand All @@ -54,12 +55,14 @@ def synchronize(self, path: Path) -> None:
def synchronize_page(self, page_path: Path) -> None:
"Synchronizes a single Markdown page with Confluence."

page_path = page_path.resolve(True)
self._synchronize_page(page_path, {})

def synchronize_directory(self, local_dir: Path) -> None:
"Synchronizes a directory of Markdown pages with Confluence."

LOGGER.info(f"Synchronizing directory: {local_dir}")
local_dir = local_dir.resolve(True)

# Step 1: build index of all page metadata
page_metadata: Dict[Path, ConfluencePageMetadata] = {}
Expand Down
3 changes: 3 additions & 0 deletions md2conf/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
def process(self, path: Path) -> None:
"Processes a single Markdown file or a directory of Markdown files."

path = path.resolve(True)
if path.is_dir():
self.process_directory(path)
elif path.is_file():
Expand All @@ -49,6 +50,7 @@ def process_directory(self, local_dir: Path) -> None:
"Recursively scans a directory hierarchy for Markdown files."

LOGGER.info(f"Synchronizing directory: {local_dir}")
local_dir = local_dir.resolve(True)

# Step 1: build index of all page metadata
page_metadata: Dict[Path, ConfluencePageMetadata] = {}
Expand All @@ -64,6 +66,7 @@ def process_page(
) -> None:
"Processes a single Markdown file."

path = path.resolve(True)
document = ConfluenceDocument(path, self.options, page_metadata)
content = document.xhtml()
with open(path.with_suffix(".csf"), "w", encoding="utf-8") as f:
Expand Down

0 comments on commit 0e805cd

Please sign in to comment.