how to escape strings?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to escape strings?

akostadinov
Hello, using AsciiDoctor with ruby. I'm generating asciidoc programatically and then converting to different formats. I was wondering how to escape strings to be shown literary in the final doc. Any ideas?

Another thing I'm wondering is how can I insert colored text. For example I have some snippets of ascii colored text. Or convert from html to asciidoc?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: how to escape strings?

akostadinov
This post was updated on .
I think I found out how to escape strings without putting them in a block.

def literal(string)
  "pass:[#{string.gsub("]","\]")}]"
end
Reply | Threaded
Open this post in threaded view
|

Re: how to escape strings?

LightGuardjp
Yeah, an inline pass block would work. 

On Tuesday, March 10, 2015, akostadinov [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I think I found out how to escape strings without putting them in a block.

def literal(string)
  "pass:[#{string.sub("]","\]")}]"
end



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/how-to-escape-strings-tp2825p2827.html
To start a new topic under Asciidoctor :: Discussion, email <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;ml-node%2Bs49171n1h37@n6.nabble.com&#39;);" target="_blank">ml-node+s49171n1h37@...
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--