Class IDocumentExtensions
- Namespace
- Songhay.Publications.Extensions
- Assembly
- Songhay.Publications.dll
Extensions of IDocument
public static class IDocumentExtensions
- Inheritance
-
IDocumentExtensions
- Inherited Members
Methods
Clone(IDocument?)
Clones the instance of IDocument.
public static Document? Clone(this IDocument? data)
Parameters
dataIDocumentThe document.
Returns
GetDocumentByPredicate(IEnumerable<IDocument>, Func<IDocument, bool>, ILogger)
Returns and traces the first IDocument based on the specified predicate.
public static IDocument? GetDocumentByPredicate(this IEnumerable<IDocument> data, Func<IDocument, bool> predicate, ILogger logger)
Parameters
dataIEnumerable<IDocument>The data.
predicateFunc<IDocument, bool>The predicate.
loggerILoggerthe ILogger
Returns
HasFragments(IDocument?, ILogger)
public static bool HasFragments(this IDocument? data, ILogger logger)
Parameters
Returns
IsTemplatable(IDocument?)
Determines whether the specified document is template-able.
public static bool IsTemplatable(this IDocument? data)
Parameters
dataIDocumentThe document.
Returns
- bool
trueif the specified document is template-able; otherwise,false.
SetDefaults(IDocument?)
Sets the defaults.
public static void SetDefaults(this IDocument? data)
Parameters
dataIDocumentThe document.
ToConventionalFrontMatter(IDocument?, ILogger)
Converts the instance of IDocument to the conventional, front-matter JsonObject.
public static JsonObject ToConventionalFrontMatter(this IDocument? document, ILogger logger)
Parameters
Returns
ToConventionalFrontMatter(IDocument?, IReadOnlyCollection<string>?, int?, ILogger)
Converts the instance of IDocument to the conventional, front-matter JsonObject.
public static JsonObject ToConventionalFrontMatter(this IDocument? document, IReadOnlyCollection<string>? contentLines, int? contentLinesExtractLength, ILogger logger)
Parameters
documentIDocumentthe IDocument
contentLinesIReadOnlyCollection<string>the document content lines
contentLinesExtractLengthint?the length of the content extract; this maps to the
lengthargument in ConvertToExtract(IReadOnlyCollection<string>?, int, ILogger)loggerILoggerthe ILogger
Returns
ToConventionalPublicationItem(IDocument?, string?)
Converts Document to the conventional publication item.
public static XElement? ToConventionalPublicationItem(this IDocument? data, string? templateFileName)
Parameters
Returns
ToDisplayText(IDocument?)
Converts the IDocument into human-readable display text.
public static string ToDisplayText(this IDocument? data)
Parameters
dataIDocumentThe data.
Returns
ToDisplayText(IDocument?, bool)
Converts the IDocument into a display text.
public static string ToDisplayText(this IDocument? data, bool showIdOnly)
Parameters
Returns
ToJsonObject(IDocument?)
Converts the instance of IDocument to its JsonObject representation.
public static JsonObject ToJsonObject(this IDocument? document)
Parameters
Returns
ToMarkdownEntry(IDocument?, string?, string?, ILogger)
Converts the specified IDocument to MarkdownEntry.
public static MarkdownEntry? ToMarkdownEntry(this IDocument? document, string? entryPath, string? content, ILogger logger)
Parameters
documentIDocumentthe IDocument
entryPathstringthe entry path
contentstringthe entry content
loggerILoggerthe ILogger
Returns
ToMenuDisplayItemModel(IDocument?)
Converts the IDocument into a menu display item model.
public static MenuDisplayItemModel? ToMenuDisplayItemModel(this IDocument? data)
Parameters
dataIDocumentThe document.
Returns
- MenuDisplayItemModel
ToMenuDisplayItemModel(IDocument?, IGroupable?)
Converts the IDocument into a menu display item model.
public static MenuDisplayItemModel? ToMenuDisplayItemModel(this IDocument? data, IGroupable? group)
Parameters
dataIDocumentThe document.
groupIGroupableThe group.
Returns
- MenuDisplayItemModel
ToStaticFileValidationResult(IDocument?, ILogger)
Converts the specified IDocument into a FluentValidation.Results.ValidationResult.
public static ValidationResult? ToStaticFileValidationResult(this IDocument? document, ILogger logger)
Parameters
Returns
- ValidationResult
ToValidationResult(IDocument?)
Converts the IDocument data to FluentValidation.Results.ValidationResult.
public static ValidationResult ToValidationResult(this IDocument? data)
Parameters
Returns
- ValidationResult
ToYaml(IDocument?, ILogger)
Converts the specified IDocument to well-formed YAML.
public static string? ToYaml(this IDocument? document, ILogger logger)
Parameters
Returns
ToYaml(IDocument?, IReadOnlyCollection<string>?, ILogger)
Converts the specified IDocument to well-formed YAML.
public static string? ToYaml(this IDocument? document, IReadOnlyCollection<string>? contentLines, ILogger logger)
Parameters
documentIDocumentthe IDocument
contentLinesIReadOnlyCollection<string>the collection of content lines
loggerILoggerthe ILogger
Returns
Update(IDocument?, JsonObject?, ILogger)
Updates the instance of IDocument with the specified JsonObject.
public static void Update(this IDocument? document, JsonObject? documentData, ILogger logger)
Parameters
documentIDocumentthe IDocument
documentDataJsonObjectthe JsonObject
loggerILoggerthe ILogger
- See Also
WithConventionalFrontMatter(JsonObject?, ILogger)
Returns the specified JsonObject with the conventional front-matter properties for Studio Publications.
public static JsonObject WithConventionalFrontMatter(this JsonObject? documentData, ILogger logger)
Parameters
documentDataJsonObjectthe JsonObject
loggerILoggerthe ILogger
Returns
WithConventionalFrontMatter(JsonObject?, IReadOnlyCollection<string>?, int?, ILogger)
Returns the specified JsonObject with the conventional front-matter properties for Studio Publications.
public static JsonObject WithConventionalFrontMatter(this JsonObject? documentData, IReadOnlyCollection<string>? contentLines, int? contentLinesExtractLength, ILogger logger)
Parameters
documentDataJsonObjectthe JsonObject
contentLinesIReadOnlyCollection<string>the document content lines
contentLinesExtractLengthint?the length of the content extract; this maps to the
lengthargument in ConvertToExtract(IReadOnlyCollection<string>?, int, ILogger)loggerILoggerthe ILogger
Returns
WithConventionalFrontMatterForDocument(JsonObject?)
Returns the specified JsonObject with the conventional front-matter IDocument properties for Studio Publications.
public static JsonObject WithConventionalFrontMatterForDocument(this JsonObject? documentData)
Parameters
documentDataJsonObjectthe JsonObject
Returns
Remarks
This member ensures conventional document order of IDocument properties so that front matter appears consistently in your Markdown editor of choice.
WithConventionalFrontMatterForDocumentPublicationProperties(JsonObject?)
Returns the specified JsonObject with the conventional front-matter Publications properties for Studio Publications.
public static JsonObject WithConventionalFrontMatterForDocumentPublicationProperties(this JsonObject? documentData)
Parameters
documentDataJsonObjectthe JsonObject
Returns
WithConventionalFrontMatterForDocumentPublicationProperties(JsonObject?, IReadOnlyCollection<string>?, int?, ILogger)
Returns the specified JsonObject with the conventional front-matter Publications properties for Studio Publications.
public static JsonObject WithConventionalFrontMatterForDocumentPublicationProperties(this JsonObject? documentData, IReadOnlyCollection<string>? contentLines, int? contentLinesExtractLength, ILogger logger)
Parameters
documentDataJsonObjectthe JsonObject
contentLinesIReadOnlyCollection<string>the document content lines
contentLinesExtractLengthint?the length of the content extract; this maps to the
lengthargument in ConvertToExtract(IReadOnlyCollection<string>?, int, ILogger)loggerILoggerthe ILogger
Returns
Remarks
“Publications properties” refers to any front-matter property prefixed with rx
(e.g. rxNextLink).
- See Also
WithConventionalFrontMatterForDocumentTag(JsonObject?, ILogger)
Returns the specified JsonObject with the conventional front-matter properties based on Tag for Studio Publications.
public static JsonObject WithConventionalFrontMatterForDocumentTag(this JsonObject? documentData, ILogger logger)
Parameters
documentDataJsonObjectthe JsonObject
loggerILoggerthe ILogger
Returns
- See Also
WithDefaults(IDocument?)
Returns IDocument with default values.
public static IDocument? WithDefaults(this IDocument? data)
Parameters
dataIDocumentThe data.
Returns
WithEdit(IDocument?, Action<IDocument>?)
public static IDocument WithEdit(this IDocument? data, Action<IDocument>? editAction)
Parameters
Returns
WithUtcITemporalDates(IDocument?)
public static IDocument? WithUtcITemporalDates(this IDocument? document)
Parameters
Returns
WritePublicationEntryWithJsonFrontMatter(IDocument?, string?, string?, ILogger)
Writes an entry with JSON front matter to the specified entry path.
public static void WritePublicationEntryWithJsonFrontMatter(this IDocument? document, string? entryPath, string? content, ILogger logger)
Parameters
documentIDocumentthe IDocument
entryPathstringthe entry path
contentstringthe entry content
loggerILoggerthe ILogger
WritePublicationEntryWithYamlFrontMatter(IDocument?, string?, string?, ILogger)
Writes an entry with YAML front matter to the specified entry path.
public static void WritePublicationEntryWithYamlFrontMatter(this IDocument? document, string? entryPath, string? content, ILogger logger)