Converting /Users/foo/repo/docs/diagrams/src/blah.puml
Wrong response status for data-sci-env-context.puml: 400
After debugging this, I narrowed it down to the _readFileRec function in plantuml.py.
195 # Reads the file recursively
196 def _readFileRec(self, lines, temp_file, diagram, directory, dark_mode):
197
198 for line in lines:
199 line = line.strip()
200 if line.startswith("!include"):
201 temp_file = self._readInclLine(
202 diagram, line, temp_file, directory, dark_mode
203 )
204 else:
205 temp_file += line
206 if "\n" not in line:
207 temp_file += "\n"
208
209 return temp_file
If we are being called recursively because of an !include in a base PUML file, (i.e. line 201), and the included file does not end in a newline, then the next line read from the base file will be added to the end of the last line from the included file. This causes a syntax error when parsed by the PlantUML server..
A workaround is to put a blank line in between the 2 !include statements, thus resulting in a newline between the end of the included file and the next line in the base file.
Using
mkdocs-build-plantuml-plugin
1.7.3, if there are 2!include
statements in a PUML file, without an extra line between them, like so:an error is returned during processing
After debugging this, I narrowed it down to the
_readFileRec
function inplantuml.py
.If we are being called recursively because of an
!include
in a base PUML file, (i.e. line 201), and the included file does not end in a newline, then the next line read from the base file will be added to the end of the last line from the included file. This causes a syntax error when parsed by the PlantUML server..A workaround is to put a blank line in between the 2
!include
statements, thus resulting in a newline between the end of the included file and the next line in the base file.Will provide a fix via a PR.