MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / parseChangelog

Function parseChangelog

scripts/format-changelog.js:173–197  ·  view source on GitHub ↗
(changelog)

Source from the content-addressed store, hash-verified

171}
172
173function parseChangelog(changelog) {
174 // Split the changelog into lines but also keep the line numbers.
175 const lines = changelog.split('\n').map((text, index) => ({ text, index }));
176
177 // Remove duplicate empty lines.
178 for (var i = 0; i < lines.length; i++) {
179 if (lines[i].text == "" && (i == 0 || lines[i - 1].text == "")) {
180 lines.splice(i, 1);
181 i--;
182 }
183 }
184
185 var ctx = {
186 lines,
187 lineIndex: 0,
188 versions: []
189 };
190
191 while (ctx.lineIndex < ctx.lines.length) {
192 const versionBlock = readVersionBlock(ctx);
193 ctx.versions.push(versionBlock);
194 }
195
196 return ctx.versions;
197}
198
199function referenceSort(a, b) {
200 // Extract the number from the reference

Callers 1

Calls 2

readVersionBlockFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected