markdown_link_checker_sc 0.0.126 → 0.0.128
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.
- package/_link_checker_sc/ignore_errors.json +152 -0
- package/package.json +2 -1
- package/src/filters.js +35 -8
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "InternalLinkToHTML",
|
|
4
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
5
|
+
"link": {
|
|
6
|
+
"url": "../flight_modes/altitude_fw.html",
|
|
7
|
+
"text": "Altitude"
|
|
8
|
+
},
|
|
9
|
+
"hideReason": "Gas hasdfhasfkl"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "LinkedFileMissingAnchor",
|
|
13
|
+
"fileRelativeToRoot": "en\\config_heli\\README.md",
|
|
14
|
+
"link": {
|
|
15
|
+
"url": "../airframes/airframe_reference.md#copter_helicopter_generic_helicopter_%28tail_esc%29",
|
|
16
|
+
"text": "Generic Helicopter - with Tail ESC"
|
|
17
|
+
},
|
|
18
|
+
"hideReason": "n"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "InternalLinkToHTML",
|
|
22
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
23
|
+
"link": {
|
|
24
|
+
"url": "../flight_modes/position_fw.html",
|
|
25
|
+
"text": "Position"
|
|
26
|
+
},
|
|
27
|
+
"hideReason": "n"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"type": "InternalLinkToHTML",
|
|
31
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
32
|
+
"link": {
|
|
33
|
+
"url": "../flight_modes/stabilized_fw.html",
|
|
34
|
+
"text": "Stabilized"
|
|
35
|
+
},
|
|
36
|
+
"hideReason": "nnnn"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "InternalLinkToHTML",
|
|
40
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
41
|
+
"link": {
|
|
42
|
+
"url": "../flight_modes/acro_fw.html",
|
|
43
|
+
"text": "Acro"
|
|
44
|
+
},
|
|
45
|
+
"hideReason": "nnnnnn"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "InternalLinkToHTML",
|
|
49
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
50
|
+
"link": {
|
|
51
|
+
"url": "../flight_modes/manual_fw.html",
|
|
52
|
+
"text": "Manual"
|
|
53
|
+
},
|
|
54
|
+
"hideReason": "nnnnnnn"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"type": "InternalLinkToHTML",
|
|
58
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
59
|
+
"link": {
|
|
60
|
+
"url": "../flight_modes/position_mc.html",
|
|
61
|
+
"text": "Position"
|
|
62
|
+
},
|
|
63
|
+
"hideReason": "y"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "InternalLinkToHTML",
|
|
67
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
68
|
+
"link": {
|
|
69
|
+
"url": "../flight_modes/altitude_mc.html",
|
|
70
|
+
"text": "Altitude"
|
|
71
|
+
},
|
|
72
|
+
"hideReason": "y"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"type": "InternalLinkToHTML",
|
|
76
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
77
|
+
"link": {
|
|
78
|
+
"url": "../flight_modes/manual_stabilized_mc.html",
|
|
79
|
+
"text": "Manual/ Stabilized"
|
|
80
|
+
},
|
|
81
|
+
"hideReason": "y"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"type": "InternalLinkToHTML",
|
|
85
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
86
|
+
"link": {
|
|
87
|
+
"url": "../flight_modes/acro_mc.html",
|
|
88
|
+
"text": "Acro"
|
|
89
|
+
},
|
|
90
|
+
"hideReason": "y"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "InternalLinkToHTML",
|
|
94
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
95
|
+
"link": {
|
|
96
|
+
"url": "../flight_modes/orbit.html",
|
|
97
|
+
"text": "Orbit"
|
|
98
|
+
},
|
|
99
|
+
"hideReason": "y"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"type": "InternalLinkToHTML",
|
|
103
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
104
|
+
"link": {
|
|
105
|
+
"url": "../flight_modes/takeoff.html",
|
|
106
|
+
"text": "Takeoff"
|
|
107
|
+
},
|
|
108
|
+
"hideReason": "y"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"type": "InternalLinkToHTML",
|
|
112
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
113
|
+
"link": {
|
|
114
|
+
"url": "../flight_modes/land.html",
|
|
115
|
+
"text": "Land"
|
|
116
|
+
},
|
|
117
|
+
"hideReason": "y"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"type": "InternalLinkToHTML",
|
|
121
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
122
|
+
"link": {
|
|
123
|
+
"url": "../flight_modes/hold.html",
|
|
124
|
+
"text": "Hold"
|
|
125
|
+
},
|
|
126
|
+
"hideReason": "y"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"type": "InternalLinkToHTML",
|
|
130
|
+
"fileRelativeToRoot": "en\\flight_modes\\README.md",
|
|
131
|
+
"link": {
|
|
132
|
+
"url": "../flight_modes/return.html",
|
|
133
|
+
"text": "Return"
|
|
134
|
+
},
|
|
135
|
+
"hideReason": "y"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "PageNotInTOC",
|
|
139
|
+
"fileRelativeToRoot": "en\\middleware\\micrortps.md",
|
|
140
|
+
"hideReason": "Because we can"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "PageNotLinkedInternally",
|
|
144
|
+
"fileRelativeToRoot": "en\\middleware\\micrortps.md",
|
|
145
|
+
"hideReason": "hyy"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"type": "OrphanedImage",
|
|
149
|
+
"fileRelativeToRoot": "assets\\simulation\\gazebo_classic\\gazebo_offboard.webm",
|
|
150
|
+
"hideReason": "fhfh"
|
|
151
|
+
}
|
|
152
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown_link_checker_sc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.128",
|
|
4
4
|
"description": "Markdown Link Checker",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"commander": "^10.0.0",
|
|
26
|
+
"normalize-path": "^3.0.0",
|
|
26
27
|
"prompt-sync": "^4.2.0"
|
|
27
28
|
}
|
|
28
29
|
}
|
package/src/filters.js
CHANGED
|
@@ -2,6 +2,7 @@ import fs from "fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { sharedData } from "./shared_data.js";
|
|
4
4
|
import { logFunction } from "./helpers.js";
|
|
5
|
+
import normalize from 'normalize-path';
|
|
5
6
|
|
|
6
7
|
function filterIgnoreErrors(errors) {
|
|
7
8
|
// This method removes any errors that are in the ignore errors list
|
|
@@ -9,50 +10,76 @@ function filterIgnoreErrors(errors) {
|
|
|
9
10
|
|
|
10
11
|
// Currently it is the pages to output, as listed in the options.files to output.
|
|
11
12
|
logFunction(`Function: filterIgnoreErrors(${errors})`);
|
|
13
|
+
console.log(`number of errors to filter ${errors.length}`);
|
|
12
14
|
const errorFile = path.join(
|
|
13
15
|
sharedData.options.root,
|
|
14
16
|
"./_link_checker_sc/ignore_errors.json"
|
|
15
17
|
);
|
|
16
|
-
|
|
18
|
+
console.log(`root to load: ${sharedData.options.root}`);
|
|
19
|
+
console.log(`filename to load: ${errorFile}`);
|
|
17
20
|
|
|
18
21
|
try {
|
|
19
|
-
//sharedData.IgnoreErrors = require('./_link_checker_sc/ignore_errors.json');
|
|
20
22
|
const ignoreFromFile = fs.readFileSync(errorFile);
|
|
21
23
|
sharedData.IgnoreErrors = JSON.parse(ignoreFromFile);
|
|
24
|
+
|
|
25
|
+
//console.log(`len after import ${sharedData.ignoreFromFile.length()} `)
|
|
22
26
|
//sharedData.options.log.includes("quick") ? console.log(sharedData.IgnoreErrors) : null;
|
|
23
27
|
} catch (error) {
|
|
24
28
|
sharedData.IgnoreErrors = [];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
: null;
|
|
28
|
-
sharedData.options.log.includes("quick") ? console.log(error) : null;
|
|
29
|
+
console.log("Error loading IgnoreErrors");
|
|
30
|
+
console.log(error);
|
|
29
31
|
}
|
|
32
|
+
console.log(`number of elements on import ${sharedData.IgnoreErrors.length}`);
|
|
30
33
|
|
|
31
34
|
const filteredErrors = errors.filter((error) => {
|
|
32
35
|
let returnValue = true; //All items are not filtered, by default.
|
|
33
36
|
sharedData.IgnoreErrors.forEach((ignorableError) => {
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if (
|
|
40
|
+
error.type === ignorableError.type
|
|
41
|
+
) {
|
|
42
|
+
console.log("SameType");
|
|
43
|
+
console.log(`type: err: ${error.type} igenr: ${ignorableError.type}`)
|
|
44
|
+
console.log(`fileRelativeToRoot: err: ${error.fileRelativeToRoot} igenr: ${ignorableError.fileRelativeToRoot}`)
|
|
45
|
+
console.log(`NORMfileRelativeToRoot: err: ${path.normalize(error.fileRelativeToRoot)} igenr: ${path.normalize(ignorableError.fileRelativeToRoot)}`)
|
|
46
|
+
console.log(`NORM2fileRelativeToRoot: err: ${normalize(error.fileRelativeToRoot)} igenr: ${normalize(ignorableError.fileRelativeToRoot)}`)
|
|
47
|
+
|
|
48
|
+
if (path.normalize(error.fileRelativeToRoot) === path.normalize(ignorableError.fileRelativeToRoot)) {
|
|
49
|
+
console.log("norm equal");
|
|
50
|
+
} else {
|
|
51
|
+
console.log("norm notequal.")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
34
56
|
if (
|
|
35
57
|
error.type === ignorableError.type &&
|
|
36
58
|
path.normalize(error.fileRelativeToRoot) === path.normalize(ignorableError.fileRelativeToRoot)
|
|
37
59
|
) {
|
|
38
60
|
// Same file and type, so probably filter out.
|
|
39
61
|
if (!(error.link && ignorableError.link)) {
|
|
62
|
+
console.log("returnValue false")
|
|
40
63
|
returnValue = false; // Neither have a link, so we match on same type
|
|
64
|
+
} else {
|
|
65
|
+
console.log("returnvalue.true")
|
|
41
66
|
}
|
|
42
|
-
|
|
67
|
+
|
|
43
68
|
if (
|
|
44
69
|
error.link &&
|
|
45
70
|
ignorableError.link &&
|
|
46
71
|
error.link.url === ignorableError.link.url
|
|
47
72
|
) {
|
|
48
73
|
returnValue = false; // They both have a link and it is the same link
|
|
74
|
+
console.log("false - same link")
|
|
49
75
|
}
|
|
50
76
|
}
|
|
51
77
|
});
|
|
52
78
|
//if (returnValue ==false) console.log(error);
|
|
79
|
+
console.log(`Final retval: ${returnValue}`)
|
|
53
80
|
return returnValue;
|
|
54
81
|
});
|
|
55
|
-
|
|
82
|
+
console.log(`number of elements after ignorefilter ${filteredErrors.length}`);
|
|
56
83
|
return filteredErrors;
|
|
57
84
|
}
|
|
58
85
|
|