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
2 changes: 1 addition & 1 deletion src/ThisAssembly.Constants/CSharp.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{{ func remarks }}
{{~ if Remarks ~}}
{{ Remarks }}
/// <see cref="{{ Url }}"/>
/// <see href="{{ Url }}"/>
{{~ end ~}}
{{ end }}
{{ func render }}
Expand Down
10 changes: 2 additions & 8 deletions src/ThisAssembly.Constants/ConstantsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Devlooped.Sponsors;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
Expand All @@ -17,8 +16,6 @@ namespace ThisAssembly;
[Generator(LanguageNames.CSharp)]
public class ConstantsGenerator : IIncrementalGenerator
{
static readonly Regex SeeExpr = new("<see.+sponsorlink\"/>", RegexOptions.Compiled);

public void Initialize(IncrementalGeneratorInitializationContext context)
{
var files = context.AdditionalTextsProvider
Expand Down Expand Up @@ -124,16 +121,13 @@ void GenerateConstant(SourceProductionContext spc,
// structures via functions.
if (parse.Language == LanguageNames.CSharp)
{
output = SeeExpr.Replace(SyntaxFactory
output = SyntaxFactory
.ParseCompilationUnit(output, options: cs)
.NormalizeWhitespace()
.GetText()
.ToString(),
$"<see cref=\"{Funding.HelpUrl}\"/>");
.ToString();
}

spc.AddSource($"{root}.{name}.g.cs", SourceText.From(output, Encoding.UTF8));
}


}
2 changes: 1 addition & 1 deletion src/ThisAssembly.Resources/CSharp.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/// </summary>
{{~ if Remarks ~}}
{{ Remarks }}
/// <see cref="{{ Url }}"/>
/// <see href="{{ Url }}"/>
{{~ end ~}}
{{~ if Warn ~}}
[Obsolete("{{ Warn }}", false
Expand Down
8 changes: 2 additions & 6 deletions src/ThisAssembly.Resources/ResourcesGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Devlooped.Sponsors;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
Expand All @@ -17,8 +16,6 @@ namespace ThisAssembly;
[Generator(LanguageNames.CSharp)]
public class ResourcesGenerator : IIncrementalGenerator
{
static readonly Regex SeeExpr = new("<see.+sponsorlink\"/>", RegexOptions.Compiled);

public void Initialize(IncrementalGeneratorInitializationContext context)
{
context.RegisterPostInitializationOutput(
Expand Down Expand Up @@ -124,12 +121,11 @@ static void GenerateSource(SourceProductionContext spc,
};
var output = template.Render(model, member => member.Name);

output = SeeExpr.Replace(SyntaxFactory
output = SyntaxFactory
.ParseCompilationUnit(output, options: parse as CSharpParseOptions)
.NormalizeWhitespace()
.GetText()
.ToString(),
$"<see cref=\"{Funding.HelpUrl}\"/>");
.ToString();

spc.AddSource(
$"{basePath.Replace('\\', '.').Replace('/', '.')}.g.cs",
Expand Down
2 changes: 1 addition & 1 deletion src/ThisAssembly.Strings/CSharp.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/// </summary>
{{~ if Remarks ~}}
{{ Remarks }}
/// <see cref="{{ Url }}"/>
/// <see href="{{ Url }}"/>
{{~ end ~}}
{{~ if Warn ~}}
[Obsolete("{{ Warn }}", false
Expand Down
8 changes: 2 additions & 6 deletions src/ThisAssembly.Strings/StringsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Devlooped.Sponsors;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
Expand All @@ -16,8 +15,6 @@ namespace ThisAssembly;
[Generator(LanguageNames.CSharp)]
public class StringsGenerator : IIncrementalGenerator
{
static readonly Regex SeeExpr = new("<see.+sponsorlink\"/>", RegexOptions.Compiled);

public void Initialize(IncrementalGeneratorInitializationContext context)
{
// Read the ThisAssemblyNamespace property or default to null
Expand Down Expand Up @@ -85,12 +82,11 @@ static void GenerateSource(SourceProductionContext spc,

var output = template.Render(model, member => member.Name);

output = SeeExpr.Replace(SyntaxFactory
output = SyntaxFactory
.ParseCompilationUnit(output, options: parse as CSharpParseOptions)
.NormalizeWhitespace()
.GetText()
.ToString(),
$"<see cref=\"{Funding.HelpUrl}\"/>");
.ToString();

spc.AddSource(resourceName, SourceText.From(output, Encoding.UTF8));
}
Expand Down