wavedrom / lambda

λ
MIT License
0 stars 0 forks source link

Using the JSON in the link with Base64 encoding. #5

Closed alexisfrjp closed 4 years ago

alexisfrjp commented 4 years ago

I would like to use use the server without having a different file.

In the readme:

![signal step4](https://svg.wavedrom.com/{signal:[{name:'clk',wave:'p......'},
{name:'bus',wave:'x.34.5x',data:'head body tail'},{name:'wire',wave:'0.1..0.'}]})

That doesn't work, I guess it's due to spaces and other special characters.

It would be nice to add the support using BASE64.

Example:

{ 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." }
]}

Base64's equivalent:

eyBzaWduYWw6IFsKICB7IG5hbWU6ICJjbGsiLCAgICAgICAgIHdhdmU6ICJwLi4uLi58Li4uIiB9LAo
gIHsgbmFtZTogIkRhdGEiLCAgICAgICAgd2F2ZTogInguMzQ1eHw9LngiLCBkYXRhOiBbImhlYWQi
LCAiYm9keSIsICJ0YWlsIiwgImRhdGEiXSB9LAogIHsgbmFtZTogIlJlcXVlc3QiLCAgICAgd2F2ZTogIj
AuMS4uMHwxLjAiIH0sCiAge30sCiAgeyBuYW1lOiAiQWNrbm93bGVkZ2UiLCB3YXZlOiAiMS4uLi4
ufDAxLiIgfQpdfQ==

To be able to use:

![example](https://svg.wavedrom.com/base64
/eyBzaWduYWw6IFsKICB7IG5hbWU6ICJjbGsiLCAgICAgICAgIHdhdmU6ICJwLi4uLi58Li4uIiB9LA
ogIHsgbmFtZTogIkRhdGEiLCAgICAgICAgd2F2ZTogInguMzQ1eHw9LngiLCBkYXRhOiBbImhlYW
QiLCAiYm9keSIsICJ0YWlsIiwgImRhdGEiXSB9LAogIHsgbmFtZTogIlJlcXVlc3QiLCAgICAgd2F2ZTo
gIjAuMS4uMHwxLjAiIH0sCiAge30sCiAgeyBuYW1lOiAiQWNrbm93bGVkZ2UiLCB3YXZlOiAiMS4uL
i4ufDAxLiIgfQpdfQ==)

I will do it and send a merge request.

drom commented 4 years ago

In WaveDrom editor -> Menu -> Expand URL You would get encoded URI, that you can use with the server. Will that work for you?

![Test](https://svg.wavedrom.com/%7B%20signal%3A%20%5B%0A%20%20%7B%20name%3A%20%22clk%22%2C%20%20%20%20%20%20%20%20%20wave%3A%20%22p.....%7C...%22%20%7D%2C%0A%20%20%7B%20name%3A%20%22Data%22%2C%20%20%20%20%20%20%20%20wave%3A%20%22x.345x%7C%3D.x%22%2C%20data%3A%20%5B%22head%22%2C%20%22body%22%2C%20%22tail%22%2C%20%22data%22%5D%20%7D%2C%0A%20%20%7B%20name%3A%20%22Request%22%2C%20%20%20%20%20wave%3A%20%220.1..0%7C1.0%22%20%7D%2C%0A%20%20%7B%7D%2C%0A%20%20%7B%20name%3A%20%22Acknowledge%22%2C%20wave%3A%20%221.....%7C01.%22%20%7D%0A%5D%7D%0A)

Test

alexisfrjp commented 4 years ago

Yes, that should be enough, I've still added the base64 support.

drom commented 4 years ago

https://github.com/wavedrom/server/issues/2