Example #1
0
        public virtual ProcessedStartPage Build(StartPage startPage)
        {
            var upperBody = _tagParserContainer.ParseAll(startPage.UpperBody ?? "", startPage.Title);

            upperBody = _markdownWrapper.ConvertToHtml(startPage.UpperBody ?? "");

            upperBody = _alertsInlineTagParser.Parse(upperBody, startPage.AlertsInline);



            return(new ProcessedStartPage(
                       startPage.Slug,
                       startPage.Title,
                       startPage.Teaser,
                       startPage.Summary,
                       upperBody,
                       startPage.FormLinkLabel,
                       startPage.FormLink,
                       startPage.LowerBody,
                       startPage.Breadcrumbs,
                       startPage.BackgroundImage,
                       startPage.Icon,
                       startPage.Alerts
                       ));
        }
        public async Task <ProfileEntity> GetProfile(string slug)
        {
            var response = await _repository.Get <ProfileResponse>(slug);

            if (response.StatusCode == 200)
            {
                var profile       = response.Content as ProfileResponse;
                var triviaSection = _triviaFactory.Build(profile.TriviaSection);

                var processedBody = _parser.ParseAll(profile.Body, profile.Title, false);
                processedBody = _markdownWrapper.ConvertToHtml(processedBody);
                processedBody = _alertsInlineTagParser.Parse(processedBody, profile.Alerts);
                processedBody = _inlineQuotesTagParser.Parse(processedBody, profile.InlineQuotes);

                return(new ProfileEntity
                {
                    Title = profile.Title,
                    Slug = profile.Slug,
                    Teaser = profile.Teaser,
                    Quote = profile.Quote,
                    Image = profile.Image,
                    Body = processedBody,
                    Breadcrumbs = profile.Breadcrumbs,
                    Alerts = profile.Alerts,
                    TriviaSubheading = profile.TriviaSubheading,
                    TriviaSection = triviaSection,
                    Subtitle = profile.Subtitle,
                    InlineQuotes = profile.InlineQuotes,
                    EventsBanner = profile.EventsBanner
                });
            }

            return(null);
        }
        public ProcessedSection Build(Section section, string articleTitle = null)
        {
            var parsedBody = _markdownWrapper.ConvertToHtml(section.Body);

            parsedBody = _profileTagParser.Parse(parsedBody, section.Profiles);
            parsedBody = _documentTagParser.Parse(parsedBody, section.Documents);
            parsedBody = _alertsInlineTagParser.Parse(parsedBody, section.AlertsInline);
            parsedBody = _searchTagParser.Parse(parsedBody, new List <S3BucketSearch> {
                section.S3Bucket
            });

            if (section.Body.Contains("PrivacyNotice:"))
            {
                section.PrivacyNotices = GetPrivacyNotices().Result;
                parsedBody             = _privacyNoticeTagParser.Parse(parsedBody, section.PrivacyNotices);
            }

            parsedBody = _tagParserContainer.ParseAll(parsedBody, articleTitle);

            return(new ProcessedSection(
                       section.Title,
                       section.Slug,
                       section.MetaDescription,
                       parsedBody,
                       section.Profiles,
                       section.Documents,
                       section.AlertsInline
                       ));
        }
        public virtual ProcessedArticle Build(Article article)
        {
            var processedSections = new List <ProcessedSection>();

            foreach (var section in article.Sections)
            {
                section.S3Bucket = article.S3Bucket;
                processedSections.Add(_sectionFactory.Build(section, article.Title));
            }

            var body = _markdownWrapper.ConvertToHtml(article.Body ?? "");

            body = _profileTagParser.Parse(body, article.Profiles);
            body = _documentTagParser.Parse(body, article.Documents);
            body = _alertsInlineTagParser.Parse(body, article.AlertsInline);
            body = _searchTagParser.Parse(body, new List <S3BucketSearch> {
                article.S3Bucket
            });
            if (body.Contains("PrivacyNotice:"))
            {
                article.PrivacyNotices = GetPrivacyNotices().Result;
                body = _privacyNoticeTagParser.Parse(body, article.PrivacyNotices);
            }

            body = _tagParserContainer.ParseAll(body, article.Title);

            return(new ProcessedArticle(article.Title, article.Slug, body, article.Teaser, article.MetaDescription,
                                        processedSections, article.Icon, article.BackgroundImage, article.Image, article.Breadcrumbs, article.Alerts, article.ParentTopic, article.AlertsInline, article.S3Bucket, article.UpdatedAt, article.HideLastUpdated));
        }
Example #5
0
        public virtual ProcessedNews Build(News news)
        {
            var body = _simpleTagParserContainer.ParseAll(news.Body, news.Title);

            body = _markdownWrapper.ConvertToHtml(body ?? "");
            body = _documentTagParser.Parse(body, news.Documents);

            return(new ProcessedNews(news.Title, news.Slug, news.Teaser, news.Purpose, news.Image, news.ThumbnailImage, body, news.Breadcrumbs, news.SunriseDate, news.SunsetDate, news.Alerts, news.Tags));
        }
Example #6
0
        public virtual ProcessedEvents Build(Event eventItem)
        {
            var mapDetails = new MapDetails()
            {
                MapPosition             = eventItem.MapPosition,
                AccessibleTransportLink = eventItem.AccessibleTransportLink
            };

            var description = _simpleTagParserContainer.ParseAll(eventItem.Description, eventItem.Title);

            description = _markdownWrapper.ConvertToHtml(description ?? "");
            description = _documentTagParser.Parse(description, eventItem.Documents);

            return(new ProcessedEvents(eventItem.Title, eventItem.Slug, eventItem.Teaser, eventItem.ImageUrl,
                                       eventItem.ThumbnailImageUrl, description, eventItem.Fee, eventItem.Location, eventItem.SubmittedBy,
                                       eventItem.EventDate, eventItem.StartTime, eventItem.EndTime, eventItem.Breadcrumbs, eventItem.Categories,
                                       mapDetails, eventItem.BookingInformation, eventItem.Group, eventItem.Alerts, eventItem.AccessibleTransportLink, eventItem.MetaDescription));
        }