Skip to content

Commit

Permalink
Merge branch 'release/3.10.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikitex70 committed Aug 3, 2024
2 parents 5e5097d + 438f6fa commit 8e917b9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Changelog


## 3.10.1 (2024-08-03)

### Changes

* Added a warning on `plantuml` script output (see end of #63) [Michele Tessaro]

### Fix

* Fixed plantuml config file path with local rendering (fixes #101) [Michele Tessaro]


## 3.10.0 (2024-08-01)

### Fix
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ java %PLANTUML_JAVAOPTS% -jar %mypath%\plantuml.jar %*

Make sure the `plantuml.bat` is on the path.

**IMPORTANT NOTE**: the whole output of the script `plantuml` (or `plantuml.bat` in Windows) is captured and saved as
image, so be sure no other output is done by the script, even blank lines. For example, the first line of the
`plantuml.bat` script **MUST** be `@echo off`.

For [Gentoo Linux][Gentoo] there is an ebuild at http://gpo.zugaina.org/dev-util/plantuml/RDep: you can download
the ebuild and the `files` subfolder or you can add the `zugaina` repository with [layman][]
(recommended).
Expand Down
18 changes: 14 additions & 4 deletions plantuml_markdown/plantuml_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self, md):
self._cachedir: Optional[str] = None
self._plantuml_server: Optional[str] = None
self._kroki_server: Optional[str] = None
self._base_dir: Optional[str | List[str]] = None
self._base_dir: Optional[List[str]] = None
self._encoding: str = 'utf-8'
self._http_method: str = 'GET'
self._fallback_to_get: bool = True
Expand All @@ -144,12 +144,23 @@ def run(self, lines: List[str]) -> List[str]:
self._encoding = self.config['encoding'] or self._encoding
self._http_method = self.config['http_method'].strip()
self._fallback_to_get = bool(self.config['fallback_to_get'])
self._config_path = self.config['config']
self._base_dir = self.config['base_dir']

if isinstance(self._base_dir, str):
self._base_dir = [self._base_dir]

self._config_path = self.config['config']

if self.config['config']:
# try to find config file
for search_dir in self._base_dir:
if os.path.isfile(os.path.join(search_dir, self.config['config'])):
self._config_path = os.path.join(search_dir, self.config['config'])
break
else:
logger.error(f'Could not find config file {self._config_path} in any of {self._base_dir}')
return [self._render_error(f'Could not find config file {self._config_path} in any of {self._base_dir}')]

text = '\n'.join(lines)
idx = 0

Expand Down Expand Up @@ -447,8 +458,7 @@ def _render_local_uml_image(self, plantuml_code: str, img_format: str) -> Tuple[
cmdline.extend(['-pipemap' if img_format == 'map' else '-p', "-t" + img_format, '-charset', 'UTF-8'])

if self._config_path:
full_path = os.path.join(self._base_dir, self._config_path) if self._base_dir else self._config_path
cmdline.extend(['-config', full_path])
cmdline.extend(['-config', self._config_path])

try:
# On Windows run batch files through a shell so the extension can be resolved
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.0",
version="3.10.1",
author="Michele Tessaro",
author_email="[email protected]",
description="A PlantUML plugin for Markdown",
Expand Down

0 comments on commit 8e917b9

Please sign in to comment.