Table of Contents

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

data IDocument

The document.

Returns

Document

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

data IEnumerable<IDocument>

The data.

predicate Func<IDocument, bool>

The predicate.

logger ILogger

the ILogger

Returns

IDocument

HasFragments(IDocument?, ILogger)

Returns true when the IDocument has any Fragments.

public static bool HasFragments(this IDocument? data, ILogger logger)

Parameters

data IDocument

The data.

logger ILogger

the ILogger

Returns

bool

IsTemplatable(IDocument?)

Determines whether the specified document is template-able.

public static bool IsTemplatable(this IDocument? data)

Parameters

data IDocument

The document.

Returns

bool

true if the specified document is template-able; otherwise, false.

SetDefaults(IDocument?)

Sets the defaults.

public static void SetDefaults(this IDocument? data)

Parameters

data IDocument

The 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

document IDocument

the IDocument

logger ILogger

the ILogger

Returns

JsonObject

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

document IDocument

the IDocument

contentLines IReadOnlyCollection<string>

the document content lines

contentLinesExtractLength int?

the length of the content extract; this maps to the length argument in ConvertToExtract(IReadOnlyCollection<string>?, int, ILogger)

logger ILogger

the ILogger

Returns

JsonObject

ToConventionalPublicationItem(IDocument?, string?)

Converts Document to the conventional publication item.

public static XElement? ToConventionalPublicationItem(this IDocument? data, string? templateFileName)

Parameters

data IDocument

The data.

templateFileName string

Name of the template file.

Returns

XElement

ToDisplayText(IDocument?)

Converts the IDocument into human-readable display text.

public static string ToDisplayText(this IDocument? data)

Parameters

data IDocument

The data.

Returns

string

ToDisplayText(IDocument?, bool)

Converts the IDocument into a display text.

public static string ToDisplayText(this IDocument? data, bool showIdOnly)

Parameters

data IDocument

The data.

showIdOnly bool

when true then display identifiers only

Returns

string

ToJsonObject(IDocument?)

Converts the instance of IDocument to its JsonObject representation.

public static JsonObject ToJsonObject(this IDocument? document)

Parameters

document IDocument

the IDocument

Returns

JsonObject

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

document IDocument

the IDocument

entryPath string

the entry path

content string

the entry content

logger ILogger

the ILogger

Returns

MarkdownEntry

ToMenuDisplayItemModel(IDocument?)

Converts the IDocument into a menu display item model.

public static MenuDisplayItemModel? ToMenuDisplayItemModel(this IDocument? data)

Parameters

data IDocument

The 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

data IDocument

The document.

group IGroupable

The 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

document IDocument

the IDocument

logger ILogger

the ILogger

Returns

ValidationResult

ToValidationResult(IDocument?)

Converts the IDocument data to FluentValidation.Results.ValidationResult.

public static ValidationResult ToValidationResult(this IDocument? data)

Parameters

data IDocument

the IDocument data

Returns

ValidationResult

ToYaml(IDocument?, ILogger)

Converts the specified IDocument to well-formed YAML.

public static string? ToYaml(this IDocument? document, ILogger logger)

Parameters

document IDocument

the IDocument

logger ILogger

the ILogger

Returns

string

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

document IDocument

the IDocument

contentLines IReadOnlyCollection<string>

the collection of content lines

logger ILogger

the ILogger

Returns

string

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

document IDocument

the IDocument

documentData JsonObject

the JsonObject

logger ILogger

the 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

documentData JsonObject

the JsonObject

logger ILogger

the ILogger

Returns

JsonObject

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

documentData JsonObject

the JsonObject

contentLines IReadOnlyCollection<string>

the document content lines

contentLinesExtractLength int?

the length of the content extract; this maps to the length argument in ConvertToExtract(IReadOnlyCollection<string>?, int, ILogger)

logger ILogger

the ILogger

Returns

JsonObject

WithConventionalFrontMatterForDocument(JsonObject?)

Returns the specified JsonObject with the conventional front-matter IDocument properties for Studio Publications.

public static JsonObject WithConventionalFrontMatterForDocument(this JsonObject? documentData)

Parameters

documentData JsonObject

the JsonObject

Returns

JsonObject

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

documentData JsonObject

the JsonObject

Returns

JsonObject

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

documentData JsonObject

the JsonObject

contentLines IReadOnlyCollection<string>

the document content lines

contentLinesExtractLength int?

the length of the content extract; this maps to the length argument in ConvertToExtract(IReadOnlyCollection<string>?, int, ILogger)

logger ILogger

the ILogger

Returns

JsonObject

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

documentData JsonObject

the JsonObject

logger ILogger

the ILogger

Returns

JsonObject
See Also

WithDefaults(IDocument?)

Returns IDocument with default values.

public static IDocument? WithDefaults(this IDocument? data)

Parameters

data IDocument

The data.

Returns

IDocument

WithEdit(IDocument?, Action<IDocument>?)

Returns IDocument after the specified edit Action<T>.

public static IDocument WithEdit(this IDocument? data, Action<IDocument>? editAction)

Parameters

data IDocument

The data.

editAction Action<IDocument>

The edit action.

Returns

IDocument

WithUtcITemporalDates(IDocument?)

Returns IDocument with all dates specified as Utc

public static IDocument? WithUtcITemporalDates(this IDocument? document)

Parameters

document IDocument

the IDocument

Returns

IDocument

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

document IDocument

the IDocument

entryPath string

the entry path

content string

the entry content

logger ILogger

the 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)

Parameters

document IDocument

the IDocument

entryPath string

the entry path

content string

the entry content

logger ILogger

the ILogger