ivanceras / svgbob

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

add support to escape char #37

Closed beenotung closed 3 years ago

beenotung commented 5 years ago

Sometime a char is treated as diagram char when it was intended to be word char.

Example 1:

co-edit
single-person

Is rendered as: 1 The hyphen after o is treated as a horizontal line.

Example 2:

(some remark)

some text
(some remark)
some text

Is rendered as: 2 The open bracket between lines is rendered as a diagram which the close bracket is still rendered as text.

ivanceras commented 5 years ago

Yes the - is chained together with o and interpreted as line with circle endpoint. You can escape it by using " ie: "co-edit"

chaseleinart commented 5 years ago

Hey there @ivanceras, It does seem that escaping the "o character" when chained between adjacent text is problematic. when by itself, it seems to be escaped fine, but when the _o falls in the middle of a string of characters without any spaces, it doesn't seem like it can be escaped without some odd spaces being displayed.

Input "_o"

 foo_bar_opq_id 

 fo"o_"bar"_o"pq_id                                                                                                       

Output image

virtualirfan commented 5 years ago

@chaseleinart why not just:

"foo_bar_opq_id"

instead of

fo"o_"bar"_o"pq_id                                                                                                       
makaleks commented 5 years ago

Yes the - is chained together with o and interpreted as line with circle endpoint. You can escape it by using " ie: "co-edit"

Thanks for this tip, it is not used widely in demo. The problem is that it does not saves alignment for inherited text. For example, when I print

 +----------+
 |"BIOS RAM"|
 +----------+
      /\
     '  '
    /    \
+----+  +----+
|"ПО"|  |"БД"|
+--o-+  +----+

it results into Screenshot-2019-10-21 Screenshot

If I replace quotes with spaces, all is normal. But I need these escape-quotes in other places of diagram and the missed alignment seems to be a bigger problem

Thanks

ivanceras commented 3 years ago

This has been fixed in svgbob 0.5.5

Try this out on the online editor

 +----------+
 |"BIOS RAM"|
 +----------+
      /\
     /  \
    /    \
+----+  +----+
|"ПО"|  |"БД"|
+--o-+  +----+

 "foo_bar_opq_id" 

"(some remark)"
some text