0

I want to print out on XML file on HTML Page. I'm using Nokogiri with:

Nokogiri::XML::DocumentFragment.parse("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>").to_xml(:indent => 2)

but on my HTML page I got:

<note>
                    <to>Tove</to>
                    <from>Jani</from>
                    <heading>Reminder</heading>
                    <body>Don't forget me this weekend!</body>
                  </note>

instead of

    <note>
      <to>Tove</to>
      <from>Jani</from>
      <heading>Reminder</heading>
      <body>Don't forget me this weekend!</body>
    </note>

I printing it in with padrino escape function (html_escape).

It seems like that function generate that issue, because in Console everything is correctly printed.

Could you help with me with that issue? I tried to find some answers, but I didn't find anything.

1 Answers1

0

I found an answer. It was HAML issue, so next time before you want to print out XML or another source code with with html_escape, add

= preserve do
  &= escaped_source

And everything will properly indent.