Skip to content

Commit

Permalink
Merge branch 'release/3.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikitex70 committed Aug 9, 2024
2 parents 8e917b9 + cd61587 commit 8eb1265
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog


## 3.10.2 (2024-08-09)

### Fix

* Fixed source search in `base_dir` paths (fixes #102) [Michele Tessaro]


## 3.10.1 (2024-08-03)

### Changes
Expand Down
8 changes: 4 additions & 4 deletions plantuml_markdown/plantuml_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ def _replace_block(self, text: str) -> Tuple[str, int]:
# Add external diagram source.
if source and self._base_dir:
for base_dir in self._base_dir:
source = os.path.join(base_dir, source)
source_path = os.path.join(base_dir, source)

if os.path.exists(source):
with open(source, 'r', encoding=self._encoding) as f:
if os.path.exists(source_path):
with open(source_path, 'r', encoding=self._encoding) as f:
code += f.read()
break
else:
diag_tag = self._render_error('Cannot find external diagram source: ' + source)
return (text[:m.start()] + m.group('indent') + diag_tag + text[m.end():], \
return (text[:m.start()] + m.group('indent') + diag_tag + text[m.end():],
m.start() + len(m.group('indent')) + len(diag_tag))
# Add extracted markdown diagram text.
code += m.group('code')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setuptools.setup(
name="plantuml-markdown",
version="3.10.1",
version="3.10.2",
author="Michele Tessaro",
author_email="[email protected]",
description="A PlantUML plugin for Markdown",
Expand Down
5 changes: 4 additions & 1 deletion test/test_plantuml.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,10 @@ def test_source(self):
include_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
configs = {
'plantuml_markdown': {
'base_dir': include_path,
'base_dir': [
'/tmp', # fake path where file to include is not present
include_path,
],
'encoding': 'cp1252'
}
}
Expand Down

0 comments on commit 8eb1265

Please sign in to comment.