ContentFormatRegistry
Pennington.Pipeline
Maps content-format keys (e.g. "markdown", "cook") to the factories that build the format's IContentParser and IContentRenderer. Populated once while AddPennington wires services, then read by DispatchingContentParser and DispatchingContentRenderer at request time. Format keys are matched case-insensitively.
Methods
Register
#public void Register(string format, Func<IServiceProvider, IContentParser> parser, Func<IServiceProvider, IContentRenderer> renderer)
Registers (overwriting) the parser and renderer factories for a format key.
Parameters
formatstring- Format key the dispatchers route on.
parserFunc<IServiceProvider, IContentParser>- Resolves the format's parser from the request scope.
rendererFunc<IServiceProvider, IContentRenderer>- Resolves the format's renderer from the request scope.
TryGetParser
#public bool TryGetParser(string format, out Func<IServiceProvider, IContentParser> factory)
Gets the parser factory registered for format, if any.
Parameters
formatstringfactoryref Func<IServiceProvider, IContentParser>
Returns
boolTryGetRenderer
#public bool TryGetRenderer(string format, out Func<IServiceProvider, IContentRenderer> factory)
Gets the renderer factory registered for format, if any.
Parameters
formatstringfactoryref Func<IServiceProvider, IContentRenderer>
Returns
boolPennington.Pipeline.ContentFormatRegistry
namespace Pennington.Pipeline;
/// Maps content-format keys (e.g. "markdown", "cook") to the factories that build the format's IContentParser and IContentRenderer. Populated once while AddPennington wires services, then read by DispatchingContentParser and DispatchingContentRenderer at request time. Format keys are matched case-insensitively.
public class ContentFormatRegistry
{
/// Registers (overwriting) the parser and renderer factories for a format key.
public void Register(string format, Func<IServiceProvider, IContentParser> parser, Func<IServiceProvider, IContentRenderer> renderer)
;
/// Gets the parser factory registered for format, if any.
public bool TryGetParser(string format, out Func<IServiceProvider, IContentParser> factory)
;
/// Gets the renderer factory registered for format, if any.
public bool TryGetRenderer(string format, out Func<IServiceProvider, IContentRenderer> factory)
;
}