fix: correcting some patterns and inheritances

This commit is contained in:
Dylan R. E. Moonfire 2022-06-06 09:32:22 -05:00
parent dd2ed640e9
commit 18264b4b2b
9 changed files with 82 additions and 44 deletions

View file

@ -1366,5 +1366,6 @@ using(DataAccessAdapter dataAccessAdapter = new DataAccessAdapter(ConnectionStri
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/@KeyIndexDefined">True</s:Boolean> <s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String> <s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/CustomProperties/=minimumLanguageVersion/@EntryIndexedValue">2.0</s:String>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/Type/@EntryValue">InCSharpStatement</s:String> <s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=F87CBA43E9CDCC41A45B39A2A2A25764/Scope/=2C285F182AC98D44B0B4F29D4D2149EC/Type/@EntryValue">InCSharpStatement</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gemtext/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tocks/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Tocks/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary> </wpf:ResourceDictionary>

View file

@ -120,7 +120,11 @@ public class WithPropertySourceGenerator : ISourceGenerator
// We have the components for writing out a setter. // We have the components for writing out a setter.
buffer.AppendLine( buffer.AppendLine(
string.Format(" public {0} With{1}({2} value)", cds.Identifier, pds.Identifier, pds.Type)); string.Format(
" public virtual {0} With{1}({2} value)",
cds.Identifier,
pds.Identifier,
pds.Type));
buffer.AppendLine(" {"); buffer.AppendLine(" {");
buffer.AppendLine(string.Format(" this.{0} = value;", pds.Identifier)); buffer.AppendLine(string.Format(" this.{0} = value;", pds.Identifier));
buffer.AppendLine(" return this;"); buffer.AppendLine(" return this;");

View file

@ -1,3 +1,5 @@
using System;
using FluentValidation; using FluentValidation;
using Gallium; using Gallium;
@ -23,6 +25,13 @@ public class ConvertMarkdownToGemtext : ConvertMarkdownToBase
{ {
} }
/// <inheritdoc />
public override ConvertMarkdownToGemtext WithConfigureMarkdown(Action<MarkdownPipelineBuilder>? value)
{
base.WithConfigureMarkdown(value);
return this;
}
/// <summary> /// <summary>
/// Converts the Markdown file into HTML. /// Converts the Markdown file into HTML.
/// </summary> /// </summary>

View file

@ -1,3 +1,5 @@
using System;
using FluentValidation; using FluentValidation;
using Gallium; using Gallium;
@ -20,6 +22,13 @@ public class ConvertMarkdownToHtml : ConvertMarkdownToBase
{ {
} }
/// <inheritdoc />
public override ConvertMarkdownToHtml WithConfigureMarkdown(Action<MarkdownPipelineBuilder>? value)
{
base.WithConfigureMarkdown(value);
return this;
}
/// <summary> /// <summary>
/// Converts the Markdown file into HTML. /// Converts the Markdown file into HTML.
/// </summary> /// </summary>

View file

@ -24,10 +24,9 @@ public partial class IdentifyMarkdown : IOperation
public IdentifyMarkdown(IValidator<IdentifyMarkdown> validator) public IdentifyMarkdown(IValidator<IdentifyMarkdown> validator)
{ {
this.validator = validator; this.validator = validator;
this.IsMarkdownTest = DefaultIsMarkdown;
} }
public Func<Entity, UPath, bool> IsMarkdownTest { get; set; } public Func<Entity, UPath, bool> IsMarkdownTest { get; set; } = null!;
/// <inheritdoc /> /// <inheritdoc />
public IEnumerable<Entity> Run(IEnumerable<Entity> input) public IEnumerable<Entity> Run(IEnumerable<Entity> input)
@ -38,16 +37,6 @@ public partial class IdentifyMarkdown : IOperation
.ForEachEntity<UPath, IBinaryContent>(this.MarkBinaryEntities); .ForEachEntity<UPath, IBinaryContent>(this.MarkBinaryEntities);
} }
private static bool DefaultIsMarkdown(Entity entity, UPath path)
{
return (path.GetExtensionWithDot() ?? string.Empty).ToLowerInvariant() switch
{
".md" => true,
".markdown" => true,
_ => false,
};
}
private Entity MarkBinaryEntities(Entity entity, UPath path, IBinaryContent binary) private Entity MarkBinaryEntities(Entity entity, UPath path, IBinaryContent binary)
{ {
// If we aren't a Markdown file, then there is nothing // If we aren't a Markdown file, then there is nothing
@ -65,7 +54,7 @@ public partial class IdentifyMarkdown : IOperation
else else
{ {
throw new InvalidOperationException( throw new InvalidOperationException(
"Cannot convert a binary content to a " + "text without ITextContentConvertable."); "Cannot convert a binary content to a text without ITextContentConvertable.");
} }
return entity; return entity;

View file

@ -0,0 +1,26 @@
using FluentValidation;
using Gallium;
using Zio;
namespace Nitride.Markdown;
public class IdentifyMarkdownFromPath : IdentifyMarkdown
{
public IdentifyMarkdownFromPath(IValidator<IdentifyMarkdown> validator)
: base(validator)
{
this.IsMarkdownTest = DefaultIsMarkdown;
}
private static bool DefaultIsMarkdown(Entity entity, UPath path)
{
return (path.GetExtensionWithDot() ?? string.Empty).ToLowerInvariant() switch
{
".md" => true,
".markdown" => true,
_ => false,
};
}
}