hallvard / plantuml

Embed UML diagrams in files and view them in Eclipse
http://plantuml.sourceforge.net/
209 stars 57 forks source link

"Save as" from the svg view creates invalid svgs #177

Open uwe83 opened 4 months ago

uwe83 commented 4 months ago

1. Create text file in Eclipse containing almost any diagram. E.g. the classic test.txt containing:

Case "trivial"

@startuml
alice -> bob : hello
@enduml

or, in Case "complex"

@startuml

actor Utilisateur as user
participant "formSign.js" as form <<Contrôleur formulaire>>
participant "Sign.java" as controler <<(C,#ADD1B2) Contrôleur formulaire>>
participant "Secure.java" as secure <<(C,#ADD1B2) authentification>>
participant "Security.java" as security <<(C,#ADD1B2) sécurité>>

box "Application Web" #LightBlue
    participant form
end box

box "Serveur Play" #LightGreen
    participant controler
    participant secure
    participant security
end box

user -> form : submitSignIn()
form -> form : getParameters()
form -> form : result = checkFields()

alt result

    form -> controler : formSignIn(email,pwd)
    controler -> controler : result = checkFields()

    alt result
        controler -> secure : Secure.authenticate(email, pwd, true);
        secure -> security : onAuthenticated()
        security --> form : renderJSON(0);
        form --> user : display main page
    else !result
        controler --> form : renderJSON(1)
        form --> user : display error
    end

    Utilisateur -> Utilisateur : Bla 

else !result
    form --> user : display error
end

@enduml

2. Right click into the picture and select "Save as"

image

3a. save the file into e.g. "trivial.svg" trivial

3b save the file into e.g. "complex.svg" complex

4. The resulting svg is invalid according to Edge and Chrome: in both cases

Editing the file shows it contains a duplicate closing tag in column 603 as indicated by the browsers:

image

Removing the "extra" tag using a text editor results in Case "trivial": the browser no longer complaining, but rendering "nothing", everything white Case "complex": the browser rendering the image OK

I used the Plantuml Plugin version from "today" 10th Feb. 2024 :

PlantUML Feature 1.1.30 net.sourceforge.plantuml.feature.feature.group PlantUML Team PlantUML Library Feature 1.2023.11 net.sourceforge.plantuml.lib.feature.feature.group PlantUML Team

in an Eclipse Java/DSL Developers installation from "today":

Buildship: Eclipse Plug-ins for Gradle 3.1.8.v20231117-1658 org.eclipse.buildship.feature.group Eclipse Buildship Eclipse DSL Tools 4.30.0.20231201-1200 epp.package.dsl Eclipse Packaging Project Eclipse Project SDK 4.30.0.v20231201-0512 org.eclipse.sdk.feature.group Eclipse.org Eclipse XML Editors and Tools 3.31.0.v202308200343 org.eclipse.wst.xml_ui.feature.feature.group Eclipse Web Tools Platform EMF - Eclipse Modeling Framework SDK 2.36.0.v20231107-0612 org.eclipse.emf.sdk.feature.group Eclipse Modeling Project EMF - Eclipse Modeling Framework Xcore SDK 1.27.0.v20231007-1413 org.eclipse.emf.ecore.xcore.sdk.feature.group Eclipse Modeling Project Git integration for Eclipse 6.8.0.202311291450-r org.eclipse.egit.feature.group Eclipse EGit Java implementation of Git 6.8.0.202311291450-r org.eclipse.jgit.feature.group Eclipse JGit JustJ JRE for IDE Packages 17.0.0.v20231028-1129 org.eclipse.justj.epp.feature.group Eclipse JustJ LSP4J SDK 0.21.1.v20230829-0014 org.eclipse.lsp4j.sdk.feature.group Eclipse LSP4J M2E - Maven Integration for Eclipse 2.4.200.20231119-0901 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e M2E - POM Editor using LemMinX language server (includes Incubating components) 2.0.6.20231113-2319 org.eclipse.m2e.lemminx.feature.feature.group Eclipse.org - m2e M2E - SLF4J over Logback Logging 2.2.1.20231113-2319 org.eclipse.m2e.logback.feature.feature.group Eclipse.org - m2e Marketplace Client 1.10.2.v20231116-1812 org.eclipse.epp.mpc.feature.group Eclipse Marketplace Client MWE2 Language SDK 2.16.0.v20231117-0522 org.eclipse.emf.mwe2.language.sdk.feature.group Eclipse Xtext Mylyn WikiText 3.0.48.202308291007 org.eclipse.mylyn.wikitext_feature.feature.group Eclipse Mylyn Oomph Setup 1.30.0.v20231122-0734 org.eclipse.oomph.setup.feature.group Eclipse Oomph Project PlantUML Feature 1.1.30 net.sourceforge.plantuml.feature.feature.group PlantUML Team PlantUML Library Feature 1.2023.11 net.sourceforge.plantuml.lib.feature.feature.group PlantUML Team TM Terminal 11.4.0.202309142347 org.eclipse.tm.terminal.feature.feature.group Eclipse CDT Xtext Complete SDK 2.33.0.v20231121-0955 org.eclipse.xtext.sdk.feature.group Eclipse Xtext

travkin79 commented 2 months ago

Hi @uwe83, I'm working on a new release with newer PlantUML lib version 1.2024.4. It seems, I cannot reproduce this issue with the latest version from master branch. Could you please test the PlantUML Eclipse plug-ins from current master branch? Thank you.

In my version, I don't have a save file entry in the context menu in the PlantUML SVG view. Instead, I used the export feature from the context menu in the PlantUML view and saved the diagram as *.svg file.

uwe83 commented 2 months ago

Hello Dietrich,

thank you for looking into this. From my understanding I would need to build the plugin myself using Maven. I need to learn how to do that. I tried this morning but could not get there yet. I will retry later. I found /net.sourceforge.plantuml.releng/net.sourceforge.plantuml.composite/README.md and assume this is what I need to follow. I also found https://github.com/hallvard/plantuml/issues/122 and will look at that.

Am Mi., 10. Apr. 2024 um 17:58 Uhr schrieb Dietrich Travkin < @.***>:

Hi @uwe83 https://github.com/uwe83, I'm working on a new release with newer PlantUML lib version 1.2024.4. It seems, I cannot reproduce this issue with the latest version from master branch. Could you please test the PlantUML Eclipse plug-ins from current master branch? Thank you.

In my version, I don't have a save file entry in the context menu in the PlantUML SVG view. Instead, I used the export feature from the context menu in the PlantUML view and saved the diagram as *.svg file.

— Reply to this email directly, view it on GitHub https://github.com/hallvard/plantuml/issues/177#issuecomment-2047925892, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGBWVLQ4PFW46S2NSNIWAZLY4VOTRAVCNFSM6AAAAABDCQB5N2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBXHEZDKOBZGI . You are receiving this because you were mentioned.Message ID: @.***>

travkin79 commented 2 months ago

Hi @uwe83, The file you found net.sourceforge.plantuml.releng/net.sourceforge.plantuml.composite/README.md is the right source, the issue #122 seems too old.

But I could also provide an already built version to you. I built it anyway for local testing.

uwe83 commented 2 months ago

Sure, if you can provide it somehow I will try it happily!

Dietrich Travkin @.***> schrieb am Do., 11. Apr. 2024, 09:59:

Hi @uwe83 https://github.com/uwe83, The file you found net.sourceforge.plantuml.releng/net.sourceforge.plantuml.composite/README.md is the right source, the issue #122 https://github.com/hallvard/plantuml/issues/122 seems too old.

But I could also provide an already built version to you. I built it anyway for local testing.

— Reply to this email directly, view it on GitHub https://github.com/hallvard/plantuml/issues/177#issuecomment-2049141791, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGBWVLSLVQ24SF34DHI55PTY4Y7FFAVCNFSM6AAAAABDCQB5N2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBZGE2DCNZZGE . You are receiving this because you were mentioned.Message ID: @.***>

travkin79 commented 2 months ago

I've attached an update site with only the latest release candidate. Could you unzip and test it? You'll need to add the update site with a URL of the form file:/path/to/your/local/update-site-directory update site.zip

uwe83 commented 2 months ago

I installed it successfuly, but I cannot find any evidence for it except for the installation details: image I find no PlantUML preferences and no PlantUML views :-(.

I first installed this into my existing environment. After the restart the Plantuml views were still open, but had seized working. I then installed once more into a freshly installed Eclipse https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2024-03/R/eclipse-dsl-2024-03-R-win32-x86_64.zip.

If there's anything I can do to help find out what is wrong here, please let me know.

travkin79 commented 2 months ago

Hi @uwe83 , Could you please take a look into the Error Log View and check if there are any new entries? If you see any PlantUML-related entries, please let me know and add the exception stacktrace if available.

I installed a new Eclipse IDE 2024-03 with a brand new workspace and the PlantUML views are all there. I'm using MacOS Sonoma 14.4.1.

travkin79 commented 2 months ago

Hello @uwe83, I installed another Eclipse IDE on a Windows PC and installed PlantUML Eclipse Plug-ins from my update site.zip file and the views are still there and work fine.

But the issue you described, remains. What I observed is that it only occurs on Windows. In fact, the PlantUML SVG view does only offer the "Save as..." context menu entry on Windows, not on MacOS and not on Linux. Besides, if you instead use the export feature from the PlantUML view (without "SVG" in the view name) and save the file as *.svg, then the described problem does not appear, there is only one occurrence of the <defs/> tag.

I think, in this case, a bugfix will not make it into the upcoming PlantUML Eclipse plug-in release 1.3.1, since that requires more analysis.

uwe83 commented 2 months ago

Yes, that is in fact weird. But it's good to know the workaround via the PlantUML view! Thanks!