1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 15:06:06 +00:00
This commit is contained in:
Yan Maniez 2018-08-10 21:41:03 +02:00
parent aa6636ed7f
commit 12945ce020
3 changed files with 45 additions and 18 deletions

View file

@ -102,7 +102,7 @@
{ {
if (links.Any()) if (links.Any())
{ {
var blockLinks = links.Distinct().OrderBy(l => l.Value).ToList(); var blockLinks = links.Distinct().OrderBy(l => l.Key).ToList();
view.GestureRecognizers.Add(new TapGestureRecognizer view.GestureRecognizers.Add(new TapGestureRecognizer
{ {
Command = new Command(async () => Command = new Command(async () =>

View file

@ -272,6 +272,14 @@ namespace AideDeJeuCmd
alllinks.Add(name, links); alllinks.Add(name, links);
var names = GetMarkdownAnchorNames(md).ToList(); var names = GetMarkdownAnchorNames(md).ToList();
allnames.Add(name, names); allnames.Add(name, names);
}
}
foreach (var resname in resnames)
{
if (resname.EndsWith(".md"))
{
var name = resname.Substring(15, resname.Length - 18);
var md = await Helpers.GetResourceStringAsync(resname);
var unlinkedrefs = GetMarkdownUnlinkedRefs(md).ToList(); var unlinkedrefs = GetMarkdownUnlinkedRefs(md).ToList();
if (unlinkedrefs.Count > 0) if (unlinkedrefs.Count > 0)
{ {
@ -279,16 +287,36 @@ namespace AideDeJeuCmd
Console.WriteLine(); Console.WriteLine();
foreach (var unlinkedref in unlinkedrefs.Distinct().OrderBy(i => i)) foreach (var unlinkedref in unlinkedrefs.Distinct().OrderBy(i => i))
{ {
var file = ""; //var file = "";
var files = new Dictionary<string, string>();
foreach(var aalinks in alllinks)
{
var found = aalinks.Value.FirstOrDefault(t => t.Item2 == Helpers.IdFromName(unlinkedref));
if(found != null)
{
files[found.Item1] = $"{found.Item1}.md";
//file = $"{found.Item1}.md";
//Console.WriteLine($"[{unlinkedref}]: {file}#{Helpers.IdFromName(unlinkedref)}");
}
}
foreach(var aanchors in allanchors) foreach(var aanchors in allanchors)
{ {
if(aanchors.Value.Contains(Helpers.IdFromName(unlinkedref))) if(aanchors.Value.Contains(Helpers.IdFromName(unlinkedref)))
{ {
file = $"{aanchors.Key}.md"; files[aanchors.Key] = $"{aanchors.Key}.md";
break; //file = $"{aanchors.Key}.md";
//Console.WriteLine($"[{unlinkedref}]: {file}#{Helpers.IdFromName(unlinkedref)}");
//break;
} }
} }
Console.WriteLine($"[{unlinkedref}]: {file}#{Helpers.IdFromName(unlinkedref)}"); if(files.Count == 0)
{
files[""] = "";
}
foreach (var file in files)
{
Console.WriteLine($"[{unlinkedref}]: {file.Value}#{Helpers.IdFromName(unlinkedref)}");
}
} }
Console.WriteLine(); Console.WriteLine();
Console.WriteLine(); Console.WriteLine();
@ -379,7 +407,7 @@ namespace AideDeJeuCmd
public static IEnumerable<string> GetMarkdownAnchorNames(string md) public static IEnumerable<string> GetMarkdownAnchorNames(string md)
{ {
var regex = new Regex($"\\n##? (?<name>.*?)\\n"); var regex = new Regex($"\\n##* (?<name>.*?)\\s*?\\n");
var matches = regex.Matches(md); var matches = regex.Matches(md);
foreach (Match match in matches) foreach (Match match in matches)
{ {

View file

@ -213,7 +213,7 @@ Au niveau 20, vous êtes devenu une véritable force de la nature. Vos valeurs d
[arme courante]: equipment_hd_with_type_armecourante.md [arme courante]: equipment_hd_with_type_armecourante.md
[arme de corps-à-corps]: equipment_hd_with_type_armedecorpsàcorps.md [arme de corps-à-corps]: equipment_hd_with_type_armedecorpsàcorps.md
[arme de guerre de corps-à-corps]: equipment_hd_with_type_armedecorpsàcorps.md [arme de guerre de corps-à-corps]: equipment_hd_with_type_armedecorpsàcorps.md
[armes courantes]: #armes-courantes [armes courantes]: equipment_hd_with_type_armecourante.md
[armes de guerre]: #armes-de-guerre [armes de guerre]: #armes-de-guerre
[armure lourde]: equipment_hd_with_type_armurelourde.md [armure lourde]: equipment_hd_with_type_armurelourde.md
[armures intermédiaires]: equipment_hd_with_type_armureintermédiaire.md [armures intermédiaires]: equipment_hd_with_type_armureintermédiaire.md
@ -224,29 +224,28 @@ Au niveau 20, vous êtes devenu une véritable force de la nature. Vos valeurs d
[aveuglé]: conditions_hd.md#aveuglé [aveuglé]: conditions_hd.md#aveuglé
[bouclier]: equipment_hd.md#bouclier [bouclier]: equipment_hd.md#bouclier
[boucliers]: equipment_hd.md#bouclier [boucliers]: equipment_hd.md#bouclier
[classe d'armure]: #classe-darmure [classe d'armure]: abilities_dexterity_hd.md#classe-darmure
[contondants]: #contondants [contondants]: #contondants
[Dressage]: #dressage [Dressage]: abilities_wisdom_hd.md#dressage
[hache à deux mains]: #hache-à-deux-mains [hache à deux mains]: equipment_hd.md#hache-à-deux-mains
[hachettes]: equipment_hd.md#hachette [hachettes]: equipment_hd.md#hachette
[inconscient]: conditions_hd.md#inconscient [inconscient]: conditions_hd.md#inconscient
[initiative]: #initiative [initiative]: abilities_dexterity_hd.md#initiative
[Intimidation]: #intimidation [Intimidation]: abilities_charisma_hd.md#intimidation
[javelines]: equipment_hd.md#javeline [javelines]: equipment_hd.md#javeline
[Nature]: #nature [Nature]: abilities_intelligence_hd.md#nature
[neutralisé]: conditions_hd.md#neutralisé [neutralisé]: conditions_hd.md#neutralisé
[paquetage d'explorateur]: equipment_hd.md#paquetage-dexplorateur [paquetage d'explorateur]: #paquetage-dexplorateur
[Perception]: #perception [Perception]: abilities_wisdom_hd.md#perception
[perforants]: #perforants [perforants]: #perforants
[repos long]: #repos-long [repos long]: resting_hd.md#repos-long
[surpris]: conditions_hd.md#surpris [surpris]: #surpris
[Survie]: #survie [Survie]: #survie
[tableau d'évolution du barbare]: #tableau-dévolution-du-barbare [tableau d'évolution du barbare]: #tableau-dévolution-du-barbare
[tranchants]: #tranchants [tranchants]: #tranchants
[Force]: abilities_strength_hd.md [Force]: abilities_strength_hd.md
[Dextérité]: abilities_dexterity_hd.md [Dextérité]: abilities_dexterity_hd.md
[Constitution]: abilities_constitution_hd.md [Constitution]: abilities_constitution_hd.md