Skip to content

Commit

Permalink
Additional sanitizing at template rendering time
Browse files Browse the repository at this point in the history
The existing santizing wasn't enough.

Fixes #155
  • Loading branch information
kzu committed Jan 10, 2023
1 parent 7809ad3 commit aeca9b4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/ThisAssembly.Constants/CSharp.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
/// </summary>
{{ end }}
{{ func render }}
public static partial class {{ $0.Name }}
public static partial class {{ $0.Name | string.replace "-" "_" | string.replace " " "_" }}
{
{{~ for value in $0.Values ~}}
{{- summary value ~}}
public const string {{ value.Name }} = @"{{ value.Value }}";
public const string {{ value.Name | string.replace "-" "_" | string.replace " " "_" }} = @"{{ value.Value }}";
{{~ end ~}}

{{ for area in $0.NestedAreas
Expand Down
4 changes: 2 additions & 2 deletions src/ThisAssembly.Resources/CSharp.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// => @"{{ $0.Path }}"
{{~ end ~}}
/// </summary>
public static partial class {{ $0.Name }}
public static partial class {{ $0.Name | string.replace "-" "_" | string.replace " " "_" }}
{
{{~ if $0.IsText ~}}
private static string text;
Expand All @@ -31,7 +31,7 @@
}
{{ end }}
{{ func render }}
public static partial class {{ $0.Name }}
public static partial class {{ $0.Name | string.replace "-" "_" | string.replace " " "_" }}
{
{{~ if $0.Resources ~}}
{{~ for $r in $0.Resources ~}}
Expand Down
8 changes: 2 additions & 6 deletions src/ThisAssembly.Tests/ThisAssembly.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,12 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resources.resx">
<Generator></Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>

<EmbeddedResource Update="Resources.resx" Generator="" CopyToOutputDirectory="PreserveNewest" />
<EmbeddedResource Include="Content/Styles/Custom.css" Kind="Text" Comment="Secondary CSS" />
<EmbeddedResource Include="Content/Styles/Main.css" Comment="Primary CSS" />
<EmbeddedResource Include="Content/Docs/*" />
<EmbeddedResource Include="Content/Swagger/*" />
<None Remove="Content/Swagger/*" />
<EmbeddedResource Include="webhook-data.json" Kind="text" />
</ItemGroup>

<PropertyGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/ThisAssembly.Tests/webhook-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}

0 comments on commit aeca9b4

Please sign in to comment.