-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert_to_one_line.py
executable file
·40 lines (32 loc) · 1.03 KB
/
convert_to_one_line.py
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
#!/usr/bin/env python3
text = """
- <https://github.com/pre-commit/pre-commit-hooks>
- check-json = checks json files for parseable syntax.
- pretty-format-json = sets a standard for formatting json files.
- <https://github.com/pre-commit/mirrors-fixmyjs>
- fixmyjs = fixmyjs
- <https://github.com/pre-commit/mirrors-jshint>
- jshint =
- <https://github.com/elidupuis/mirrors-jscs>
- jscs = jscs
- <https://github.com/Lucas-C/pre-commit-hooks-nodejs>
- htmlhint = NodeJS HTML syntax linter (htmlhint)
- htmllint = NodeJS HTML syntax linter (htmllint)
"""
counter = 0
final = ""
# Go through every line:
for line in text.split("\n"):
# Checking if line is empty
if line != "":
# Checking if 0 level point or an inner one:
if line[:1] == "-":
# Not adding the 2 new lines if it's the first group
if counter != 0:
final += "\\n\\n" + line
else:
final += line
else:
final += "\\n" + line
counter += 1
print(final)