Skip to content

Instantly share code, notes, and snippets.

@bleroy
Created April 2, 2015 01:10
Show Gist options
  • Save bleroy/0c7c0b68a7f824249793 to your computer and use it in GitHub Desktop.
Save bleroy/0c7c0b68a7f824249793 to your computer and use it in GitHub Desktop.
CodePlex Issue #16616 Plain Text Attachments
@{
// odd formatting in this file is to cause more attractive results in the output.
var items = (IEnumerable<dynamic>)Enumerable.Cast<dynamic>(Model);
}
@{
if (!HasText(Model.Text)) {
@DisplayChildren(Model)
} else {
if (Model.Href.TrimEnd('/').ToUpperInvariant() == Request.Path.TrimEnd('/').ToUpperInvariant()) {
Model.Classes.Add("current");
}
var tag = Tag(Model, "li");
@tag.StartElement
if(Model.Href.EndsWith("/"))
{
<a href="@Model.Href.Substring(0, Model.Href.Length -1)">@Model.Text</a>
}else
{
<a href="@Model.Href">@Model.Text</a>
}
if (items.Any()) {
<ul>
@DisplayChildren(Model)
</ul>
}
@tag.EndElement
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment