Skip to content

Commit

Permalink
Merge pull request #23 from alopezlago/alopezlago/public_0_2_3_0
Browse files Browse the repository at this point in the history
Merged PR 204: 0.2.3 - fix typo, emit <b>/<u> instead of <req>
  • Loading branch information
alopezlago committed Jul 10, 2021
2 parents 4ca4e35 + 0b1f9a8 commit cffecf5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 23 deletions.
Expand Up @@ -18,7 +18,7 @@ public JsonBonusNode(BonusNode bonusNode)
this.Parts_sanitized = new List<string>();
this.Values = new List<int>();

this.DifficultModifiers = partNodes.Any(node => node.DifficultyModifier.HasValue) ? new List<char?>() : null;
this.DifficultyModifiers = partNodes.Any(node => node.DifficultyModifier.HasValue) ? new List<char?>() : null;

foreach (BonusPartNode partNode in partNodes)
{
Expand All @@ -28,7 +28,7 @@ public JsonBonusNode(BonusNode bonusNode)
this.Parts_sanitized.Add(JsonTextFormatter.ToStringWithoutTags(partNode.Question.Question));
this.Values.Add(partNode.Value);

this.DifficultModifiers?.Add(partNode.DifficultyModifier);
this.DifficultyModifiers?.Add(partNode.DifficultyModifier);
}
}

Expand All @@ -46,6 +46,6 @@ public JsonBonusNode(BonusNode bonusNode)

public ICollection<int> Values { get; }

public ICollection<char?>? DifficultModifiers { get; }
public ICollection<char?>? DifficultyModifiers { get; }
}
}
Expand Up @@ -21,22 +21,18 @@ internal static string ToStringWithTags(FormattedText node)
StringBuilder builder = new StringBuilder();
foreach (FormattedTextSegment segment in node.Segments)
{
// We only track <req> and <em>. <req> is a combination of bold and underlined.
if (previousBolded ^ segment.Bolded)
{
if (previousUnderlined ^ segment.Underlined)
{
builder.Append(segment.Bolded ? "<req>" : "</req>");
previousUnderlined = segment.Underlined;
}
else
{
builder.Append(segment.Bolded ? "<b>" : "</b>");
}

builder.Append(segment.Bolded ? "<b>" : "</b>");
previousBolded = segment.Bolded;
}

if (previousUnderlined ^ segment.Underlined)
{
builder.Append(segment.Underlined ? "<u>" : "</u>");
previousUnderlined = segment.Underlined;
}

if (previousItalic ^ segment.Italic)
{
builder.Append(segment.Italic ? "<em>" : "</em>");
Expand All @@ -47,9 +43,14 @@ internal static string ToStringWithTags(FormattedText node)
}

// Close any remaining tags
if (previousBolded || previousUnderlined)
if (previousBolded)
{
builder.Append("</b>");
}

if (previousUnderlined)
{
builder.Append("</req>");
builder.Append("</u>");
}

if (previousItalic)
Expand Down
Expand Up @@ -17,9 +17,9 @@
<PackageTags>quizbowl packetparser quizbowlpacketparser</PackageTags>
<PackageProjectUrl>https://github.com/alopezlago/YetAnotherPacketParser</PackageProjectUrl>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<AssemblyVersion>0.2.2.0</AssemblyVersion>
<FileVersion>0.2.2.0</FileVersion>
<Version>0.2.2.0</Version>
<AssemblyVersion>0.2.3.0</AssemblyVersion>
<FileVersion>0.2.3.0</FileVersion>
<Version>0.2.3.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
Expand All @@ -15,6 +15,9 @@
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.16.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.11" />
</ItemGroup>
<PropertyGroup>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\YetAnotherPacketParser\YetAnotherPacketParser.csproj" />
</ItemGroup>
Expand Down
Expand Up @@ -9,9 +9,13 @@
<Copyright>(c) 2020 Alejandro Lopez-Lago</Copyright>
<Description>Yet Another Packet Parser parses quiz bowl packets and translates them to different formats</Description>
<Product>YAPP</Product>
<AssemblyVersion>0.2.1.0</AssemblyVersion>
<FileVersion>0.2.1.0</FileVersion>
<Version>0.2.1.0</Version>
<AssemblyVersion>0.2.3.0</AssemblyVersion>
<FileVersion>0.2.3.0</FileVersion>
<Version>0.2.3.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>5</WarningLevel>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit cffecf5

Please sign in to comment.