ivanceras / svgbob

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

Avoid converting words to symbols #66

Closed nkh closed 3 years ago

nkh commented 3 years ago

In some cases svgbob will take a letter inside a word and transform it to a symbol instead for letting it be a character that's part of the word; the examples I have seen where mainly with V, inside a word, be transformed in a down arrow.

svg bob could do a first pass and mark, with the help of a dictionary, the character that are not to be transformed, it should also be possible to input wors or whole dictionary of word to use if one has a technical name not part of the dictionary or uses a foreign language.

kimble commented 3 years ago

I have seen a similar case with intervals.

The dash in the string "10-15" will be converted to a long line.

nkh commented 3 years ago

I have seen a similar case with intervals.

The dash in the string "10-15" will be converted to a long line.

that may be a hard one to fix but adding 10-15 in a custom dictionary would fix that

ivanceras commented 3 years ago

The last commit has fix the escaping of characters that are not meant to be interpreted as drawing elements. This feature has already been added on previous version of svgbob (0.4 and below), but due to the major overhaul in the core architecture, this took awhile to be reinstated.

This will be present in the next release.

nkh commented 3 years ago

how is the escaping done?

ivanceras commented 3 years ago

Using double quotes, like this:

".----------------."
"| Don't draw me  |"
"`----------------'"

but this is only available on the next release.

nkh commented 3 years ago

how is that a good solution? it changes the ascii drawing and makes it, I believe very difficult to draw lines.

Wouldn't the dictionary approach be much better? it has the advantage of not modifying the ascii

ivanceras commented 3 years ago

I believe it's better and simpler solution, since there is no easy way to determine that words are meant to be interpreted as drawing element or not. Double quotes as explicit escape makes it clear for the algorithm to do this. I don't think the dictionary approach you mentioned here is better, as you could be listing all the words in all the possible languages of the world.

andre-dietrich commented 3 years ago

Maybe double "" could be also used as an escape option, single quotes will still work?

"".----------------.""
""| Don't draw me  |""
""`----------------""
ivanceras commented 3 years ago

@andre-dietrich no, only double quote is used for escaping. The single quotes is used as drawing element such as creating a rounded corner at the bottom of the rectangle.

.-------.
|       |
'-------'