Skip to content

Commit 2214b4d

Browse files
authored
Fix generation of root file (#1221)
1 parent 2bc4356 commit 2214b4d

File tree

4 files changed

+7
-20
lines changed

4 files changed

+7
-20
lines changed

ChangeLog.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
- Fix [RCS1241](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1241) ([#1197](https://github.com/JosefPihrt/Roslynator/pull/1197)).
2525
- Fix [RCS1250](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1250) ([#1205](https://github.com/JosefPihrt/Roslynator/pull/1205)).
2626
- [CLI] Fix globbing ([#1215](https://github.com/JosefPihrt/Roslynator/pull/1215)).
27+
- [CLI] Fix generation of root file ([#1221](https://github.com/JosefPihrt/Roslynator/pull/1221)).
2728

2829
## [4.5.0] - 2023-08-27
2930

src/CommandLine/Commands/GenerateDocCommand.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ DocumentationWriter CreateDocumentationWriter(DocumentationContext context)
230230

231231
WriteLine($"Generate documentation to '{Options.Output}'", Verbosity.Minimal);
232232

233-
IEnumerable<DocumentationGeneratorResult> results = generator.Generate(heading: Options.Heading, cancellationToken);
233+
IEnumerable<DocumentationGeneratorResult> results = generator.Generate(cancellationToken);
234234

235235
if (DocumentationHost == DocumentationHost.Sphinx)
236236
{
@@ -283,6 +283,8 @@ private void GenerateRootFile(DocumentationGenerator generator)
283283
File.WriteAllText(rootFilePath, result.Content, _defaultEncoding);
284284

285285
WriteLine($"Documentation root successfully generated to '{rootFilePath}'.", Verbosity.Minimal);
286+
287+
generator.Options.RootDirectoryUrl = null;
286288
}
287289

288290
private static void AddTableOfContents(IEnumerable<DocumentationGeneratorResult> results)

src/Documentation/DocumentationGenerator.cs

+1-9
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,12 @@ private DocumentationWriter CreateWriter(ISymbol currentSymbol = null)
151151
return writer;
152152
}
153153

154-
public IEnumerable<DocumentationGeneratorResult> Generate(string heading = null, CancellationToken cancellationToken = default)
154+
public IEnumerable<DocumentationGeneratorResult> Generate(CancellationToken cancellationToken = default)
155155
{
156156
cancellationToken.ThrowIfCancellationRequested();
157157

158158
DocumentationDepth depth = Options.Depth;
159159

160-
using (DocumentationWriter writer = CreateWriter())
161-
{
162-
DocumentationGeneratorResult result = GenerateRoot(writer, heading);
163-
164-
if (result.Content is not null)
165-
yield return result;
166-
}
167-
168160
if (depth <= DocumentationDepth.Namespace)
169161
{
170162
IEnumerable<INamedTypeSymbol> typeSymbols = DocumentationModel.Types.Where(f => !Options.ShouldBeIgnored(f));

tools/generate_ref_docs.ps1

+2-10
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,5 @@ $rootDirectoryUrl="build/ref"
1111
--heading "Roslynator .NET API Reference" `
1212
--group-by-common-namespace `
1313
--ignored-common-parts content `
14-
--ignored-root-parts all `
15-
--max-derived-types 10
16-
17-
& $roslynatorExe generate-doc-root generate_ref_docs.sln `
18-
--properties Configuration=Release `
19-
-o "build/ref.md" `
20-
--host docusaurus `
21-
--heading "Roslynator .NET API Reference" `
22-
--ignored-parts content `
23-
--root-directory-url "ref"
14+
--max-derived-types 10 `
15+
--root-file-path "build/ref.md"

0 commit comments

Comments
 (0)