A new presentation, using parallax effects
* style.css: Makes a better style * Banner.png: Made obsolete * Profile.cs: Groups profile properties * ChangeLog: * ChangeLog: Must not exist in the source tree * Web.config: * instdbws.sql: Groups profile properties * App.master: A better Html structure * AccountController.cs: Fixes the Profile edition * MarkdownHelper.cs: Adds an extraction of an introduction from a Markdown text * Edit.aspx: * Index.aspx: * UserPost.aspx: a better html structure * UserPosts.aspx: * a better html structure * post previews * Web.csproj: Adds and removes images
This commit is contained in:
parent
c10a78841b
commit
5da977daef
15 changed files with 372 additions and 202 deletions
|
|
@ -43,6 +43,30 @@ namespace Yavsc.Helpers
|
|||
// Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
|
||||
return new MvcHtmlString(html);
|
||||
}
|
||||
|
||||
public static IHtmlString MarkdownToHtmlIntro(this HtmlHelper helper, out bool truncated, string text, string urlBaseLocation="")
|
||||
{
|
||||
int maxLen = 250;
|
||||
// Transform the supplied text (Markdown) into HTML.
|
||||
var markdownTransformer = new Markdown();
|
||||
markdownTransformer.ExtraMode = true;
|
||||
markdownTransformer.UrlBaseLocation = urlBaseLocation;
|
||||
if (text.Length < maxLen) {
|
||||
truncated = false;
|
||||
return new MvcHtmlString(markdownTransformer.Transform(text));
|
||||
}
|
||||
string intro = text.Remove (maxLen);
|
||||
truncated = true;
|
||||
int inl = intro.LastIndexOf ("\n");
|
||||
if (inl > 20)
|
||||
intro = intro.Remove (inl);
|
||||
intro += " ...";
|
||||
|
||||
string html = markdownTransformer.Transform(intro);
|
||||
// Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
|
||||
return new MvcHtmlString(html);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transforms a string of Markdown into HTML.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue