Summary length may be overflowed
This commit is contained in:
@ -26,7 +26,7 @@ namespace Yavsc.TagHelpers
|
||||
private const string MarkdownMarkAttributeName = "ismarkdown";
|
||||
private const string SummaryMarkAttributeName = "summary";
|
||||
[HtmlAttributeName("site")]
|
||||
public SiteSettings Site { get; set; }
|
||||
public SiteSettings Site { get; set; }
|
||||
[HtmlAttributeName("base")]
|
||||
public string Base { get; set; }
|
||||
|
||||
@ -90,7 +90,18 @@ namespace Yavsc.TagHelpers
|
||||
// Transform the supplied text (Markdown) into HTML.
|
||||
var markdownTransformer = GetMarkdownTransformer();
|
||||
markdownTransformer.UrlBaseLocation = urlBaseLocation;
|
||||
// Si seul un sommaire est demandé,
|
||||
// s'assurer que la longueur du contenu ne dépasse pas de trop la longueur indiquée
|
||||
if (Summary > 0)
|
||||
{
|
||||
if (text.Length > Summary + 28)
|
||||
{
|
||||
text = text.Substring(0, Summary + 28);
|
||||
}
|
||||
}
|
||||
|
||||
string html = markdownTransformer.Transform(text);
|
||||
|
||||
// Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
|
||||
return html;
|
||||
}
|
||||
|
Reference in New Issue
Block a user