Extensions implementation: Multiline parameters don't escape literal \n
Summary:
Multiline parameters (<param type="string" appearance="multiline">
) are not working correctly if they contain \n
.
Steps to reproduce:
- change the "formule" paramter in pdflatex.py to
appearance="multiline"
- open Inkscape
- Change the text in the pdflatex extension as follows:
\newcommand[\fox]{fox} The quick brown \fox jumps over the lazy dog.
- Apply the extensions. An error occurs, but that's not our main concern here.
- Close Inkscape
What happened?
- Inspect preferences.xml. It contains
org.inkscape.generate.pdf_latex.formule="\newcommand[\fox]{fox}\nThe quick brown \fox jumps over the lazy dog."
- There is no way to discriminate the literal
\n
in\newcommand
from the\n
for the newline.
This is also a problem for the python side since this string is passed including the \n's, and replacing them also replaces the \n in \n
in \newcommand
.
After reopening Inkscape, the formula parameter is shown as
ewcommand[\fox]{fox}
The quick brown \fox jumps over the lazy dog.
What should have happened?
At the very least, the \n
in \newcommand
should be escaped to \\n
.
Sample attachments:
Version info
Inkscape 1.2-dev (fc41675a, 2022-01-11)
GLib version: 2.70.2
GTK version: 3.24.31
glibmm version: 2.66.2
gtkmm version: 3.24.5
libxml2 version: 2.9.12
libxslt version: 1.1.34
Cairo version: 1.17.4
Pango version: 1.50.3
HarfBuzz version: 3.2.0
OS version: Windows 10 21H2