Skip to content

Commit

Permalink
ignore the no intersection between zone and file level monikers for a… (
Browse files Browse the repository at this point in the history
#8005)

* ignore the no intersection between zone and file level monikers for archived documents

* fix spelling

* update
  • Loading branch information
AngryBerryMS authored May 9, 2022
1 parent ce77e4b commit 6826d78
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ testsnippet
testtoken
textarea
tfoot
tfs
thead
tif
timespan
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ parameters:
params: /~https://github.com/dotnet/EntityFramework.ApiDocs --timeout 120
azure-docs-rest-apis:
params: /~https://github.com/Azure/azure-docs-rest-apis --timeout 130 --error-level Warning
dynamics365-docs-odata-apis:
params: /~https://github.com/MicrosoftDocs/dynamics365-docs-odata-apis --timeout 25
powerapps-docs-web-api-ref-pr:
params: /~https://github.com/MicrosoftDocs/powerapps-docs-web-api-ref-pr --timeout 25
mc-docs-pr:
params: /~https://github.com/MicrosoftDocs/mc-docs-pr --timeout 70
dynamics365smb-devitpro:
Expand Down
37 changes: 37 additions & 0 deletions docs/specs/moniker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2181,3 +2181,40 @@ outputs:
}
.publish.json:
17b9fe681514513cbf7d5c90e32f107a/docs/a.json:
---
# Ignore no intersection between zone and file monikers for archived documents
repos:
https://docs.com/monikers-in-op_aggregated_file_map_info.json:
- files:
docfx.json: |
{
"build": {
"groups": {"all": {"dest": "all", "moniker_range": "<= netcore-1.2 || tfs-2013"}},
"content": [{"files": ["**/*.md"], "group": "all"}],
"monikerDefinition": "monikerDefinition.json",
"fileMetadata": {
"replace_monikers": { "**/a.md": ["tfs-2013"] }
},
"globalMetadata": {"is_archived": "true"}
}
}
monikerDefinition.json: |
{
"monikers": [
{ "moniker_name": "netcore-1.0", "product_name": ".NET Core" },
{ "moniker_name": "netcore-1.1", "product_name": ".NET Core" },
{ "moniker_name": "netcore-1.2", "product_name": ".NET Core" },
{ "moniker_name": "tfs-2013", "product_name": "Azure Devops" }
]
}
a.md: |
::: moniker range="netcore-1.0"
moniker: netcore 1.0
::: moniker-end
::: moniker range="tfs-2013"
moniker: tfs-2013
::: moniker-end
outputs:
10b6c9f144d519f0f8a48bc02c54ca34/a.json: |
{"conceptual": "<div data-moniker=\"tfs-2013\">\n<p>moniker: tfs-2013</p>\n</div>\n"}
3 changes: 2 additions & 1 deletion src/docfx/build/moniker/MonikerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public MonikerList GetZoneLevelMonikers(ErrorBuilder errors, FilePath file, Sour
{
var configMonikerRange = GetConfigMonikerRange(file);
var (fileLevelMonikers, ignoreExclude) = GetFileLevelMonikersAndExclude(errors, file);
var isArchived = _metadataProvider.GetMetadata(errors, file).IsArchived;

// For conceptual docset,
// Moniker range not defined in docfx.yml/docfx.json,
Expand All @@ -86,7 +87,7 @@ public MonikerList GetZoneLevelMonikers(ErrorBuilder errors, FilePath file, Sour

var zoneLevelMonikers = _rangeParser.Parse(errors, rangeString);
var monikers = fileLevelMonikers.Intersect(zoneLevelMonikers);
if (!ignoreExclude.Intersect(zoneLevelMonikers).HasMonikers)
if (!ignoreExclude.Intersect(zoneLevelMonikers).HasMonikers && !isArchived)
{
errors.Add(Errors.Versioning.MonikerZoneEmpty(rangeString, zoneLevelMonikers, fileLevelMonikers));
}
Expand Down

0 comments on commit 6826d78

Please sign in to comment.