savonrb / gyoku

Translates Ruby Hashes to XML
MIT License
231 stars 58 forks source link

pretty_print doesn't work as expected #63

Closed ekampp closed 2 years ago

ekampp commented 8 years ago

Hi there.

I wanted to generate some XML, and I wanted it to look nice. Having to concatenate some identical tags I set unwrap: true (which works fine), but the result wasn't prettified.

pry(main)> Gyoku.xml({ a: :b, c: [{ d: :e }, { f: :g }] }, { unwrap: true })
=> "<a>b</a><c><d>e</d><f>g</f></c>"

pry(main)> Gyoku.xml({ a: :b, c: [{ d: :e }, { f: :g }] }, { unwrap: true, pretty_print: true  })
=> "<a>b</a><c><d>e</d><f>g</f></c>"

pry(main)> Gyoku.xml({ a: :b, c: [{ d: :e }, { f: :g }] }, { unwrap: true, pretty_print: true, compact: false })
=> "<a>b</a><c><d>e</d><f>g</f></c>"

I would have expected both of the last results to be something like this:

<a>b</a>
<c>
  <d>e</d>
  <f>g</f>
</c>

I'm currently running Gyoku v. 1.3.1

Thanks in advance

bjorntrondsen commented 7 years ago

V1.3.1 doesnt seem to include this feature. You can get the feature by grabbing the gem from master though. Update your gemfile like so: gem 'gyoku', git: 'git@github.com:savonrb/gyoku.git', ref: '954d002'

MaxFedotov commented 5 years ago

Hello @bjorntrondsen. And is it possible to create a new release with this feature and publish it to rubygems? Thanks a lot in advance :)

bjorntrondsen commented 5 years ago

@MaxFedotov Im just a passer by but maybe @tjarratt can help :)

MaxFedotov commented 5 years ago

@bjorntrondsen Oh, sorry :) @tjarratt Is it possible to create a new release with this feature and publish it to rubygems? Thanks a lot in advance :)

anirbanmu commented 4 years ago

I've run into this too just now.

@tjarratt a release of latest master to rubygems would be really appreciated if you have the time. Thanks in advance.

RulerOf commented 2 years ago

Requesting the same a couple years later :)

olleolleolle commented 2 years ago

Closing this issue, now that #80 v1.4.0 has been released.