-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b48f38b
commit 163e9c3
Showing
7 changed files
with
165 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace RazorBlade; | ||
|
||
/// <summary> | ||
/// The execution result of a Razor template. | ||
/// </summary> | ||
internal interface IRazorExecutionResult | ||
{ | ||
/// <summary> | ||
/// The rendered body contents. | ||
/// </summary> | ||
IEncodedContent Body { get; } | ||
|
||
/// <summary> | ||
/// The layout this execution result should be wrapped in. | ||
/// </summary> | ||
IRazorLayout? Layout { get; } | ||
|
||
/// <summary> | ||
/// The cancellation token. | ||
/// </summary> | ||
CancellationToken CancellationToken { get; } | ||
|
||
/// <summary> | ||
/// Renders a section. | ||
/// </summary> | ||
/// <param name="name">The section name.</param> | ||
/// <returns>The rendered output, or null if the section is not defined.</returns> | ||
Task<IEncodedContent?> RenderSectionAsync(string name); | ||
|
||
/// <summary> | ||
/// Indicates if a given section is defined. | ||
/// </summary> | ||
/// <param name="name">The section name.</param> | ||
bool IsSectionDefined(string name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,16 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using System.Threading.Tasks; | ||
|
||
namespace RazorBlade; | ||
|
||
/// <summary> | ||
/// Represents a Razor layout page. | ||
/// </summary> | ||
public interface IRazorLayout | ||
internal interface IRazorLayout | ||
{ | ||
/// <summary> | ||
/// Renders the layout for a given page. | ||
/// </summary> | ||
/// <param name="input">The input data.</param> | ||
/// <returns>The output data after rendering the layout, which can be used for the next layout.</returns> | ||
Task<IExecutionResult> ExecuteLayoutAsync(IExecutionResult input); | ||
|
||
/// <summary> | ||
/// The execution result of a page. | ||
/// </summary> | ||
public interface IExecutionResult | ||
{ | ||
/// <summary> | ||
/// The rendered body contents. | ||
/// </summary> | ||
IEncodedContent Body { get; } | ||
|
||
/// <summary> | ||
/// The layout this execution result needs to be wrapped in. | ||
/// </summary> | ||
IRazorLayout? Layout { get; } | ||
|
||
/// <summary> | ||
/// The cancellation token. | ||
/// </summary> | ||
CancellationToken CancellationToken { get; } | ||
|
||
/// <summary> | ||
/// Renders a section. | ||
/// </summary> | ||
/// <param name="name">The section name.</param> | ||
/// <returns>The rendered output, or null if the section is not defined.</returns> | ||
Task<IEncodedContent?> RenderSectionAsync(string name); | ||
} | ||
Task<IRazorExecutionResult> ExecuteLayoutAsync(IRazorExecutionResult input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters