@@ -46,14 +46,102 @@ class Fixture {
46
46
}
47
47
48
48
static normaliseNewLines ( doclets ) {
49
- const input = JSON . stringify ( doclets )
49
+ const input = JSON . stringify ( doclets , null , ' ' )
50
50
/* Normalise all newlines to posix style to avoid differences while testing on Windows */
51
- let result = input . replace ( / \r ? \n / gm, '\n' )
51
+ let result = input . replace ( / \\ r ? \\ n / gm, '\ \n' )
52
52
/* Additional check for naked \r characters created by jsdoc */
53
53
/* See: https://github.com/jsdoc2md/dmd/issues/102 */
54
- result = result . replace ( / \r (? ! \n ) / g, '\n' )
54
+ result = result . replace ( / \\ r (? ! \\ n ) / g, '\\n' )
55
+ console . log ( result )
55
56
return JSON . parse ( result )
56
57
}
57
58
}
58
59
59
60
export default Fixture
61
+
62
+ // const a = [
63
+ // {
64
+ // comment: '/**\r\n' +
65
+ // 'the constructor description\r\n' +
66
+ // '@class\r\n' +
67
+ // '@classdesc a class with all of the things\r\n' +
68
+ // '@param {object} - an input\r\n' +
69
+ // '@param [options] {object} - optional shit\r\n' +
70
+ // '@author 75lb <75pound@gmail.com>\r\n' +
71
+ // '@deprecated\r\n' +
72
+ // '@since v0.10.28\r\n' +
73
+ // '@extends {Number}\r\n' +
74
+ // '@example\r\n' +
75
+ // '```js\r\n' +
76
+ // 'var yeah = new Everything(true)\r\n' +
77
+ // '```\r\n' +
78
+ // '*/',
79
+ // meta: {
80
+ // filename: '0-src.js',
81
+ // lineno: 16,
82
+ // columnno: 0,
83
+ // path: 'D:\\a\\jsdoc-api\\jsdoc-api\\test\\fixture\\class-all',
84
+ // },
85
+ // description: 'the constructor description',
86
+ // kind: 'class',
87
+ // classdesc: 'a class with all of the things',
88
+ // author: [ '75lb <75pound@gmail.com>' ],
89
+ // deprecated: true,
90
+ // since: 'v0.10.28',
91
+ // augments: [ 'Number' ],
92
+ // examples: [ '```js\r\nvar yeah = new Everything(true)\r\n```' ],
93
+ // name: 'All',
94
+ // longname: 'All',
95
+ // scope: 'global'
96
+ // },
97
+ // {
98
+ // comment: '/**\r\n' +
99
+ // ' the ingredients on top\r\n' +
100
+ // ' @default\r\n' +
101
+ // ' @type {string}\r\n' +
102
+ // ' @since v1.0.0\r\n' +
103
+ // ' */',
104
+ // meta: {
105
+ // filename: '0-src.js',
106
+ // lineno: 44,
107
+ // columnno: 0,
108
+ // path: 'D:\\a\\jsdoc-api\\jsdoc-api\\test\\fixture\\class-all',
109
+ // },
110
+ // description: 'This function has all tags set',
111
+ // deprecated: true,
112
+ // author: [ 'Lloyd <75pound@gmail.com>' ],
113
+ // since: 'v0.10.28',
114
+ // examples: [ '```js\r\nall.allTogether(true)\r\n```' ],
115
+ // name: 'allThings',
116
+ // longname: 'All#allThings',
117
+ // kind: 'function',
118
+ // memberof: 'All',
119
+ // scope: 'instance'
120
+ // },
121
+ // {
122
+ // comment: '/**\r\n a rarseclart inner\r\n */',
123
+ // meta: {
124
+ // filename: '0-src.js',
125
+ // lineno: 48,
126
+ // columnno: 6,
127
+ // path: 'D:\\a\\jsdoc-api\\jsdoc-api\\test\\fixture\\class-all',
128
+ // },
129
+ // description: 'a rarseclart inner',
130
+ // name: 'some',
131
+ // longname: 'All#allThings~some',
132
+ // kind: 'member',
133
+ // memberof: 'All#allThings',
134
+ // scope: 'inner',
135
+ // params: []
136
+ // },
137
+ // {
138
+ // kind: 'package',
139
+ // longname: 'package:undefined',
140
+ // files: [
141
+ // 'D:\\a\\jsdoc-api\\jsdoc-api\\test\\fixture\\class-all\\0-src.js'
142
+ // ]
143
+ // }
144
+ // ]
145
+
146
+ // const result = Fixture.normaliseNewLines(a)
147
+ // // console.log(result)
0 commit comments