ivanceras / svgbob

Convert your ascii diagram scribbles into happy little SVG
http://ivanceras.github.io/svgbob-editor/
Apache License 2.0
3.88k stars 109 forks source link

Allow dashes and underscores within words #65

Closed hugobuddel closed 4 years ago

hugobuddel commented 4 years ago

What

Words should be able to contain underscores and dashes.

E.g. these should be rendered as text, not lines: product_id, 2019-10-31, +10-15V. A good test case is the product table in demo.bob.

How

This PR achieves this by

Result

Old product table: demo_bad_dashes New product table: demo_good_dashes

Improvements in product table:

Selected other improvements:

There are no negative effects for the examples.

Possible further improvements

ivanceras commented 4 years ago

@hugobuddel Thank you for this PR.

hugobuddel commented 4 years ago

Not sure whether you should merge it as-is, because it seems rather stupid to add all these characters to ascii_map.rs. I'm not yet very familiar with rust, and this is how I got it to work so I though I should at least share it.

ivanceras commented 4 years ago

I'll have to test and review it first.

hugobuddel commented 4 years ago

Note that there seems to have been a regression. The "Other Example" in the online demo contains this blob:

 not:line    'quotes'
      A || B   *bold*
   A dash--is not a line
   Nor/is this.

which is rendered as svgbob2

The text seems to indicate that dashes and slashes in text at one point did not become a line. But it could also be a placeholder for future features.

ivanceras commented 4 years ago

@hugobuddel I think, I'll just have to re-implement the escaping of string back. This project has gone a lot of iteration and overhaul. This latest overhaul removes a lot of the features such as escaping of string with double quotes around. I haven't spend some time on putting it back, as there are a lot of visual bug such as arrows not in the right direction.

There are lot of cases where checking if a character is in between alphanumeric is not enough, as there are also alphanumeric characters used as drawing elements such as v for arrows and o for dots.

hugobuddel commented 4 years ago

Thanks for linking to the architecture document. The current architecture does seem rather nice, and the results are amazing I think.

My goal is to move all my ditaa drawings to svgbob, and this was one of the problems I faced. I'll close this PR and just keep running this branch for now. (My main problem with ditaa was that the text position and size is a bit unstable and thus it produces different svg's on different machines.)

The other option was to replace all text in the bob files with identifiers like XXXX167X and then replace them back with the original text in the SVG files. I might have to do that anyway (because I convert the svg to tikz and replace the text with hyperrefs).

ivanceras commented 3 years ago

@hugobuddel text escaping is not reinstated back into the code at this commit