private Character BuildCat(Wikitext root) { if (root == null) { throw new ArgumentNullException(nameof(root)); } var infobox = root.EnumDescendants().OfType <Template>().First(t => Utility.NormalizeTitle(t.Name) == "Charcat"); var entity = new Character { Intro = root.ExtractIntro(), Age = infobox.Arguments["age"]?.Value.StripText(), PastAffiliation = infobox.Arguments["pastaffie"]?.Value.EnumDescendants().OfType <WikiLink>().Select(l => l.Target.StripText()).ToArray(), CurrentAffiliation = infobox.Arguments["affie"]?.Value.EnumDescendants().OfType <WikiLink>().Select(l => l.Target.StripText()).ToArray(), }; return(entity); }
private Volume BuildVolume(Wikitext root) { if (root == null) { throw new ArgumentNullException(nameof(root)); } var infobox = root.EnumDescendants().OfType <Template>().First(t => Utility.NormalizeTitle(t.Name) == "Book"); var entity = new Volume { Intro = root.ExtractIntro(), Author = infobox.Arguments["author"]?.Value.FirstWikiLink()?.ToPlainText(), ReleaseDate = infobox.Arguments["publish date"]?.Value.ToPlainText(NodePlainTextOptions.RemoveRefTags), }; { var lines = root.ExtractSection("Blurb").Select(l => l.StripText()); entity.Blurb = string.Join("\n", lines); } return(entity); }
private UnknownEntity BuildUnknown(Wikitext root) { return(new UnknownEntity { Intro = root.ExtractIntro() }); }