Login
Remember
Register
PlantUML Q&A
*NEW* Discord server
All Activity
Questions
Hot!
Unanswered
Tags
Users
Ask a Question
Ask a Question
Escaping things
0
votes
asked
Jul 3, 2019
in
Question / help
by
nickolay.martinov
How can I escape a function name so it does not gets called?
I try to make a diagram that demonstrates what function will produce and try to put example of function call in rectangle title, component title and in notes but it doesn't work because function gets called. It works the same with old preprocessor and !define and with new preprocessor and !function.
Here's example:
http://www.plantuml.com/plantuml/uml/bP11JiCm54Jt_nJJ28bssN218aGFm8BzLpm94Ovjx1zK2VNkgAdQqbAaihDcxEVHMnNJREFWPPOoKuuDIudvjHRnR0qMaVlkpU3wpCRw64HcxHYc8zhvNT212sdYa69WC5HJKicCmHtkYIHjthKZdZU9ZT7XIu1Jg4FoX1Pmivmgu1vFcdfJZpKiGZzZxy1Dqb1sHE3qlbhFgmoYO8I7LOjggaCqxiSBS2CIk6HDCOERS09iVmn_OHczGGioos5u-nkmbQt8Jf-6pXEFZOtg_rPG7nMqw6Xblz7HmR6ateYFCHhBkOJpVx6yhk5MB731g_-Xehwg0Wz76Ii6Dmx-6m00
preprocessing
escape
Your comment on this question:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail]
(--------)
To avoid this verification in future, please
log in
or
register
.
1 Answer
0
votes
answered
Jul 3, 2019
by
plantuml
(
294,960
points)
Well, there is no way to prevent function call.
Using such a short function name is a bad idea.
So a first workaround is to rename your function as $f :
http://www.plantuml.com/plantuml/uml/bP11Rl8m44RtSugF2Ec79ValG5ML0tJH_IYUf54TsxN75LALkpSn0Wgb4jrPC_RpqzicvQXviBG8KKBqZQJauqjDPALLg4VikrU5wQCqsdj7j6YpAqSiszNIyI1hQlmGl1EdgCgaeeKuSxn85BXvuqxmj0yJHWm-2JWFUGXMm0cotvGLy0-F77fbYzrimH--DzCwi4ip4JY_htQhAaAGa66XrRegQ-TL3lO4t8a4hbbbBCuK707ZD_5dITdgx1qb7SMNxK_2I2FH791TPmKFZMQslpUeJmrQTABf86d4m4WAlGhUysIJBYjS_elDpGvtOu4hNls75lNj5lX_gh6TC7cmNm00
A second workaround is to use the unicode code of open parenthesis:
http://www.plantuml.com/plantuml/uml/bP3DIWCn58NtzobE1y4MD-suSI5I4Vi0WkulaplZO2Q9oOqKfEzkcz8VjKBTXNEIBuTldfIZvi7IA4G9qJUIaeylDP6LLg4UiUzU5QQFqcZl7T6epQuSqOul70yoeSOFmJjnYgea5Ot4cTqzei3D6tU2nsLOKyJWau13o4Em0awGvQnKm2KUEFJA5Wke1t_utgphm2vjYC3XVRKOLn62X0mBhIPLgPrNsOudu4may9DLOd6cu0XO7Gr_afIjWXEYfDtmzZTWHIkYZJvsdHNSDvhP_gsWtYjeqOccxKOZ1aPIw5NmdhrA-YwXlNs-caxhcxlZxp4xRUDSEd0QM_z3J7rI3AxtQkPhIXxi5m00
Or you can use the Unicode Character 'ZERO WIDTH SPACE' <U+200B>
http://www.plantuml.com/plantuml/uml/bP31IWCn54Ntxojk1y4MD-su5QcA_G11zu_9ct4mayJaHGhIVvUcjBNgGDs5UvEJoracvQXvi3G9KKBqZQJauqjDPALLg4VikrU5wQCqsdj7D6cpAqUqqml7WyoeyKFmJfoYAab54t5cVuyeSFF6dU1n7QHHCVWau1Zo4Ao04sIzA1LmYGSElRB52kh17xuta7LWbxP4uFY-Mash2452XeLMiwhKpglinXDm9XBuoIgnE5Dm16o-3N-IbAs24wAa_V3sDs136wAjFdQT5TmrcjcEAwWF2bfqecctqOY1aHHw5Rndhv9E9RGtprVrV7v_U_8_5kCwpi438zpw7shgFzNW-Y1dASxamNu1
Hope this helps!
commented
Jul 4, 2019
by
nickolay.martinov
Thank you for suggestion.
Solution with $ looks very nice at first but actual code to place in source starts to differ from what you provide in example. Also, none of standard libraries prefix function names with $.
Solutions with unicode symbols are clever but... will work only for functions. Global variables and legacy macros will not be escaped this way. Also, I could imagine that space between function name and open bracket could be later a valid construct.
Of course one can replace first letter of each function name with unicode symbols but this is very cumbersome.
Would be nice to have a way to prevent macro expansion. Just as you can do this currently with HTML:
http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuL8iA4ejACfFJYqkpYyAC-BYIixFBSZFIyqhKL2giqcogxF9j4lApqbHo2n9pCbCjj7FjBFHJx9Jud98pKi16W00
As far as I remember, C preprocessor, that is inspiration for at least legacy plantuml preprocessor, does not expand inside literal strings. Instead, literal strings are kept as is. Is there any way to tell plantuml that something is a literal string and should be used as is?
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Related questions
State DIagrams Escaping "
Escaping in preprocessor
Cypher scrambles things it shouldn't
CRLF in the code of a single object in sequence diagrams
How to escape {} in activity diagrams?
All categories
Question / help
(1,446)
Bug
(1,634)
Wanted features
(1,416)
Closed question / help
(88)
Closed bug
(52)
Closed feature request
(130)
Won't fix
(3)
Won't implement
(12)
Can't help
(9)
To be deleted
(10)
To be sorted
(429)
...