moodymudskipper / flow

View and Browse Code Using Flow Diagrams
https://moodymudskipper.github.io/flow/
Other
395 stars 26 forks source link

plantuml special characters #52

Closed moodymudskipper closed 3 years ago

moodymudskipper commented 3 years ago

I think this is the only ressource we have to identify them :

https://plantuml.com/en/creole

Escaping is done with ~ and escaping ~ is done with \~

So we should go through it, and build a function plantuml_escape

Here is a test function :

test <-function(){
  b*c*d                  # as expected
  b**c**d                # as expected
  b_c_                   # as expected
  b__c__                 # !!!
  --b--- c               # !!!
  -b- c                  # as expected
  ~~b ~~~ c              # !!!
  ~b ~ c                 # as expected
  paste("", this, "")    # !!!
  ""                     # as expected
  b[c]                   # as expected
  b[[c]]                 # as expected
  "\n"                   # !!!
  "\\n"                  # !!!
  '## b'                 # as expected
  "# b"                  # as expected
  ..a..                  # !!!
  "<b>"                  # !!!
  `<b>`                  # !!!
  "===="                 # as expected
  "= a"                  # as expected
  `== a`                 # !!!
  a %=== b% c            # as expected
  "----"                 # as expected
  "____"                 # as expected
  `Use image : <img:http://plantuml.com/logo3.png>` # !!!
  a | b | c              # as expected
  "this is &#8734; long" # !!!
  "this is also <U+221E> long" # !!!
  foo
}

flow_view(test, engine = "plantuml")
moodymudskipper commented 3 years ago

Seems to work OK now, while plantuml proposes a way to escape some characters with ~, and escape ~ with \, it was a pain to do properly and the easiest was to translate a list of characters by their unicode id in the form "<U+XXXX>".

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.