openSUSE / docmanager

Manage DocBook 5 Meta Information
http://opensuse.github.io/docmanager/index.html
GNU General Public License v3.0
6 stars 6 forks source link

Newlines after meta elements are missing #1

Closed rsalevsky closed 9 years ago

rsalevsky commented 9 years ago

Every element which is created or edited by docmanager is in one line. So it is needed to add a line break after the elements to keep the legibility.

mschnitzer commented 9 years ago

xmlformat.pl should help there. (Just as suggestion if you don't have any solution yet)

tomschr commented 9 years ago

@mschnitzer There is already a pretty print option inside the lxml library. :-)

mschnitzer commented 9 years ago

@tomschr as you can see, I'm not the "Python-Guy" :P

tomschr commented 9 years ago

I think, this can be done with the .tail property. If you set it to \n you'll get a linebreak. However, it is a little bit more difficult to get the indentation right.

tomschr commented 9 years ago

One possible algorithm:

  1. Get the info element (let's say, it is saved in an info variable).
  2. Call info.getprevious().tail.rsplit('\n')[-1] to the get the indentation of the <info> element.
  3. Apply the result from (2) to DocManager's <docmanager> element(s).
mschnitzer commented 9 years ago

Should I implement that?

tomschr commented 9 years ago

@mschnitzer Yes, please! :-)

Having all of DocManager's elements in one line is inconvenient: it makes diffs almost useless and it is hard to read.

As such, we need to separate all the child elements from the <docmanager> element. Each property should rest on a separate line. To make it simpler, try to separate the (child) elements and pretty print them later.

mschnitzer commented 9 years ago

@tomschr I assigned you to this bug because you already opened a new issue fix branch.

tomschr commented 9 years ago

Just for the sake of completness: I've took a different approach. Add all children to the <docmanager> element, reformat them, and then write the result to the file.

mschnitzer commented 9 years ago

@tomschr your branch is still in the branch list. Can you please merge it? https://github.com/openSUSE/docmanager/tree/feature/issue1

tomschr commented 9 years ago

Branch already merged in commit 6156ca7, branch deleted now.