-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ fix for code snippets
- Loading branch information
Showing
13 changed files
with
120 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This code was generated by a kontent-generators-net tool | ||
// (see https://github.com/Kentico/kontent-generators-net). | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. | ||
// For further modifications of the class, create a separate file with the partial class. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
|
||
namespace Kentico.Kontent.Statiq.Memoirs.Models | ||
{ | ||
public partial class Quote | ||
{ | ||
public const string Codename = "quote"; | ||
public const string AttributionCodename = "attribution"; | ||
public const string ContentCodename = "content"; | ||
|
||
public string Attribution { get; set; } | ||
public string Content { get; set; } | ||
public IContentItemSystemAttributes System { get; set; } | ||
} | ||
} |
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,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
|
||
namespace Kentico.Kontent.Statiq.Memoirs.Models | ||
{ | ||
public partial class Quote | ||
{ | ||
} | ||
} |
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,21 @@ | ||
// This code was generated by a kontent-generators-net tool | ||
// (see https://github.com/Kentico/kontent-generators-net). | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. | ||
// For further modifications of the class, create a separate file with the partial class. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
|
||
namespace Kentico.Kontent.Statiq.Memoirs.Models | ||
{ | ||
public partial class Spoiler | ||
{ | ||
public const string Codename = "spoiler"; | ||
public const string ContentCodename = "content"; | ||
|
||
public string Content { get; set; } | ||
public IContentItemSystemAttributes System { get; set; } | ||
} | ||
} |
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,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
|
||
namespace Kentico.Kontent.Statiq.Memoirs.Models | ||
{ | ||
public partial class Spoiler | ||
{ | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
using Kentico.Kontent.Statiq.Memoirs.Models; | ||
using System.Linq; | ||
using System.Web; | ||
|
||
namespace MemoirsTheme.Resolvers | ||
{ | ||
public class CodeSnippetResolver : IInlineContentItemsResolver<CodeSnippet> | ||
{ | ||
public string Resolve(CodeSnippet data) | ||
{ | ||
return $"<pre><code class=\"language-{data.Language.First().Codename}\">{data.Code}</code></pre>"; | ||
return $"<pre><code class=\"language-{data.Language.First().Codename}\">{HttpUtility.HtmlEncode(data.Code)}</code></pre>"; | ||
} | ||
} | ||
} |
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,36 @@ | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
using Kentico.Kontent.Statiq.Memoirs.Models; | ||
using System; | ||
|
||
namespace MemoirsTheme.Resolvers | ||
{ | ||
public class QuoteResolver : IInlineContentItemsResolver<Quote> | ||
{ | ||
public string Resolve(Quote data) | ||
{ | ||
string attribution = ""; | ||
if (!string.IsNullOrWhiteSpace(data.Attribution)) | ||
{ | ||
attribution = $" ⸺ <cite>{data.Attribution}</cite>"; | ||
} | ||
|
||
return $"<blockquote><p>“{ TrimParagraph(data.Content)}”{attribution}</p></blockquote>"; | ||
} | ||
|
||
private static string TrimParagraph(string content) | ||
{ | ||
var result = content.Trim(); | ||
if (content.StartsWith("<p>", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
result = result.Substring(3); | ||
} | ||
if (content.EndsWith("</p>", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
result = result.Substring(0, result.Length-4); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
} | ||
} |
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,13 @@ | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
using Kentico.Kontent.Statiq.Memoirs.Models; | ||
|
||
namespace MemoirsTheme.Resolvers | ||
{ | ||
public class SpoilerResolver : IInlineContentItemsResolver<Spoiler> | ||
{ | ||
public string Resolve(Spoiler data) | ||
{ | ||
return $"<div class=\"spoiler\">{data.Content}</div>"; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.