I now also create a PR in the doom-emacs repo to fix the renaming of the 
@startXXX:
https://github.com/doomemacs/doomemacs/pull/8535

On 29 Sep 2025, at 18:32, Tim Hansinger wrote:

> Sorry... the commend / my description was a bit incorrect (the code is still 
> identical).
>
> Attached is the better one and here is the changed description:
>
> ---------------------------------------------------------------
>
> Refactor org-babel-plantuml-make-body to properly parse and preserve
> content around PlantUML diagram blocks.
>
> Previously, the function would apply variable expansion to the entire
> body content and only check for @start prefix to decide whether to
> wrap with @startuml/@enduml tags.
>
> Changes:
>
> - Parse body into 5 components: prologue, start tag, inner content,
> end tag, and epilogue
> - Only apply variable expansion to the inner diagram content, not
> the entire body
> - Require exact matching between @start<type> and @end<type> tags
> (e.g., @startuml must pair with @enduml, not @endsalt)
> - If @start<type> exists but no matching @end<type> is found, treat
> the entire body as diagram content and wrap with default tags
> - Preserve any content before the first @start tag (prologue) and
> after the last @end tag (epilogue) without modification
> (exception: trimming)
>
> This ensures variable substitution only affects the actual diagram content.
>
> Examples now supported:
>
> - Content before/after diagram blocks
> - Proper handling of mismatched start/end tag pairs
>
> ---------------------------------------------------------------
>
> On 29 Sep 2025, at 18:24, Tim Hansinger wrote:
>
>> Hello Rudy,
>>
>> here's the new patch. I tried to add all your suggestions and advanced 
>> handling of prologue/epilogue to it.
>>
>> I wrote the code in a way that no variables are redefined (all variables are 
>> defined only once - as if they are "immutable" - in case you don't want that 
>> I can rewrite the code which would make it a bit shorter ... but actually I 
>> prefer it as it is in the patch now for better clarity).
>>
>> Let me know what you think.
>>
>> Also: The test contains a prologue/epilogue comment (meaning a comment 
>> before/after the surrounding @startXXX @endXXX clause).
>>
>> Best
>> Tim
>>
>> ---------------------------------------------------------------
>>
>> Refactor org-babel-plantuml-make-body to properly parse and preserve
>> content around PlantUML diagram blocks.
>>
>> Previously, the function would apply variable expansion to the entire
>> body content and only check for @start prefix to decide whether to
>> wrap with @startuml/@enduml tags.
>>
>> Changes:
>>
>> - Parse body into 5 components: prologue, start tag, inner content,
>> end tag, and epilogue
>> - Only apply variable expansion to the inner diagram content, not
>> the entire body
>> - Require exact matching between @start<type> and @end<type> tags
>> (e.g., @startuml must pair with @enduml, not @endsalt)
>> - If @start<type> exists but no matching @end<type> is found, treat
>> the entire body as diagram content and wrap with default tags
>> - Preserve any content before the first @start tag (prologue) and
>> after the last @end tag (epilogue) without modification
>> (exception: trimming)
>>
>> This allows for more complex PlantUML source blocks that may contain
>> configuration directives, comments, or multiple diagram types while
>> ensuring variable substitution only affects the actual diagram content.
>>
>> Examples now supported:
>>
>> - Content before/after diagram blocks
>> - Multiple diagram types (e.g. @startsalt/@endsalt, 
>> @startmindmap/@endmindmap)
>> - Proper handling of mismatched start/end tag pairs
>>
>> ---------------------------------------------------------------
>>
>> On 28 Sep 2025, at 17:05, Rudolf Adamkovič wrote:
>>
>>> Tim Hansinger [email protected] writes:
>>>
>>>> Everything's clear now. I'm travelling this weekend but will have time
>>>> to implement this next week.
>>>
>>> Thanks for the heads-up, Tim!
>>>
>>> As Ihor says, we are in no hurry here. :)
>>>
>>> In the meantime, enjoy the travels!
>>>
>>> Rudy
>>>
>>> "I have only made this letter longer because I have not had the time to
>>> make it shorter." --- Blaise Pascal, The Provincial Letters, 1657
>>>
>>> Rudolf Adamkovič [email protected] [he/him]
>>> http://adamkovic.org

Reply via email to