Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private FileModel GenerateNewFileModel(FileModel model, RestApiRootItemViewModel
{
LocalPathFromRoot = model.LocalPathFromRoot,
Uids = CalculateUids(tagModel).Select(i => new UidDefinition(i, model.LocalPathFromRoot)).ToImmutableArray()
};
};

return newModel;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.App/Config/ContentPairingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ internal class ContentPairingInfo

[JsonProperty("overwriteFragmentsFolder")]
public string OverwriteFragmentsFolder { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.DocAsCode.Glob;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Glob;

namespace Microsoft.DocAsCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteStartArray();
foreach(var item in (ListWithStringFallback)value)
foreach (var item in (ListWithStringFallback)value)
{
serializer.Serialize(writer, item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ internal class WkhtmltopdfJsonConfig
/// </summary>
[JsonProperty("additionalArguments")]
public string AdditionalArguments { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.App/Docset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static Task Build(string configPath)
{
return Build(configPath, new());
}

/// <summary>
/// Builds a docset specified by docfx.json config.
/// </summary>
Expand Down
5 changes: 2 additions & 3 deletions src/Microsoft.DocAsCode.App/Helpers/MetadataMerger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Immutable;

using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Build.Engine;
using Microsoft.DocAsCode.Build.ManagedReference;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.DataContracts.Common;
using Microsoft.DocAsCode.DataContracts.ManagedReference;
using Microsoft.DocAsCode.Plugins;
using Microsoft.DocAsCode.MarkdigEngine;
using Microsoft.DocAsCode.Plugins;

namespace Microsoft.DocAsCode;

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.App/RunBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static string Exec(BuildJsonConfig config, BuildOptions options, string c
// TODO: remove BaseDirectory from Config, it may cause potential issue when abused
var baseDirectory = EnvironmentContext.BaseDirectory;
var outputFolder = Path.GetFullPath(Path.Combine(
string.IsNullOrEmpty(outputDirectory) ? Path.Combine(baseDirectory, config.Output ?? "") : outputDirectory,
string.IsNullOrEmpty(outputDirectory) ? Path.Combine(baseDirectory, config.Output ?? "") : outputDirectory,
config.Destination ?? ""));

try
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.App/RunPdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void Exec(PdfJsonConfig config, BuildOptions buildOptions, string
}

var outputFolder = Path.GetFullPath(Path.Combine(
string.IsNullOrEmpty(outputDirectory) ? Path.Combine(baseDirectory, config.Output ?? "") : outputDirectory,
string.IsNullOrEmpty(outputDirectory) ? Path.Combine(baseDirectory, config.Output ?? "") : outputDirectory,
config.Destination ?? ""));

var rawOutputFolder = string.IsNullOrEmpty(config.RawOutputFolder) ? Path.Combine(outputFolder, "_raw") : config.RawOutputFolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Microsoft.DocAsCode.Build.Common;

public abstract class BaseModelAttributeHandler<T> : IModelAttributeHandler where T: Attribute
public abstract class BaseModelAttributeHandler<T> : IModelAttributeHandler where T : Attribute
{
private const int MaximumNestedLevel = 32;
private readonly TypeInfo _typeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Immutable;

using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Common.EntityMergers;
using Microsoft.DocAsCode.DataContracts.Common;
using Microsoft.DocAsCode.Plugins;
using Microsoft.DocAsCode.Common.EntityMergers;

using YamlDotNet.Core;

namespace Microsoft.DocAsCode.Build.Common;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Immutable;

using Newtonsoft.Json;
using YamlDotNet.Serialization;

using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.DataContracts.Common;
using Microsoft.DocAsCode.Plugins;
using Microsoft.DocAsCode.YamlSerialization;
using Newtonsoft.Json;
using YamlDotNet.Serialization;

namespace Microsoft.DocAsCode.Build.Common;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using YamlDotNet.Serialization;
using YamlDotNet.Core;
using YamlDotNet.Serialization.Utilities;

using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.DataContracts.Common;
using Microsoft.DocAsCode.Plugins;

using YamlDotNet.Core;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.Utilities;
using Constants = Microsoft.DocAsCode.DataContracts.Common.Constants;
using YamlDeserializer = Microsoft.DocAsCode.YamlSerialization.YamlDeserializer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override void Build(FileModel model, IHostService host)
return;
}
var metadata = ((Dictionary<string, object>)model.Content).ToImmutableDictionary().Remove(ConceptualKey);
if(!model.Properties.IsUserDefinedTitle)
if (!model.Properties.IsUserDefinedTitle)
{
metadata = metadata.Remove(Constants.PropertyName.Title);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Microsoft.DocAsCode.Build.Engine/DocumentBuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public sealed class DocumentBuildContext : IDocumentBuildContext

public DocumentBuildContext(string buildOutputFolder)
: this(buildOutputFolder, Enumerable.Empty<FileAndType>(), ImmutableArray<string>.Empty, ImmutableArray<string>.Empty, 1, Directory.GetCurrentDirectory(), string.Empty, null, null) { }

public DocumentBuildContext(string buildOutputFolder, IEnumerable<FileAndType> allSourceFiles, ImmutableArray<string> externalReferencePackages, ImmutableArray<string> xrefMaps, int maxParallelism, string baseFolder, string versionName, ApplyTemplateSettings applyTemplateSetting, string rootTocPath)
: this(buildOutputFolder, allSourceFiles, externalReferencePackages, xrefMaps, maxParallelism, baseFolder, versionName, applyTemplateSetting, rootTocPath, null) { }

Expand Down Expand Up @@ -287,11 +287,11 @@ private List<XRefMap> LoadXRefMaps()
{
Logger.LogInfo($"Downloading xref maps from:{Environment.NewLine}{string.Join(Environment.NewLine, _xrefMapUrls)}");
var mapTasks = (from url in _xrefMapUrls
select LoadXRefMap(url, _client)).ToArray();
select LoadXRefMap(url, _client)).ToArray();
Task.WaitAll(mapTasks);
return (from t in mapTasks
where t.Result != null
select t.Result).ToList();
where t.Result != null
select t.Result).ToList();
}

private async Task<XRefMap> LoadXRefMap(string url, HttpClient client)
Expand Down
4 changes: 1 addition & 3 deletions src/Microsoft.DocAsCode.Build.Engine/DocumentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
using System.Composition.Hosting;
using System.Reflection;
using System.Text;

using Newtonsoft.Json;

using Microsoft.DocAsCode.Build.SchemaDriven;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.MarkdigEngine;
using Microsoft.DocAsCode.Plugins;
using Newtonsoft.Json;

namespace Microsoft.DocAsCode.Build.Engine;

Expand Down
4 changes: 1 addition & 3 deletions src/Microsoft.DocAsCode.Build.Engine/MarkupResultUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@

using System.Collections.Immutable;
using System.Net;

using HtmlAgilityPack;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Plugins;

using HtmlAgilityPack;

namespace Microsoft.DocAsCode.Build.Engine;

public static class MarkupUtility
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using HtmlAgilityPack;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Plugins;

using HtmlAgilityPack;

namespace Microsoft.DocAsCode.Build.Engine;

public abstract class HtmlDocumentHandler : IHtmlDocumentHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public override int GetHashCode()
{
return Title.GetHashCode() ^ Href.GetHashCode() ^ Keywords.GetHashCode();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override Stream GetResourceStream(string name)
{
for (var i = _readers.Length - 1; i >= 0; i--)
{
if (_readers[i].GetResourceStream(name) is {} result)
if (_readers[i].GetResourceStream(name) is { } result)
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public virtual string GetResource(string name)

public IEnumerable<ResourceInfo> GetResources(string selector = null)
{
foreach(var pair in GetResourceStreams(selector))
foreach (var pair in GetResourceStreams(selector))
{
using (pair.Value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private sealed class FileInfo

public string FilePath { get; set; }

public RelativePath RelativePath{ get; set; }
public RelativePath RelativePath { get; set; }

public FileInfo(string key, string filePath)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static JsValue ConvertObjectToJsValue(Jint.Engine engine, object raw)
}
else if (raw is IList<object> list)
{
var jsArray = new JsArray(engine, (uint) list.Count);
var jsArray = new JsArray(engine, (uint)list.Count);
foreach (var item in list)
{
jsArray.Push(ConvertObjectToJsValue(engine, item));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Jint.Native.Function;

using Jint;
using Jint.Native;
using Jint.Native.Function;
using Jint.Native.Object;
using Microsoft.DocAsCode.Common;

Expand Down Expand Up @@ -178,7 +177,7 @@ private Jint.Engine CreateEngine(Jint.Engine engine, params string[] sharedVaria
var newEngine = CreateDefaultEngine();
if (sharedVariables != null)
{
foreach(var sharedVariable in sharedVariables)
foreach (var sharedVariable in sharedVariables)
{
newEngine.SetValue(sharedVariable, engine.GetValue(sharedVariable));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public string GetHrefFromRoot(string originalHref, string sourceFileKey)
var file = path.GetPathFromWorkingFolder().UrlDecode();
if (!_context.AllSourceFiles.ContainsKey(file))
{
Logger.LogWarning($"Invalid file link: ({originalHref})", file:sourceFileKey, code:WarningCodes.Build.InvalidFileLink);
Logger.LogWarning($"Invalid file link: ({originalHref})", file: sourceFileKey, code: WarningCodes.Build.InvalidFileLink);
return originalHref;
}
return file.UrlEncode().ToString() + UriUtility.GetQueryStringAndFragment(originalHref);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Newtonsoft.Json.Linq;

using Microsoft.DocAsCode.Common;
using Newtonsoft.Json.Linq;

namespace Microsoft.DocAsCode.Build.Engine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ public TemplatePageLoader(IResourceFileReader reader, DocumentBuildContext conte

public IEnumerable<Template> LoadAll()
{
foreach(var render in _rendererLoader.LoadAll())
foreach (var render in _rendererLoader.LoadAll())
{
var preprocessors = _preprocessorLoader.LoadFromRenderer(render).ToList();
if (preprocessors.Count > 1)
{
Logger.Log(
LogLevel.Warning,
LogLevel.Warning,
$"Multiple template preprocessors '{preprocessors.Select(s => s.Path).ToDelimitedString()}'(case insensitive) are found for template page '{preprocessors[0].Name}', '{preprocessors[0].Path}' is used and others are ignored.");
}

yield return new Template(render, preprocessors.FirstOrDefault());
}

foreach(var p in _preprocessorLoader.LoadStandalones())
foreach (var p in _preprocessorLoader.LoadStandalones())
{
yield return new Template(null, p);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Text.RegularExpressions;
using Stubble.Core.Builders;
using Stubble.Core.Interfaces;
using System.Text.RegularExpressions;

namespace Microsoft.DocAsCode.Build.Engine;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Stubble.Core.Interfaces;
using System.Collections.Concurrent;
using Stubble.Core.Interfaces;

namespace Microsoft.DocAsCode.Build.Engine;

Expand Down
3 changes: 1 addition & 2 deletions src/Microsoft.DocAsCode.Build.Engine/XRefMaps/XRefMap.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using YamlDotNet.Serialization;

using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Plugins;
using Microsoft.DocAsCode.YamlSerialization;
using Newtonsoft.Json;
using YamlDotNet.Serialization;

namespace Microsoft.DocAsCode.Build.Engine;

Expand Down
6 changes: 2 additions & 4 deletions src/Microsoft.DocAsCode.Build.Engine/XrefDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
using System.Collections.Specialized;
using System.Net;
using System.Web;

using Microsoft.DocAsCode.Plugins;
using Microsoft.DocAsCode.Common;

using HtmlAgilityPack;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Plugins;

namespace Microsoft.DocAsCode.Build.Engine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Immutable;

using Newtonsoft.Json.Linq;

using Microsoft.DocAsCode.Build.Common;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.DataContracts.ManagedReference;
using Microsoft.DocAsCode.Plugins;
using Newtonsoft.Json.Linq;

namespace Microsoft.DocAsCode.Build.ManagedReference;

Expand Down
Loading