示例#1
0
        public IChapter ChapterParseAction(HtmlNode element, IParseDetails <IChapter> parseDetails)
        {
            var uri     = Parsing.CreateUriFromElementAttributeValue(element, parseDetails, Address);
            var chapter = new ChapterDistill(element.InnerText, uri, this.HostData, Log);

            ((Core.Helper.ChapterParseDetails)parseDetails).HostVariables.ToList().ForEach((pair) =>
            {
                if (chapter.HostVariables.ContainsKey(pair.Key))
                {
                    chapter.HostVariables[pair.Key] = pair.Value;
                }
                else
                {
                    chapter.HostVariables.Add(pair.Key, pair.Value);
                }
            });

            return(chapter ?? null);
        }
示例#2
0
        public IChapter ChapterParseActionUriSupplied(Uri chapterUri, HtmlNode element, IParseDetails <IChapter> parseDetails, string html = null)
        {
            var chapterTitle = ParseChapterTitle(element, html);

            var chapter = new ChapterDistill(chapterTitle, chapterUri, this.HostData, Log);

            ((Core.Helper.ChapterParseDetails)parseDetails).HostVariables.ToList().ForEach((pair) =>
            {
                if (chapter.HostVariables.ContainsKey(pair.Key))
                {
                    chapter.HostVariables[pair.Key] = pair.Value;
                }
                else
                {
                    chapter.HostVariables.Add(pair.Key, pair.Value);
                }
            });

            return(chapter ?? null);
        }