@inherits Custom.Hybrid.Razor14
@using ToSic.Razor.Blade;
<!-- unimportant stuff, hidden -->
<div @Sys.PageParts.InfoWrapper()>
@Html.Partial("../shared/DefaultInfoSection.cshtml")
<div @Sys.PageParts.InfoIntro()>
<h2><em>RazorBlade</em> Tags BR/NewLine Conversions <em>v1.1</em></h2>
<p>
These demos show how to convert BR tags to spaces, New-Lines or New-Lines to BRs.
</p>
</div>
</div>
<h2>Simple example</h2>
@{
var val1 = "This is a text.\nSecond line.\nThird line.";
var val1br = Tags.Nl2Br(val1);
var val1Back = Tags.Br2Nl(val1br);
var val1Space = Tags.Br2Space(val1br);
}
<table class="table table-hover">
<tr>
<th class="w-25">This is...</th>
<th class="w-33">Shown as plain text</th>
<th class="w-33">Shown as HTML</th>
</tr>
<tr>
<td>Original</td>
<td><textarea rows="4">@val1</textarea></td>
<td>@val1</td>
</tr>
<tr>
<td>Converting with Tags.Nl2Br(...)</td>
<td><textarea rows="4">@val1br</textarea></td>
<td>@Html.Raw(val1br)</td>
</tr>
<tr>
<td>Convert the br back with Tags.Br2Nl</td>
<td><textarea rows="4">@val1Back</textarea></td>
<td>@val1Back</td>
</tr>
<tr>
<td>Cleaning BR as Space with Tags.Br2Space</td>
<td><textarea rows="4">@val1Space</textarea></td>
<td>@val1Space</td>
</tr>
</table>
<!-- unimportant stuff, hidden -->
@* Footer *@
@Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })