Table of Contents

Class DocumentUtility

Namespace
Songhay.Publications
Assembly
Songhay.Publications.dll

Shared routines for Document or IDocument.

public static class DocumentUtility
Inheritance
DocumentUtility
Inherited Members

Methods

GetConventionalFrontMatterProperties(bool)

Returns a collection of property names based on IDocument

public static IReadOnlyCollection<string> GetConventionalFrontMatterProperties(bool includeTagProperty = true)

Parameters

includeTagProperty bool

When true return Tag in the collection of property names

Returns

IReadOnlyCollection<string>

GetConventionalTagsAndPropertiesElements(JsonObject?, string?, ILogger)

Returns a tuple of two JsonElement instances representing the conventional tags and properties elements.

public static (JsonElement tags, JsonElement propeties) GetConventionalTagsAndPropertiesElements(JsonObject? documentData, string? tag, ILogger logger)

Parameters

documentData JsonObject

the JsonObject

tag string

the value of Tag

logger ILogger

the ILogger

Returns

(JsonElement tags, JsonElement propeties)

Remarks

The JsonObject passed into this method should be or will be shaped like IDocument where Tag can be serialized JSON of the form:

{
    \"tags\": [...],
    \"properties\": { ... }
}

...where the tags property is an array of strings and the properties property is an object of conventional properties, named with a prefix of rx.

This use of Tag is a temporary workaround until a formal concept of Document properties can be defined.

UpdateDocument(IDocument?, JsonObject?, ILogger)

Updates the instance of IDocument with the specified JsonObject.

public static void UpdateDocument(IDocument? document, JsonObject? documentData, ILogger logger)

Parameters

document IDocument

the IDocument

documentData JsonObject

the JsonObject

logger ILogger

the ILogger

Remarks

This member operates in the opposite ‘direction’ of UpdateFrontMatter(JsonObject?, Document?).

UpdateFrontMatter(JsonObject?, Document?)

Updates the JsonObject with the specified instance of IDocument.

public static void UpdateFrontMatter(JsonObject? documentData, Document? document)

Parameters

documentData JsonObject

the JsonObject

document Document

the IDocument

Remarks

This member operates in the opposite ‘direction’ of UpdateDocument(IDocument?, JsonObject?, ILogger).

UpdateFrontMatterWithDocumentTag(JsonObject?, string?, ILogger)

Updates the JsonObject with the conventional front-matter properties based on Tag for Studio Publications.

public static void UpdateFrontMatterWithDocumentTag(JsonObject? documentData, string? tag, ILogger logger)

Parameters

documentData JsonObject

the JsonObject

tag string

the value of Tag

logger ILogger

the ILogger

See Also