mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-11-29 18:48:50 +08:00
docs: fix component descption generate (#4219)
* docs: fix component descption generate * fix * fix the url rewrite of azrure static webapp * fix build * fix js import * remove the doc dir from gitignore * test doc files * fix path * Revert "fix js import" This reverts commit f87f532c4476b184a797b4f6b4b0043aa4bd0132.
This commit is contained in:
parent
f0c5996cbd
commit
5830d9a601
5
.gitignore
vendored
5
.gitignore
vendored
@ -362,7 +362,4 @@ scripts/previewEditor/index.html
|
||||
site/AntDesign.Docs/wwwroot/color.less
|
||||
.history
|
||||
/components/LocalizedIntellisenseFiles/AntDesign.xml
|
||||
components/LocalizedIntellisenseFiles/AntDesign.xml
|
||||
|
||||
# Documentation is automatically generated by XML comments now
|
||||
site/AntDesign.Docs/Demos/Components/**/doc/**/*
|
||||
components/LocalizedIntellisenseFiles/AntDesign.xml
|
||||
|
@ -54,8 +54,6 @@ namespace AntDesign.Docs.Build.CLI.Command
|
||||
"StateHasChanged"
|
||||
};
|
||||
|
||||
private readonly Type _staticComponentPageType = typeof(IStaticComponentPage);
|
||||
|
||||
private readonly IEnumerable<MemberTypes> _supportedMemberTypes = new List<MemberTypes>
|
||||
{
|
||||
MemberTypes.Field,
|
||||
@ -183,47 +181,6 @@ namespace AntDesign.Docs.Build.CLI.Command
|
||||
{ Constants.ChineseLanguage, new List<DemoComponent>() }
|
||||
};
|
||||
|
||||
// recognize components by component attribute
|
||||
var docsStaticComponents = Assembly.Load(DocsAssemblyName).GetTypes().Where(x => x != _staticComponentPageType && x.IsAssignableTo(_staticComponentPageType));
|
||||
foreach (var component in docsStaticComponents)
|
||||
{
|
||||
var docAttribute = component.GetCustomAttribute<DocumentationAttribute>();
|
||||
if (docAttribute is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var componentName = GetNameWithoutGenerics(component);
|
||||
var title = docAttribute.Title ?? componentName;
|
||||
|
||||
var staticComponent = new DemoComponent()
|
||||
{
|
||||
Category = docAttribute.Category.ToString(),
|
||||
Title = title,
|
||||
SubTitle = docAttribute.SubTitle,
|
||||
Type = docAttribute.Type.ToString(),
|
||||
Desc = string.Empty,
|
||||
ApiDoc = string.Empty,
|
||||
Cols = docAttribute.Columns,
|
||||
Cover = docAttribute.CoverImageUrl,
|
||||
DemoList = new List<DemoItem>() {
|
||||
new()
|
||||
{
|
||||
Order = 0,
|
||||
Name = componentName,
|
||||
Title = title,
|
||||
Description = string.Empty,
|
||||
Type = component.Namespace.Replace(DocsAssemblyName + ".", string.Empty) + "." + component.Name,
|
||||
Style = "",
|
||||
Docs = true,
|
||||
Debug = false
|
||||
}
|
||||
}
|
||||
};
|
||||
componentsDocsByLanguage[Constants.EnglishLanguage].Add(staticComponent);
|
||||
componentsDocsByLanguage[Constants.ChineseLanguage].Add(staticComponent);
|
||||
}
|
||||
|
||||
var libraryComponents = _libraryAssembly.GetTypes().Where(x => x.GetType() != _componentBaseType);
|
||||
foreach (var component in libraryComponents)
|
||||
{
|
||||
@ -342,7 +299,7 @@ namespace AntDesign.Docs.Build.CLI.Command
|
||||
|
||||
private string GetFaqDocs(string componentName, string language)
|
||||
{
|
||||
var faqFile = new FileInfo(Path.Join(_demoDirectory, $"Components\\{componentName}\\faq.{language}.md"));
|
||||
var faqFile = new FileInfo(Path.Combine(_demoDirectory, "Components", componentName, $"faq.{language}.md"));
|
||||
if (faqFile.Exists)
|
||||
{
|
||||
var faqFileContent = File.ReadAllText(faqFile.FullName);
|
||||
@ -354,7 +311,7 @@ namespace AntDesign.Docs.Build.CLI.Command
|
||||
|
||||
private string GetComponentDocs(string componentName, string language)
|
||||
{
|
||||
var componentFile = new FileInfo(Path.Join(_demoDirectory, $"Components\\{componentName}\\doc\\index.{language}.md"));
|
||||
var componentFile = new FileInfo(Path.Combine(_demoDirectory, "Components", componentName, "doc", $"index.{language}.md"));
|
||||
if (componentFile.Exists)
|
||||
{
|
||||
var faqFileContent = File.ReadAllText(componentFile.FullName);
|
||||
@ -362,7 +319,7 @@ namespace AntDesign.Docs.Build.CLI.Command
|
||||
return docData.desc;
|
||||
}
|
||||
|
||||
return null;
|
||||
return componentFile.FullName;
|
||||
}
|
||||
|
||||
private string GetMemberXmlName(MemberInfo member)
|
||||
|
@ -72,7 +72,7 @@ namespace AntDesign.Docs.Build.CLI.Documentations
|
||||
Title = title,
|
||||
SubTitle = docAttribute.SubTitle,
|
||||
Type = docAttribute.Type.ToString(),
|
||||
Desc = componentSummary[language],
|
||||
Desc = componentSummary[language] ?? "no description",
|
||||
ApiDoc = allApiDocumentation.ToString(),
|
||||
Cols = docAttribute.Columns,
|
||||
Cover = docAttribute.CoverImageUrl,
|
||||
|
@ -1,5 +1,7 @@
|
||||
{
|
||||
"navigationFallback": {
|
||||
"rewrite": "/index.html"
|
||||
"responseOverrides": {
|
||||
"404": {
|
||||
"rewrite": "/index.html"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
namespace AntDesign.Docs
|
||||
{
|
||||
public interface IStaticComponentPage
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
|
||||
@page "/{locale}/components/overview"
|
||||
|
||||
@implements IStaticComponentPage
|
||||
@inject IStringLocalizer L
|
||||
@inject ILocalizationService LocalizationService
|
||||
@inject DemoService demoService
|
||||
|
Loading…
Reference in New Issue
Block a user