asciidoc-googledocs-addon icon indicating copy to clipboard operation
asciidoc-googledocs-addon copied to clipboard

Inline code not converted

Open davidchoo12 opened this issue 7 years ago • 6 comments

I have lots of inline code in my gdoc along styled with consolas font among words with Arial font. Those codes are not converted to adoc syntax.

davidchoo12 avatar Sep 19 '18 19:09 davidchoo12

Hello @hidingmode I believe it should work, could you please share a sample document where inline code are not converted ?

I'm using the following font name to guess if the text is an inline code:

https://github.com/Mogztter/asciidoc-googledocs-addon/blob/67e62eb547a174d889fa651935588d115b1ae360/app/Code.gs#L305-L321

ggrossetie avatar Sep 20 '18 06:09 ggrossetie

https://docs.google.com/document/d/1S2b2YXZlSWRgvrOO9WluoVK1UfUGHfUu5gXohvI88Ec/edit?usp=sharing

davidchoo12 avatar Sep 20 '18 14:09 davidchoo12

Thanks! Indeed it's not working properly... I will investigate :male_detective:

ggrossetie avatar Sep 20 '18 17:09 ggrossetie

Previously the API was not able to detect font changes in a paragraph but now it's working. I've updated the code and I will publish a new version soon.

You can review the code: #32

ggrossetie avatar Sep 21 '18 06:09 ggrossetie

I have tested the new code, but the issue still persists if the code is in the middle of a line: case: lorem ipsum dolor sit amet generated adoc: lorem ipsum dolor sit amet expected adoc: lorem ipsum `dolor sit` amet

Also, some issues with the original example: case: lorem ipsum dolor sit amet expected adoc: lorem ipsum `dolor sit amet`

  • If i select the text with the end of line char generated adoc: lorem ipsum +dolor sit amet+
  • but if i select the text without the end of line char generated adoc: lorem ipsum dolor sit amet

davidchoo12 avatar Sep 21 '18 18:09 davidchoo12

Thanks for your feedback. As mentioned in my previous comment, it may be a limitation of the App Scripts API... I will investigate further to understand how getTextAttributeIndices is working.

ggrossetie avatar Sep 21 '18 21:09 ggrossetie