Skip to content

Commit

Permalink
Merge pull request #42 from Ellerbach/tocgenerator-small-fixes
Browse files Browse the repository at this point in the history
DocFxTocGenerator: Limit warnings and README format fix
  • Loading branch information
mtirionMSFT authored Nov 14, 2023
2 parents 217f56c + b5cd027 commit ef2ed89
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This repository contains a series of tools, templates, tips and tricks to make y
* [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.
* [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.
* [DocLanguageTranslator](./src/DocLanguageTranslator): allows to generate and translate automatically missing files or identify missing files in multi language pattern directories.
* 🆕 [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/).
* [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/).

## Creating PR's

Expand Down
8 changes: 0 additions & 8 deletions src/DocFxTocGenerator/Properties/launchSettings.json

This file was deleted.

20 changes: 10 additions & 10 deletions src/DocFxTocGenerator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ This tool allow to generate a yaml compatible `toc.yml` file for DocFX.
```text
TocGenerator -d <docs folder> [-o <output folder>] [-vsi]
-d, --docfolder Required. Folder containing the documents.
-o, --outputfolder Folder to write the resulting toc.yml in.
-v, --verbose Show verbose messages.
-s, --sequence Use the .order files for TOC sequence. Format are raws of: filename-without-extension
-r, --override Use the .override files for TOC file name override. Format are raws of: filename-without-extension;Title you want
-i, --index Auto-generate a file index in each folder.
-g, --ignore Use the .ignore files for TOC directory ignore. Format are raws of directory names: directory-to-ignore
-m, --multitoc <depth> Generate multiple toc files for child folders down to a certain child depth, default is 0 (root only generation).
--help Display this help screen.
--version Display version information.
-d, --docfolder Required. Folder containing the documents.
-o, --outputfolder Folder to write the resulting toc.yml in.
-v, --verbose Show verbose messages.
-s, --sequence Use the .order files for TOC sequence. Format are raws of: filename-without-extension
-r, --override Use the .override files for TOC file name override. Format are raws of: filename-without-extension;Title you want
-i, --index Auto-generate a file index in each folder.
-g, --ignore Use the .ignore files for TOC directory ignore. Format are raws of directory names: directory-to-ignore
-m, --multitoc <depth> Generate multiple toc files for child folders down to a certain child depth, default is 0 (root only generation).
--help Display this help screen.
--version Display version information.
```

If the `-o or --outputfolder` is not provided, the output folder is set to the docfolder.
Expand Down
6 changes: 5 additions & 1 deletion src/DocFxTocGenerator/TocGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,11 @@ private static void GetDirectories(DirectoryInfo folder, List<string> order, Toc
FileInfo[] subFiles = _filePatternsForToc
.SelectMany(pattern => dirInfo.GetFiles(pattern, _caseSetting))
.ToArray();
if (subFiles.Any() == false)

// Given warning we will stop in this folder when
// 1) we don't have any markdown or API specs in this folder
// 2) there are subfolders
if (subFiles.Any() == false && Directory.GetDirectories(dirInfo.FullName).Length > 0)
{
_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.");
continue;
Expand Down

0 comments on commit ef2ed89

Please sign in to comment.