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
6 changes: 3 additions & 3 deletions src/BootstrapBlazor.Server/Components/Components/Pre.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ private string FindCodeSnippetByName(string code)
return content.TrimEnd('\n');
}

[GeneratedRegex("<section ignore[ \\s\\S]*?>[\\s\\S]*?</section>")]
[GeneratedRegex(@"<section ignore[ \s\S]*?>[\s\S]*?</section>")]
private static partial Regex IgnoreRegex();

[GeneratedRegex("<ConsoleLogger [\\s\\S]* />")]
[GeneratedRegex(@"<ConsoleLogger [\s\S]* />")]
private static partial Regex ConsoleLoggerRegex();

[GeneratedRegex("<Tips[\\s\\S]*>[\\s\\S]*?</Tips>")]
[GeneratedRegex(@"<Tips[\s\S]*>[\s\S]*?</Tips>")]
private static partial Regex TipsRegex();
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@

<PackageTips Name="BootstrapBlazor.BootstrapIcon" />

<Tips class="mt-3">
<div>@Localizer["P1"] <a href="https://www.nuget.org/packages/BootstrapBlazor.BootstrapIcon/" target="_blank">BootstrapBlazor.BootstrapIcon</a> @Localizer["P2"]</div>
</Tips>

<Pre>&lt;link href="_content/BootstrapBlazor.BootstrapIcon/css/bootstrap.min.css" rel="stylesheet"&gt;</Pre>

<div>@((MarkupString)Localizer["Icons"].Value)</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@

<PackageTips Name="BootstrapBlazor.MaterialDesign" />

<Tips class="mt-3">
<div>@Localizer["P1"] <a href="https://www.nuget.org/packages/BootstrapBlazor.MaterialDesign/" target="_blank">BootstrapBlazor.BootstrapIcon</a> @Localizer["P2"]</div>
</Tips>

<Pre>&lt;link href="_content/BootstrapBlazor.MaterialDesign/css/md.min.css" rel="stylesheet"&gt;</Pre>

<div>@((MarkupString)Localizer["Icons"].Value)</div>
8 changes: 6 additions & 2 deletions src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -6647,7 +6647,9 @@
"BootstrapBlazor.Server.Components.Samples.Icons.BootstrapIcons": {
"Title": "Bootstrap Icons",
"BaseUsageText": "Free, high quality, open source icon library",
"Icons": "For icon information, please visit <a href=\"https://icons.getbootstrap.com/\" target=\"_blank\">[portal]</a>"
"Icons": "For icon information, please visit <a href=\"https://icons.getbootstrap.com/\" target=\"_blank\">[portal]</a>",
"P1": "Extending the Component Package by Reference",
"P2": "After adding the stylesheet file link open icon"
},
"BootstrapBlazor.Server.Components.Samples.Icons.ElementIcons": {
"ElementIconTitle": "Element-plus Icons",
Expand All @@ -6666,7 +6668,9 @@
"BootstrapBlazor.Server.Components.Samples.Icons.MaterialDesignIcons": {
"Title": "MaterialDesign Icons",
"BaseUsageText": "Material Design system icons are simple, modern and user-friendly",
"Icons": "For icon information, please visit <a href=\"https://pictogrammers.com/library/mdi/\" target=\"_blank\">[portal]</a>"
"Icons": "For icon information, please visit <a href=\"https://pictogrammers.com/library/mdi/\" target=\"_blank\">[portal]</a>",
"P1": "Extending the Component Package by Reference",
"P2": "After adding the stylesheet file link open icon"
},
"BootstrapBlazor.Server.Components.Samples.Icons.IconParks": {
"IconParkTitle": "ByteDance Svg Icon Lib",
Expand Down
8 changes: 6 additions & 2 deletions src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -6647,7 +6647,9 @@
"BootstrapBlazor.Server.Components.Samples.Icons.BootstrapIcons": {
"Title": "Bootstrap Icons",
"BaseUsageText": "Bootstrap 免费开源图标库",
"Icons": "图标信息请通过 <a href=\"https://icons.getbootstrap.com/\" target=\"_blank\">[传送门]</a> 查看"
"Icons": "图标信息请通过 <a href=\"https://icons.getbootstrap.com/\" target=\"_blank\">[传送门]</a> 查看",
"P1": "通过引用扩展组件包",
"P2": "后添加样式表文件链接开启图标"
},
"BootstrapBlazor.Server.Components.Samples.Icons.ElementIcons": {
"ElementIconTitle": "饿了么图标库",
Expand All @@ -6666,7 +6668,9 @@
"BootstrapBlazor.Server.Components.Samples.Icons.MaterialDesignIcons": {
"Title": "MaterialDesign Icons",
"BaseUsageText": "Material Design 图标简单、现代、友好",
"Icons": "图标信息请通过 <a href=\"https://pictogrammers.com/library/mdi/\" target=\"_blank\">[传送门]</a> 查看"
"Icons": "图标信息请通过 <a href=\"https://pictogrammers.com/library/mdi/\" target=\"_blank\">[传送门]</a> 查看",
"P1": "通过引用扩展组件包",
"P2": "后添加样式表文件链接开启图标"
},
"BootstrapBlazor.Server.Components.Samples.Icons.IconParks": {
"IconParkTitle": "字节跳动图标库",
Expand Down
23 changes: 11 additions & 12 deletions src/BootstrapBlazor.Server/Services/PackageVersionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace BootstrapBlazor.Server.Services;

class PackageVersionService
{
private IHttpClientFactory Factory { get; set; }
private IHttpClientFactory Factory { get; }

public string? Version { get; }

Expand All @@ -16,14 +16,9 @@ class PackageVersionService
public PackageVersionService(IHttpClientFactory factory)
{
Factory = factory;
if (OperatingSystem.IsBrowser())
{
Version = typeof(BootstrapComponentBase).Assembly.GetName().Version?.ToString();
}
else
{
Version = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(BootstrapComponentBase).Assembly.Location).ProductVersion;
}
Version = OperatingSystem.IsBrowser()
? typeof(BootstrapComponentBase).Assembly.GetName().Version?.ToString()
: System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(BootstrapComponentBase).Assembly.Location).ProductVersion;

if (!string.IsNullOrEmpty(Version))
{
Expand All @@ -43,7 +38,7 @@ public PackageVersionService(IHttpClientFactory factory)

private async Task<string> FetchVersionAsync(string packageName = "bootstrapblazor")
{
var version = "lastest";
var version = "latest";
try
{
var url = $"https://azuresearch-usnc.nuget.org/query?q={packageName}&prerelease=true&semVerLevel=2.0.0";
Expand All @@ -55,7 +50,11 @@ private async Task<string> FetchVersionAsync(string packageName = "bootstrapblaz
version = package.GetVersion();
}
}
catch { }
catch
{
// ignored
}

return version;
}

Expand All @@ -67,7 +66,7 @@ private class NugetPackage
public IEnumerable<NugetPackageData> Data { get; set; } = Array.Empty<NugetPackageData>();

/// <summary>
///
///
/// </summary>
/// <returns></returns>
public string GetVersion() => Data.FirstOrDefault()?.Version ?? "";
Expand Down