Skip to content

Commit 6fbb71a

Browse files
authored
Merge pull request #19 from ptr727/develop
Develop
2 parents 664b259 + 88d0045 commit 6fbb71a

File tree

8 files changed

+277
-206
lines changed

8 files changed

+277
-206
lines changed

.github/workflows/merge-bot-pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ jobs:
2525
with:
2626
github-token: "${{ secrets.GITHUB_TOKEN }}"
2727

28-
- name: Merge dependabot non-major updates
28+
- name: Merge PR
2929
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
3030
run: gh pr merge --auto --merge "$PR_URL"
3131
env:
3232
PR_URL: ${{github.event.pull_request.html_url}}
3333
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
3434

3535
merge-languagedata:
36-
name: Merge language data PR's
36+
name: Merge language data PRs
3737
runs-on: ubuntu-latest
3838
if: github.actor == 'github-actions[bot]' && github.event.pull_request.base.ref == 'update-languagedata'
3939
permissions:
@@ -42,7 +42,7 @@ jobs:
4242

4343
steps:
4444

45-
- name: Merge language data PRs
45+
- name: Merge PR
4646
run: gh pr merge --auto --merge "$PR_URL"
4747
env:
4848
PR_URL: ${{github.event.pull_request.html_url}}

.github/workflows/publish-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ concurrency:
1212
jobs:
1313

1414
test:
15-
uses: ./.github/workflows/test.yml
15+
name: Run tests
16+
uses: ./.github/workflows/test-task.yml
1617
secrets: inherit
1718

1819
publish:

.github/workflows/test-pr.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ concurrency:
1212
jobs:
1313

1414
test:
15-
uses: ./.github/workflows/test.yml
15+
name: Run tests
16+
uses: ./.github/workflows/test-task.yml
1617
secrets: inherit

LanguageTags/Iso6392Data.cs

