Skip to content

Wavedrom plugin generates bad svg with assign diagram type. #1945

@NicoPy

Description

@NicoPy

I'm using Kroki through asciidoctor with asciidoctor-kroki plugin.
I have a problem with Wavedrom diagrams using the assign diagram type. The generated SVG content is not correct. There is no problem with signal diagrams type.

You can reproduce the problem using the Kroki main page Try section.

Enter the following code:

{ signal: [
  { name: "clk",         wave: "p.....|..." },
  { name: "Data",        wave: "x.345x|=.x", data: ["head", "body", "tail", "data"] },
  { name: "Request",     wave: "0.1..0|1.0" },
  {},
  { name: "Acknowledge", wave: "1.....|01." }
]}

You get this :

Image

Click on the copy link button just under the diagram and copy the link in a browser tab. You get this :

Image

Perfect.

Repeat with the following code:

{ assign:[
  ["out",
    ["|",
      ["&", ["~", "a"], "b"],
      ["&", ["~", "b"], "a"]
    ]
  ]
]}

You get this:

Image

Copy and paste the link in a new browser tab. You get this :

Image

Not good.

Looking at the svg content, the first example generates <svg id="svgcontent_0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="150" width="540" viewBox="0 0 540 150" overflow="hidden" class="WaveDrom">...
While the second example generates <svg id="svgcontent_0" viewBox="0 0 225 81" width="225" height="81" class="WaveDrom">...

Manually adding xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" to the second example generated svg content makes the browser display the svg image correctly.

I tried the Wavedrom generator on the Wavedrom website. There is no such issue. So it seems the problem comes from Kroki.

Using:
Windows 11
Firefox 144

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions