1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-12-22 01:53:24 +00:00

Tests MardownView

This commit is contained in:
Yan Maniez 2018-06-20 10:13:55 +02:00
parent 6808432722
commit c721858bc6
4 changed files with 42 additions and 20 deletions

View file

@ -67,21 +67,28 @@ namespace AideDeJeu.Tools
var strings = value as IEnumerable<string>;
if (strings != null)
{
var fs = new FormattedString();
var cstring = string.Empty;
foreach (var str in strings)
{
var doc = new XmlDocument();
doc.LoadXml("<div>" + str + "</div>");
FormatedTextHelpers.HtmlNodeToFormatedString(doc.DocumentElement, fs);
fs.Spans.Add(new Span() { Text = "\r\n" });
cstring += str + "\r\n";
}
return fs;
}
else
{
return null;
return cstring;
// var fs = new FormattedString();
// foreach (var str in strings)
// {
// var doc = new XmlDocument();
// doc.LoadXml("<div>" + str + "</div>");
// FormatedTextHelpers.HtmlNodeToFormatedString(doc.DocumentElement, fs);
// fs.Spans.Add(new Span() { Text = "\r\n" });
// }
// return fs;
//}
//else
//{
// return null;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

View file

@ -210,7 +210,7 @@ namespace AideDeJeu.Tools
else if (block is Markdig.Syntax.ParagraphBlock)
{
var paragraphBlock = block as Markdig.Syntax.ParagraphBlock;
features?.Add(MarkdownToHtml(paragraphBlock.ToParagraphString()));
features?.Add(paragraphBlock.ToParagraphString());
////DumpParagraphBlock(paragraphBlock);
//Console.WriteLine(paragraphBlock.IsBreakable);
//spell.DescriptionHtml += paragraphBlock.Inline.ToContainerString();
@ -313,7 +313,7 @@ namespace AideDeJeu.Tools
if (ininblock is Markdig.Syntax.ParagraphBlock)
{
var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock;
features?.Add(MarkdownToHtml(listBlock.BulletType + " " + paragraphBlock.ToParagraphString()));
features?.Add(listBlock.BulletType + " " + paragraphBlock.ToParagraphString());
}
}
}

View file

@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:tools="clr-namespace:AideDeJeu.Tools"
xmlns:skia="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
xmlns:mdview="clr-namespace:Xam.Forms.Markdown;assembly=Xam.Forms.MarkdownView"
x:Class="AideDeJeu.Views.MonsterDetailPage"
Title="{Binding Title}">
<ContentPage.Resources>
@ -14,7 +15,7 @@
</ContentPage.Resources>
<ScrollView Orientation="Vertical" BackgroundColor="#fdf1dc">
<StackLayout Orientation="Vertical" Padding="15">
<skia:SKCanvasView PaintSurface="PaintHeaderBar" HorizontalOptions="FillAndExpand" HeightRequest="8" />
<Label Text="{Binding Item.NamePHB}" Style="{StaticResource Key=subsection}" />
@ -77,13 +78,18 @@
<skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/>
<Label FormattedText="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="Capacités" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView Padding="0" CascadeInputTransparent="True" Margin="0" BackgroundColor="Aqua" InputTransparent="True" HorizontalOptions="FillAndExpand" Markdown="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="Actions" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
<Label FormattedText="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
<Label Text="Actions légendaires" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
<Label FormattedText="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
<!--<Label FormattedText="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />-->
<mdview:MarkdownView HorizontalOptions="FillAndExpand" Markdown="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
<!--<ListView ItemsSource="{Binding Item.SpecialFeaturesNodes}">
<ListView.ItemTemplate>
<DataTemplate>