Lines changed: 66 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public partial class Iso6392Data
1515
internal static void WriteFile(string fileName, string value)
1616
{
1717
// Always write as CRLF with newline at the end
18-
if (Environment.NewLine != "\r\n")
18+
if (value.Contains('\n') && !value.Contains('\r'))
1919
{
2020
value = value.Replace("\n", "\r\n");
2121
}
@@ -77,73 +77,89 @@ public static void SaveJson(string fileName, Iso6392Data iso6392) =>
7777
public static void GenCode(string fileName, Iso6392Data iso6392)
7878
{
7979
StringBuilder stringBuilder = new();
80-
_ = stringBuilder.AppendLine(
81-
"""
82-
// This file is generated by LanguageTagsCreate
80+
_ = stringBuilder
81+
.Append(
82+
"""
83+
// This file is generated by LanguageTagsCreate
8384
84-
namespace ptr727.LanguageTags;
85+
namespace ptr727.LanguageTags;
8586
86-
public partial class Iso6392Data
87-
{
88-
public static Iso6392Data Create() =>
89-
new()
90-
{
91-
RecordList =
92-
[
93-
"""
94-
);
87+
public partial class Iso6392Data
88+
{
89+
public static Iso6392Data Create() =>
90+
new()
91+
{
92+
RecordList =
93+
[
94+
"""
95+
)
96+
.Append("\r\n");
9597

9698
foreach (Record record in iso6392.RecordList)
9799
{
98-
_ = stringBuilder.AppendLine(
99-
CultureInfo.InvariantCulture,
100-
$$"""
101-
new()
102-
{
103-
"""
104-
);
100+
_ = stringBuilder
101+
.Append(
102+
CultureInfo.InvariantCulture,
103+
$$"""
104+
new()
105+
{
106+
"""
107+
)
108+
.Append("\r\n");
105109
if (!string.IsNullOrEmpty(record.Part2B))
106110
{
107-
_ = stringBuilder.AppendLine(
108-
CultureInfo.InvariantCulture,
109-
$" Part2B = \"{record.Part2B}\","
110-
);
111+
_ = stringBuilder
112+
.Append(
113+
CultureInfo.InvariantCulture,
114+
$" Part2B = \"{record.Part2B}\","
115+
)
116+
.Append("\r\n");
111117
}
112118
if (!string.IsNullOrEmpty(record.Part2T))
113119
{
114-
_ = stringBuilder.AppendLine(
115-
CultureInfo.InvariantCulture,
116-
$" Part2T = \"{record.Part2T}\","
117-
);
120+
_ = stringBuilder
121+
.Append(
122+
CultureInfo.InvariantCulture,
123+
$" Part2T = \"{record.Part2T}\","
124+
)
125+
.Append("\r\n");
118126
}
119127
if (!string.IsNullOrEmpty(record.Part1))
120128
{
121-
_ = stringBuilder.AppendLine(
122-
CultureInfo.InvariantCulture,
123-
$" Part1 = \"{record.Part1}\","
124-
);
129+
_ = stringBuilder
130+
.Append(
131+
CultureInfo.InvariantCulture,
132+
$" Part1 = \"{record.Part1}\","
133+
)
134+
.Append("\r\n");
125135
}
126136
if (!string.IsNullOrEmpty(record.RefName))
127137
{
128-
_ = stringBuilder.AppendLine(
129-
CultureInfo.InvariantCulture,
130-
$" RefName = \"{record.RefName}\","
131-
);
138+
_ = stringBuilder
139+
.Append(
140+
CultureInfo.InvariantCulture,
141+
$" RefName = \"{record.RefName}\","
142+
)
143+
.Append("\r\n");
132144
}
133-
_ = stringBuilder.AppendLine(
134-
CultureInfo.InvariantCulture,
135-
$$"""
136-
},
137-
"""
138-
);
145+
_ = stringBuilder
146+
.Append(
147+
CultureInfo.InvariantCulture,
148+
$$"""
149+
},
150+
"""
151+
)
152+
.Append("\r\n");
139153
}
140-
_ = stringBuilder.AppendLine(
141-
"""
142-
],
143-
};
144-
}
145-
"""
146-
);
154+
_ = stringBuilder
155+
.Append(
156+
"""
157+
],
158+
};
159+
}
160+
"""
161+
)
162+
.Append("\r\n");
147163

148164
WriteFile(fileName, stringBuilder.ToString());
149165
}

LanguageTags/Iso6393Data.cs

Lines changed: 87 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -80,100 +80,124 @@ public static void SaveJson(string fileName, Iso6393Data iso6393) =>
8080
public static void GenCode(string fileName, Iso6393Data iso6393)
8181
{
8282
StringBuilder stringBuilder = new();
83-
_ = stringBuilder.AppendLine(
84-
"""
85-
// This file is generated by LanguageTagsCreate
83+
_ = stringBuilder
84+
.Append(
85+
"""
86+
// This file is generated by LanguageTagsCreate
8687
87-
namespace ptr727.LanguageTags;
88+
namespace ptr727.LanguageTags;
8889
89-
public partial class Iso6393Data
90-
{
91-
public static Iso6393Data Create() =>
92-
new()
93-
{
94-
RecordList =
95-
[
96-
"""
97-
);
90+
public partial class Iso6393Data
91+
{
92+
public static Iso6393Data Create() =>
93+
new()
94+
{
95+
RecordList =
96+
[
97+
"""
98+
)
99+
.Append("\r\n");
98100

99101
foreach (Record record in iso6393.RecordList)
100102
{
101-
_ = stringBuilder.AppendLine(
102-
CultureInfo.InvariantCulture,
103-
$$"""
104-
new()
105-
{
106-
"""
107-
);
103+
_ = stringBuilder
104+
.Append(
105+
CultureInfo.InvariantCulture,
106+
$$"""
107+
new()
108+
{
109+
"""
110+
)
111+
.Append("\r\n");
108112
if (!string.IsNullOrEmpty(record.Id))
109113
{
110-
_ = stringBuilder.AppendLine(
111-
CultureInfo.InvariantCulture,
112-
$" Id = \"{record.Id}\","
113-
);
114+
_ = stringBuilder
115+
.Append(
116+
CultureInfo.InvariantCulture,
117+
$" Id = \"{record.Id}\","
118+
)
119+
.Append("\r\n");
114120
}
115121
if (!string.IsNullOrEmpty(record.Part2B))
116122
{
117-
_ = stringBuilder.AppendLine(
118-
CultureInfo.InvariantCulture,
119-
$" Part2B = \"{record.Part2B}\","
120-
);
123+
_ = stringBuilder
124+
.Append(
125+
CultureInfo.InvariantCulture,
126+
$" Part2B = \"{record.Part2B}\","
127+
)
128+
.Append("\r\n");
121129
}
122130
if (!string.IsNullOrEmpty(record.Part2T))
123131
{
124-
_ = stringBuilder.AppendLine(
125-
CultureInfo.InvariantCulture,
126-
$" Part2T = \"{record.Part2T}\","
127-
);
132+
_ = stringBuilder
133+
.Append(
134+
CultureInfo.InvariantCulture,
135+
$" Part2T = \"{record.Part2T}\","
136+
)
137+
.Append("\r\n");
128138
}
129139
if (!string.IsNullOrEmpty(record.Part1))
130140
{
131-
_ = stringBuilder.AppendLine(
132-
CultureInfo.InvariantCulture,
133-
$" Part1 = \"{record.Part1}\","
134-
);
141+
_ = stringBuilder
142+
.Append(
143+
CultureInfo.InvariantCulture,
144+
$" Part1 = \"{record.Part1}\","
145+
)
146+
.Append("\r\n");
135147
}
136148
if (!string.IsNullOrEmpty(record.Scope))
137149
{
138-
_ = stringBuilder.AppendLine(
139-
CultureInfo.InvariantCulture,
140-
$" Scope = \"{record.Scope}\","
141-
);
150+
_ = stringBuilder
151+
.Append(
152+
CultureInfo.InvariantCulture,
153+
$" Scope = \"{record.Scope}\","
154+
)
155+
.Append("\r\n");
142156
}
143157
if (!string.IsNullOrEmpty(record.LanguageType))
144158
{
145-
_ = stringBuilder.AppendLine(
146-
CultureInfo.InvariantCulture,
147-
$" LanguageType = \"{record.LanguageType}\","
148-
);
159+
_ = stringBuilder
160+
.Append(
161+
CultureInfo.InvariantCulture,
162+
$" LanguageType = \"{record.LanguageType}\","
163+
)
164+
.Append("\r\n");
149165
}
150166
if (!string.IsNullOrEmpty(record.RefName))
151167
{
152-
_ = stringBuilder.AppendLine(
153-
CultureInfo.InvariantCulture,
154-
$" RefName = \"{record.RefName}\","
155-
);
168+
_ = stringBuilder
169+
.Append(
170+
CultureInfo.InvariantCulture,
171+
$" RefName = \"{record.RefName}\","
172+
)
173+
.Append("\r\n");
156174
}
157175
if (!string.IsNullOrEmpty(record.Comment))
158176
{
159-
_ = stringBuilder.AppendLine(
160-
CultureInfo.InvariantCulture,
161-
$" Comment = \"{record.Comment}\","
162-
);
177+
_ = stringBuilder
178+
.Append(
179+
CultureInfo.InvariantCulture,
180+
$" Comment = \"{record.Comment}\","
181+
)
182+
.Append("\r\n");
163183
}
164-
_ = stringBuilder.AppendLine(
184+
_ = stringBuilder
185+
.Append(
186+
"""
187+
},
188+
"""
189+
)
190+
.Append("\r\n");
191+
}
192+
_ = stringBuilder
193+
.Append(
165194
"""
166-
},
195+
],
196+
};
197+
}
167198
"""
168-
);
169-
}
170-
_ = stringBuilder.AppendLine(
171-
"""
172-
],
173-
};
174-
}
175-
"""
176-
);
199+
)
200+
.Append("\r\n");
177201

178202
Iso6392Data.WriteFile(fileName, stringBuilder.ToString());
179203
}

0 commit comments

Comments
 (0)