Welcome to mirror list, hosted at ThFree Co, Russian Federation.

convert_styles.py « stylesheet « python « tools - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 88c159b8cb5da978f45b60cc6f79942a27d2ae8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import sys

lns = open(sys.argv[1]).readlines()
lns = [l.strip("\n") for l in lns]

newlns = []
isCaption = False

captionLns = []
leadSpaces = ""

i = 0

for l in lns:
    if not isCaption:
        i = l.find(" caption ")
        if i != -1:
            isCaption = True
            captionLns = []
            leadSpaces = l[0:i + 1]
            newlns.append(l)
            newlns.append(leadSpaces + "  primary {")
        else:
            i = l.find(" path_text ")
            if i != -1:
                isCaption = True
                captionLns = []
                leadSpaces = l[0:i + 1]
                newlns.append(l)
                newlns.append(leadSpaces + "  primary {")
            else:
                newlns.append(l)
    else:
        if l[i + 1] == "}":
            isCaption = False
            newlns.append(l)
        else:
            if l.find("priority") == -1:
                newlns.append("  " + l)
                captionLns.append("  " + l)
            else:
                newlns.append(leadSpaces + "  }")
#                newlns.append(leadSpaces + "  secondary {")
#                for l1 in captionLns:
#                    newlns.append(l1)
#                newlns.append(leadSpaces + "  }")
                newlns.append(l)


for i in newlns:
    print i