Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: "Justin (jlec)" <jlec@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: Indention in metadata.xml
Date: Mon, 08 Jun 2015 20:07:55
Message-Id: 20150608220740.45dc253c@pomiot.lan
In Reply to: Re: [gentoo-dev] RFC: Indention in metadata.xml by "Justin (jlec)"
1 Dnia 2015-06-08, o godz. 08:36:02
2 "Justin (jlec)" <jlec@g.o> napisał(a):
3
4 > On 07/06/15 22:22, Michał Górny wrote:
5 > > Dnia 2015-06-07, o godz. 22:16:18
6 > > "Justin Lecher (jlec)" <jlec@g.o> napisał(a):
7 > >
8 > >> -----BEGIN PGP SIGNED MESSAGE-----
9 > >> Hash: SHA512
10 > >>
11 > >> On 07/06/15 14:48, Andrew Udvare wrote:
12 > >>> On 07/06/15 05:12, Alexis Ballier wrote:
13 > >>>> On Sat, 6 Jun 2015 22:00:14 -0400 Mike Gilbert
14 > >>>> <floppym@g.o> wrote:
15 > >>>>
16 > >>>>> Compatibility with sed scripts is not something I care about.
17 > >> ...
18 > >>> However, I do not disagree an XML parser is better than sed for
19 > >>> the purpose. There are plenty of XML pretty printers.
20 > >>>
21 > >>
22 > >> So you guys think I am using sed for this? Really?
23 > >>
24 > >> Still you need to tell a XML formatter what indention style to use.
25 > >
26 > > Not exactly. You can write a tool that tries hard to recognize
27 > > indentation style and repeat it. Like the one I wrote to replace
28 > > <herd/> with <maintainer/> elements. It was pretty good in figuring out
29 > > developer fancies, including multiple different indentation levels.
30 > >
31 >
32 > I am trying to detect what ever they already is for indention. How did you
33 > implement this?
34
35 Script attached. Pretty much it looks it tries to figure out what
36 indent is used for first- and second-level elements, and reproduces
37 that.
38
39
40 --
41 Best regards,
42 Michał Górny

Attachments

File name MIME type
herdfix.py text/x-python