Skip to content

Commit 2bd545e

Browse files
authored
Merge pull request #953 from simontreanor/main
Add --ignoreuncategorized flag
2 parents cabcaf4 + ffddde7 commit 2bd545e

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

RELEASE_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 21.0.0-beta-005 - 2025-04-23
4+
5+
### Added
6+
* Add --ignoreuncategorized flag. [#953](https://github.com/fsprojects/FSharp.Formatting/pull/953)
7+
38
## 21.0.0-beta-004 - 2024-11-20
49

510
### Changed

docs/commandline.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The command line options accepted are:
2626
| `--input` | Input directory of content (default: `docs`) |
2727
| `--projects` | Project files to build API docs for outputs, defaults to all packable projects |
2828
| `--output` | Output Directory (default 'output' for 'build' and 'tmp/watch' for 'watch') |
29+
| `--ignoreuncategorized` | Disable generation of the 'Other' category in the navigation bar for uncategorized docs |
2930
| `--noapidocs` | Disable generation of API docs |
3031
| `--ignoreprojects` | Disable project cracking |
3132
| `--eval` | Evaluate F# fragments in scripts |

src/fsdocs-tool/BuildCommand.fs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,12 @@ type internal DocContent
687687
| _ -> () |]
688688

689689
member _.GetNavigationEntries
690-
(input, docModels: (string * bool * LiterateDocModel) list, currentPagePath: string option)
691-
=
690+
(
691+
input,
692+
docModels: (string * bool * LiterateDocModel) list,
693+
currentPagePath: string option,
694+
ignoreUncategorized: bool
695+
) =
692696
let modelsForList =
693697
[ for thing in docModels do
694698
match thing with
@@ -704,8 +708,15 @@ type internal DocContent
704708
| Some currentPagePath -> currentPagePath = inputFileFullPath }
705709
| _ -> () ]
706710

711+
let excludeUncategorized =
712+
if ignoreUncategorized then
713+
List.filter (fun (model: LiterateDocModel) -> model.Category.IsSome)
714+
else
715+
id
716+
707717
let modelsByCategory =
708718
modelsForList
719+
|> excludeUncategorized
709720
|> List.groupBy (fun (model) -> model.Category)
710721
|> List.sortBy (fun (_, ms) ->
711722
match ms.[0].CategoryIndex with
@@ -1296,6 +1307,12 @@ type CoreBuildOptions(watch) =
12961307
[<Option("noapidocs", Default = false, Required = false, HelpText = "Disable generation of API docs.")>]
12971308
member val noapidocs = false with get, set
12981309

1310+
[<Option("ignoreuncategorized",
1311+
Default = false,
1312+
Required = false,
1313+
HelpText = "Disable generation of 'Other' category for uncategorized docs.")>]
1314+
member val ignoreuncategorized = false with get, set
1315+
12991316
[<Option("ignoreprojects", Default = false, Required = false, HelpText = "Disable project cracking.")>]
13001317
member val ignoreprojects = false with get, set
13011318

@@ -1797,7 +1814,14 @@ type CoreBuildOptions(watch) =
17971814
let docModels = docContent.Convert(this.input, defaultTemplate, extraInputs)
17981815
let actualDocModels = docModels |> List.map fst |> List.choose id
17991816
let extrasForSearchIndex = docContent.GetSearchIndexEntries(actualDocModels)
1800-
let navEntriesWithoutActivePage = docContent.GetNavigationEntries(this.input, actualDocModels, None)
1817+
1818+
let navEntriesWithoutActivePage =
1819+
docContent.GetNavigationEntries(
1820+
this.input,
1821+
actualDocModels,
1822+
None,
1823+
ignoreUncategorized = this.ignoreuncategorized
1824+
)
18011825

18021826
let headTemplateContent =
18031827
let headTemplatePath = Path.Combine(this.input, "_head.html")
@@ -1847,7 +1871,8 @@ type CoreBuildOptions(watch) =
18471871
docContent.GetNavigationEntries(
18481872
this.input,
18491873
actualDocModels,
1850-
Some currentPagePath
1874+
Some currentPagePath,
1875+
ignoreUncategorized = this.ignoreuncategorized
18511876
)
18521877

18531878
globals

0 commit comments

Comments
 (0)