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

Returns and traces the first IDocument based on the specified predicate.

public static IDocument? GetDocumentByPredicate(this IEnumerable<IDocument> data, Func<IDocument, bool> predicate)

Parameters

data IEnumerable<IDocument>

The data.

predicate Func<IDocument, bool>

The predicate.

Returns

IDocument

HasFragments(IDocument?)

Returns true when the IDocument has any Fragments.

public static bool HasFragments(this IDocument? data)

Parameters

data IDocument

The data.

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.

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

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

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

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

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