protected override void AddSections(WikiArticle article) { if (!String.IsNullOrWhiteSpace(Card.TextFormatted)) { article.AddSection("Card Text", Card.TextFormatted); } if (Card.TokenParents.Count > 0) { article.AddSection("Summoned By", GetTokenParents(Card)); } if (Card.Abilities.Count > 0) { article.AddSection("Ability", GetAbilityInfoboxes(Card.Abilities.Values)); if (Card.Abilities.Any(x => x.Value.CardSpawned != null)) { var cardSpawned = Card.Abilities.Where(x => x.Value.CardSpawned != null).Select(x => x.Value.CardSpawned).First(); article.AddSection("Card Summoned", GetCardReference(cardSpawned)); } } article.AddSection("Miscellaneous", GetIllustrator(Card)); }
protected override void AddSections(WikiArticle article) { var match = Regex.Match(CurrentArticle, @"(?s)==+\s*Artifact\s*==+\s*\n+((\{\{.*?\}\}\n*)+)"); if (match.Success) { article.AddSection("Artifact", match.Groups[1].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } else { match = Regex.Match(CurrentArticle, @"(?s)==+\s*Artifact\s*==+\s*\n*"); if (match.Success) { article.AddSection("Artifact", ""); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } } match = Regex.Match(CurrentArticle, @"(?s)==+\s*Dota 2\s*==+\s*\n+(\{\{.*?\}\})"); if (match.Success) { article.AddSection("Dota 2", match.Groups[1].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } match = Regex.Match(CurrentArticle, @"(?s)==+\s*Related Lore\s*==+\s*\n+((\{\{.*?\}\}\n*)+)"); if (match.Success) { article.AddSection("Related Lore", match.Groups[1].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } }
protected override void AddSections(WikiArticle article) { if (!String.IsNullOrWhiteSpace(Card.TextFormatted)) { article.AddSection("Card Text", Card.TextFormatted); } if (SubCard.CardSpawned != null) { article.AddSection("Card Summoned", GetCardReference(SubCard.CardSpawned)); } article.AddSection("Miscellaneous", GetIllustrator(Card)); }
protected override void AddSections(WikiArticle article) { if (Card.LoreFormatted == null) { article.AddSection("Artifact", $"This card does not have lore."); } else { string[] loreChunks = Card.LoreFormatted.Split("—"); article.AddSection("Artifact", $@"{{{{Quote | text = {loreChunks[0].Trim()} | source = {loreChunks[1].Trim()}}}}}"); } }
protected override void CombineSections(WikiArticle parsed, WikiArticle generated, WikiArticle combined) { var sections = GetFreshSections(); foreach (var pair in generated.Sections) { sections[pair.Key] += pair.Value + "\n"; } foreach (var pair in parsed.Sections) { string key = SectionMapping[pair.Key]; if (SkippedSections.Contains(key) || String.IsNullOrWhiteSpace(key)) { continue; } sections[key] += pair.Value + "\n"; } foreach (var pair in sections) { if (String.IsNullOrWhiteSpace(pair.Value) && !MandatorySections.Contains(pair.Key)) { continue; } combined.AddSection(pair.Key, pair.Value); } }
protected override void CombineSections(WikiArticle parsed, WikiArticle generated, WikiArticle combined) { var sections = GetFreshSections(); foreach (var pair in generated.Sections) { sections[pair.Key] += pair.Value + "\n"; } foreach (var pair in parsed.Sections) { string key = SectionMapping[pair.Key]; if (SkippedSections.Contains(key) || String.IsNullOrWhiteSpace(key)) { continue; } if (key == "Miscellaneous") { foreach (string line in pair.Value.Split("\n")) { if (line.ToLower().Contains("illustrator") || line.ToLower().Contains("illustrated")) { continue; } if (line.ToLower().Contains("source needed")) { continue; } if (line.Contains("More information has been revealed on")) { sections[key] += line.Replace("More information has been revealed on", "This card was included in") + "\n"; continue; } sections[key] += line + "\n"; } sections[key] += "\n"; continue; } sections[key] += pair.Value + "\n"; } foreach (var pair in sections) { if (String.IsNullOrWhiteSpace(pair.Value) && !MandatorySections.Contains(pair.Key)) { continue; } combined.AddSection(pair.Key, pair.Value); } }
protected override void AddSections(WikiArticle article) { if (Card.Abilities.Count > 0) { article.AddSection("Ability", GetAbilityInfoboxes(Card.Abilities.Values)); if (Card.Abilities.Any(x => x.Value.CardSpawned != null)) { var cardSpawned = Card.Abilities.Where(x => x.Value.CardSpawned != null).Select(x => x.Value.CardSpawned).First(); article.AddSection("Card Summoned", GetCardReference(cardSpawned)); } } else { article.AddSection("Ability", $"{{{{{TypeTemplate}|{Card.Name}}}}} has no abilities."); } if (SubCard.SignatureCard != null) { article.AddSection("Signature Card", GetCardReference(SubCard.SignatureCard)); } if (Card.TokenParents.Count > 0) { article.AddSection("Summoned By", GetTokenParents(Card)); } article.AddSection("Miscellaneous", GetIllustrator(Card)); }
protected override void AddSections(WikiArticle article) { string combined = @"{| class=""wikitable"" style=""width: 95 %; margin: auto; "" !style = ""width: 300px"" | File !Name !Transcription "; foreach (var pair in Card.VoiceOverFiles) { combined += $@"|- |[[File:{pair.Value}]] |{pair.Key} |{Card.VoiceOverLines[pair.Key]} "; } combined += "|}"; article.AddSection("Uncategorized", combined); }
protected override void AddSections(WikiArticle article) { var match = Regex.Match(CurrentArticle, @"(?s)==+\s*(Ability|Abilities|Active)\s*==+\s*\n+(((\{\{Ability Infobox.*?\}\})\n+)+)"); if (match.Success) { article.AddSection("Ability", match.Groups[2].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } else { match = Regex.Match(CurrentArticle, @"(?s)==+\s*(Ability|Abilities|Active)\s*==+\s*\n+((.*?no.*?(abilities|ability|active).*?)|N/A)\n+"); if (match.Success) { article.AddSection("Ability", match.Groups[2].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } else { match = Regex.Match(CurrentArticle, @"(?s)==+\s*(Ability|Abilities|Active)\s*==+\n(?=(\[\[Category|==))"); if (match.Success) { article.AddSection("Ability", match.Groups[2].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } } } match = Regex.Match(CurrentArticle, @"(?s)==+\s*(Description|Effect|Effects|Play effect|Play Effect|Active|Ability)\s*==+\s*\n+(.*?)\n(\s*)?(?=(\[\[Category|==))"); if (match.Success) { article.AddSection("Card Text", match.Groups[2].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } match = Regex.Match(CurrentArticle, @"(?s)==+\s*(Premier Card|Signature Card|Spell|Card)\s*==+\s*\n+(\{\{(Card|Deck).*?\}\})\n+"); if (match.Success) { article.AddSection("Signature Card", match.Groups[2].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } match = Regex.Match(CurrentArticle, @"(?s)==+\s*Notes\s*==+\s*\n+?([^=\[]*?)\n(?=(\s*\[\[Category|==)?)(\s+?)"); if (match.Success) { article.AddSection("Notes", match.Groups[1].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } match = Regex.Match(CurrentArticle, @"(?s)==+\s*(Related Cards|Related cards)\s*==+\s*\n+(.*?)\n(\s+)?(?=(\[\[Category|==))"); if (match.Success) { article.AddSection("Related Cards", match.Groups[2].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } match = Regex.Match(CurrentArticle, @"(?s)==+\s*Changelog\s*==+\s*\n+(.*?)\n(\s+)?(?=(\[\[Category|==))"); if (match.Success) { article.AddSection("Changelog", match.Groups[1].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } match = Regex.Match(CurrentArticle, @"(?s)==+\s*Trivia\s*==+\s*\n+(.*?)\n(\s+)?(?=(\[\[Category|==))"); if (match.Success) { article.AddSection("Trivia", match.Groups[1].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } match = Regex.Match(CurrentArticle, @"(?s)==+\s*(Misc|Miscellaneous)\s*==+\s*\n+(.*?)\n(\s+)?(?=(\[\[Category|==))"); if (match.Success) { article.AddSection("Miscellaneous", match.Groups[2].Value); CurrentArticle = CurrentArticle.Replace(match.Value, ""); } }