Skip to content

Commit fd0db17

Browse files
authored
Fix formatting of docc term list output (#773)
The term list output originally followed the markdown format and embedded the trailing `:` in the bold section, but DocC doesn't recognize the list element as a term list if the `:` is embedded, only if it's trailing. This PR resolves that situation and updates the associated snapshot tests. Fixes #772
1 parent 6d95a87 commit fd0db17

File tree

6 files changed

+52
-52
lines changed

6 files changed

+52
-52
lines changed

Tests/ArgumentParserGenerateDoccReferenceTests/Snapshots/testColorDoccReference().md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
color --fav=<fav> [--second=<second>] [--help]
77
```
88

9-
- term **--fav=\<fav\>:**
9+
- term **--fav=\<fav\>**:
1010

1111
*Your favorite color.*
1212

1313

14-
- term **--second=\<second\>:**
14+
- term **--second=\<second\>**:
1515

1616
*Your second favorite color.*
1717

1818
This is optional.
1919

2020

21-
- term **--help:**
21+
- term **--help**:
2222

2323
*Show help information.*
2424

@@ -31,7 +31,7 @@ Show subcommand help information.
3131
color help [<subcommands>...]
3232
```
3333

34-
- term **subcommands:**
34+
- term **subcommands**:
3535

3636

3737

Tests/ArgumentParserGenerateDoccReferenceTests/Snapshots/testCountLinesDoccReference().md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66
count-lines [<input-file>] [--prefix=<prefix>] [--verbose] [--help]
77
```
88

9-
- term **input-file:**
9+
- term **input-file**:
1010

1111
*A file to count lines in. If omitted, counts the lines of stdin.*
1212

1313

14-
- term **--prefix=\<prefix\>:**
14+
- term **--prefix=\<prefix\>**:
1515

1616
*Only count lines with this prefix.*
1717

1818

19-
- term **--verbose:**
19+
- term **--verbose**:
2020

2121
*Include extra information in the output.*
2222

2323

24-
- term **--help:**
24+
- term **--help**:
2525

2626
*Show help information.*
2727

@@ -34,7 +34,7 @@ Show subcommand help information.
3434
count-lines help [<subcommands>...]
3535
```
3636

37-
- term **subcommands:**
37+
- term **subcommands**:
3838

3939

4040

Tests/ArgumentParserGenerateDoccReferenceTests/Snapshots/testMathDoccReference().md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ A utility for performing maths.
88
math [--version] [--help]
99
```
1010

11-
- term **--version:**
11+
- term **--version**:
1212

1313
*Show the version.*
1414

1515

16-
- term **--help:**
16+
- term **--help**:
1717

1818
*Show help information.*
1919

@@ -26,22 +26,22 @@ Print the sum of the values.
2626
math add [--hex-output] [<values>...] [--version] [--help]
2727
```
2828

29-
- term **--hex-output:**
29+
- term **--hex-output**:
3030

3131
*Use hexadecimal notation for the result.*
3232

3333

34-
- term **values:**
34+
- term **values**:
3535

3636
*A group of integers to operate on.*
3737

3838

39-
- term **--version:**
39+
- term **--version**:
4040

4141
*Show the version.*
4242

4343

44-
- term **--help:**
44+
- term **--help**:
4545

4646
*Show help information.*
4747

@@ -56,22 +56,22 @@ Print the product of the values.
5656
math multiply [--hex-output] [<values>...] [--version] [--help]
5757
```
5858

59-
- term **--hex-output:**
59+
- term **--hex-output**:
6060

6161
*Use hexadecimal notation for the result.*
6262

6363

64-
- term **values:**
64+
- term **values**:
6565

6666
*A group of integers to operate on.*
6767

6868

69-
- term **--version:**
69+
- term **--version**:
7070

7171
*Show the version.*
7272

7373

74-
- term **--help:**
74+
- term **--help**:
7575

7676
*Show help information.*
7777

@@ -86,12 +86,12 @@ Calculate descriptive statistics.
8686
math stats [--version] [--help]
8787
```
8888

89-
- term **--version:**
89+
- term **--version**:
9090

9191
*Show the version.*
9292

9393

94-
- term **--help:**
94+
- term **--help**:
9595

9696
*Show help information.*
9797

@@ -104,22 +104,22 @@ Print the average of the values.
104104
math stats average [--kind=<kind>] [<values>...] [--version] [--help]
105105
```
106106

107-
- term **--kind=\<kind\>:**
107+
- term **--kind=\<kind\>**:
108108

109109
*The kind of average to provide.*
110110

111111

112-
- term **values:**
112+
- term **values**:
113113

114114
*A group of floating-point values to operate on.*
115115

116116

117-
- term **--version:**
117+
- term **--version**:
118118

119119
*Show the version.*
120120

121121

122-
- term **--help:**
122+
- term **--help**:
123123

124124
*Show help information.*
125125

@@ -134,17 +134,17 @@ Print the standard deviation of the values.
134134
math stats stdev [<values>...] [--version] [--help]
135135
```
136136

137-
- term **values:**
137+
- term **values**:
138138

139139
*A group of floating-point values to operate on.*
140140

141141

142-
- term **--version:**
142+
- term **--version**:
143143

144144
*Show the version.*
145145

146146

147-
- term **--help:**
147+
- term **--help**:
148148

149149
*Show help information.*
150150

@@ -159,41 +159,41 @@ Print the quantiles of the values (TBD).
159159
math stats quantiles [<one-of-four>] [<custom-arg>] [<custom-deprecated-arg>] [<values>...] [--file=<file>] [--directory=<directory>] [--shell=<shell>] [--custom=<custom>] [--custom-deprecated=<custom-deprecated>] [--version] [--help]
160160
```
161161

162-
- term **one-of-four:**
162+
- term **one-of-four**:
163163

164164

165-
- term **custom-arg:**
165+
- term **custom-arg**:
166166

167167

168-
- term **custom-deprecated-arg:**
168+
- term **custom-deprecated-arg**:
169169

170170

171-
- term **values:**
171+
- term **values**:
172172

173173
*A group of floating-point values to operate on.*
174174

175175

176-
- term **--file=\<file\>:**
176+
- term **--file=\<file\>**:
177177

178178

179-
- term **--directory=\<directory\>:**
179+
- term **--directory=\<directory\>**:
180180

181181

182-
- term **--shell=\<shell\>:**
182+
- term **--shell=\<shell\>**:
183183

184184

185-
- term **--custom=\<custom\>:**
185+
- term **--custom=\<custom\>**:
186186

187187

188-
- term **--custom-deprecated=\<custom-deprecated\>:**
188+
- term **--custom-deprecated=\<custom-deprecated\>**:
189189

190190

191-
- term **--version:**
191+
- term **--version**:
192192

193193
*Show the version.*
194194

195195

196-
- term **--help:**
196+
- term **--help**:
197197

198198
*Show help information.*
199199

@@ -210,7 +210,7 @@ Show subcommand help information.
210210
math help [<subcommands>...]
211211
```
212212

213-
- term **subcommands:**
213+
- term **subcommands**:
214214

215215

216216

Tests/ArgumentParserGenerateDoccReferenceTests/Snapshots/testRepeatDoccReference().md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66
repeat [--count=<count>] [--include-counter] <phrase> [--help]
77
```
88

9-
- term **--count=\<count\>:**
9+
- term **--count=\<count\>**:
1010

1111
*The number of times to repeat 'phrase'.*
1212

1313

14-
- term **--include-counter:**
14+
- term **--include-counter**:
1515

1616
*Include a counter with each repetition.*
1717

1818

19-
- term **phrase:**
19+
- term **phrase**:
2020

2121
*The phrase to repeat.*
2222

2323

24-
- term **--help:**
24+
- term **--help**:
2525

2626
*Show help information.*
2727

@@ -34,7 +34,7 @@ Show subcommand help information.
3434
repeat help [<subcommands>...]
3535
```
3636

37-
- term **subcommands:**
37+
- term **subcommands**:
3838

3939

4040

Tests/ArgumentParserGenerateDoccReferenceTests/Snapshots/testRollDoccReference().md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66
roll [--times=<n>] [--sides=<m>] [--seed=<seed>] [--verbose] [--help]
77
```
88

9-
- term **--times=\<n\>:**
9+
- term **--times=\<n\>**:
1010

1111
*Rolls the dice <n> times.*
1212

1313

14-
- term **--sides=\<m\>:**
14+
- term **--sides=\<m\>**:
1515

1616
*Rolls an <m>-sided dice.*
1717

1818
Use this option to override the default value of a six-sided die.
1919

2020

21-
- term **--seed=\<seed\>:**
21+
- term **--seed=\<seed\>**:
2222

2323
*A seed to use for repeatable random generation.*
2424

2525

26-
- term **--verbose:**
26+
- term **--verbose**:
2727

2828
*Show all roll results.*
2929

3030

31-
- term **--help:**
31+
- term **--help**:
3232

3333
*Show help information.*
3434

@@ -41,7 +41,7 @@ Show subcommand help information.
4141
roll help [<subcommands>...]
4242
```
4343

44-
- term **subcommands:**
44+
- term **subcommands**:
4545

4646

4747

Tools/generate-docc-reference/Extensions/ArgumentParser+Markdown.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extension CommandInfoV0 {
7474

7575
switch markdownStyle {
7676
case .docc:
77-
result += "- term **\(arg.identity()):**\n\n"
77+
result += "- term **\(arg.identity())**:\n\n"
7878
case .github:
7979
result += "**\(arg.identity()):**\n\n"
8080
}

0 commit comments

Comments
 (0)