spec-up-t 0.11.12 → 0.11.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,59 +0,0 @@
1
- /**
2
- * @file This file processes the glossary file, ensuring that there is a blank line after each definition and adding a '~' prefix to any lines that do not start with '[[def:' and are not empty.
3
- * @author Kor Dwarshuis
4
- * @version 1.0.0
5
- * @since 2024-06-09
6
- */
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
-
11
- module.exports = {
12
- fixGlossaryFile: function (glossaryFileToBeFixed) {
13
-
14
- /* CONFIG */
15
- // const glossaryFileToBeFixed = './spec/terms_and_definitions.md';
16
- /* END CONFIG */
17
-
18
- let glossaryFileContent = fs.readFileSync(glossaryFileToBeFixed, 'utf8');
19
-
20
- let lines = glossaryFileContent.split('\n');
21
- let newLines = [];
22
- let previousLine = '';
23
-
24
- /**
25
- * Processes the lines of a glossary file, ensuring that there is a blank line after each definition.
26
- */
27
- for (let i = 0; i < lines.length; i++) {
28
- if (previousLine.startsWith('[[def:')) {
29
- if (lines[i].trim() !== '') {
30
- newLines.push('');
31
- }
32
- }
33
- newLines.push(lines[i]);
34
- previousLine = lines[i];
35
- }
36
-
37
- glossaryFileContent = newLines.join('\n');
38
-
39
- fs.writeFileSync(glossaryFileToBeFixed, glossaryFileContent);
40
-
41
- lines = glossaryFileContent.split('\n');
42
- newLines = [];
43
-
44
- /**
45
- * Processes the lines in the glossary file, adding a '~' prefix to any lines that do not start with '[[def:' and are not empty.
46
- */
47
- for (let i = 0; i < lines.length; i++) {
48
- if (!lines[i].startsWith('[[def:') && lines[i].trim() !== '' && !lines[i].startsWith('~')) {
49
- newLines.push('~ ' + lines[i]);
50
- } else {
51
- newLines.push(lines[i]);
52
- }
53
- }
54
-
55
- glossaryFileContent = newLines.join('\n');
56
-
57
- fs.writeFileSync(glossaryFileToBeFixed, glossaryFileContent);
58
- }
59
- }