Skip to content

Commit ef2ed89

Browse files
authored
Merge pull request #42 from Ellerbach/tocgenerator-small-fixes
DocFxTocGenerator: Limit warnings and README format fix
2 parents 217f56c + b5cd027 commit ef2ed89

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository contains a series of tools, templates, tips and tricks to make y
77
* [DocFxTocGenerator](./src/DocFxTocGenerator): generate a Table of Contents (TOC) in YAML format for DocFX. It has features like the ability to configure the order of files and the names of documents and folders.
88
* [DocLinkChecker](./src/DocLinkChecker): validate links in documents and check for orphaned attachments in the `.attachments` folder. The tool indicates whether there are errors or warnings, so it can be used in a CI pipeline. It can also clean up orphaned attachments automatically. And it can validate table syntax.
99
* [DocLanguageTranslator](./src/DocLanguageTranslator): allows to generate and translate automatically missing files or identify missing files in multi language pattern directories.
10-
* 🆕 [DocFxOpenApi](./src/DocFxOpenApi): converts existing [OpenAPI](https://www.openapis.org/) specification files into the format compatible with DocFX (OpenAPI v2 JSON files). It allows DocFX to generate HTML pages from the OpenAPI specification. OpenAPI is also known as [Swagger](https://swagger.io/).
10+
* [DocFxOpenApi](./src/DocFxOpenApi): converts existing [OpenAPI](https://www.openapis.org/) specification files into the format compatible with DocFX (OpenAPI v2 JSON files). It allows DocFX to generate HTML pages from the OpenAPI specification. OpenAPI is also known as [Swagger](https://swagger.io/).
1111

1212
## Creating PR's
1313

src/DocFxTocGenerator/Properties/launchSettings.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/DocFxTocGenerator/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ This tool allow to generate a yaml compatible `toc.yml` file for DocFX.
77
```text
88
TocGenerator -d <docs folder> [-o <output folder>] [-vsi]
99
10-
-d, --docfolder Required. Folder containing the documents.
11-
-o, --outputfolder Folder to write the resulting toc.yml in.
12-
-v, --verbose Show verbose messages.
13-
-s, --sequence Use the .order files for TOC sequence. Format are raws of: filename-without-extension
14-
-r, --override Use the .override files for TOC file name override. Format are raws of: filename-without-extension;Title you want
15-
-i, --index Auto-generate a file index in each folder.
16-
-g, --ignore Use the .ignore files for TOC directory ignore. Format are raws of directory names: directory-to-ignore
17-
-m, --multitoc <depth> Generate multiple toc files for child folders down to a certain child depth, default is 0 (root only generation).
18-
--help Display this help screen.
19-
--version Display version information.
10+
-d, --docfolder Required. Folder containing the documents.
11+
-o, --outputfolder Folder to write the resulting toc.yml in.
12+
-v, --verbose Show verbose messages.
13+
-s, --sequence Use the .order files for TOC sequence. Format are raws of: filename-without-extension
14+
-r, --override Use the .override files for TOC file name override. Format are raws of: filename-without-extension;Title you want
15+
-i, --index Auto-generate a file index in each folder.
16+
-g, --ignore Use the .ignore files for TOC directory ignore. Format are raws of directory names: directory-to-ignore
17+
-m, --multitoc <depth> Generate multiple toc files for child folders down to a certain child depth, default is 0 (root only generation).
18+
--help Display this help screen.
19+
--version Display version information.
2020
```
2121

2222
If the `-o or --outputfolder` is not provided, the output folder is set to the docfolder.

src/DocFxTocGenerator/TocGenerator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,11 @@ private static void GetDirectories(DirectoryInfo folder, List<string> order, Toc
361361
FileInfo[] subFiles = _filePatternsForToc
362362
.SelectMany(pattern => dirInfo.GetFiles(pattern, _caseSetting))
363363
.ToArray();
364-
if (subFiles.Any() == false)
364+
365+
// Given warning we will stop in this folder when
366+
// 1) we don't have any markdown or API specs in this folder
367+
// 2) there are subfolders
368+
if (subFiles.Any() == false && Directory.GetDirectories(dirInfo.FullName).Length > 0)
365369
{
366370
_message.Warning($"WARNING: Folder {dirInfo.FullName} skipped as it doesn't contain {_filePatternsForTocJoined} files. This might skip further sub-folders. Solve this by adding a README.md or INDEX.md in the folder.");
367371
continue;

0 commit comments

Comments
 (0)