1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Suite parent links

This commit is contained in:
Yan Maniez 2018-10-24 13:46:06 +02:00
parent 2aec1c8c37
commit 0c980c745e
5 changed files with 38 additions and 3 deletions

View file

@ -105,11 +105,40 @@ namespace AideDeJeuLib
[DataMember]
[Indexed]
public string RootId { get; set; }
[DataMember]
[Indexed]
public string ParentId { get; set; }
public string ParentLink { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public string ParentName { get; set; }
[IgnoreDataMember]
[Ignore]
public string ParentNameLink
{
get
{
if (ParentName != null && ParentLink != null)
{
return $"<!--ParentNameLink-->[{ParentName}]({ParentLink})<!--/ParentNameLink-->";
}
return null;
}
set
{
if (value != null)
{
var regex = new Regex("\\[(?<name>.*?)\\]\\((?<link>.*?)\\)");
var match = regex.Match(value);
ParentName = match.Groups["name"].Value;
ParentLink = match.Groups["link"].Value;
}
}
}
[DataMember]
public int NameLevel { get; set; }
[DataMember]

View file

@ -75,7 +75,9 @@ namespace AideDeJeu.ViewModels
else if (IsNewItem(block))
{
var subItem = ParseItem(source, ref enumerator, allItems);
subItem.ParentId = GetNewAnchorId(source, currentItem.Name, allItems);
subItem.ParentLink = GetNewAnchorId(source, currentItem.Name, allItems);
subItem.ParentName = currentItem.Name;
subItem.Markdown = $"> {subItem.ParentNameLink}\n\n---\n\n{subItem.Markdown}";
var propertyName = subItem.GetType().Name;

View file

@ -1,6 +1,10 @@
<!--Generic-->
> <!--ParentNameLink-->[Races](races_hd.md#races)<!--/ParentNameLink-->
---
# <!--Name-->Aasimar<!--/Name-->
- Source: <!--Source-->(MDR p59)<!--/Source-->

Binary file not shown.

View file

@ -1 +1 @@
5
8