Пример #1
0
        /// <summary>
        /// Turns the wiki markup provided into HTML.
        /// </summary>
        /// <param name="text">A wiki markup string, e.g. creole markup.</param>
        /// <returns>The wiki markup converted to HTML.</returns>
        public PageHtml ToHtml(string text)
        {
            CustomTokenParser tokenParser = new CustomTokenParser(_applicationSettings);
            PageHtml          pageHtml    = new PageHtml();
            TextPluginRunner  runner      = new TextPluginRunner(_pluginFactory);

            // Text plugins before parse
            text = runner.BeforeParse(text, pageHtml);

            // Parse the markup into HTML
            string html = _parser.Transform(text);

            // Remove bad HTML tags
            html = RemoveHarmfulTags(html);

            // Customvariables.xml file
            html = tokenParser.ReplaceTokensAfterParse(html);

            // Text plugins after parse
            html = runner.AfterParse(html);

            // Text plugins pre and post #container HTML
            pageHtml.PreContainerHtml  = runner.PreContainerHtml();
            pageHtml.PostContainerHtml = runner.PostContainerHtml();

            pageHtml.IsCacheable = runner.IsCacheable;
            pageHtml.Html        = html;

            return(pageHtml);
        }
        public override PageHtml Invoke(PageHtml pageHtml)
        {
            pageHtml.Html              = TextPluginRunner.AfterParse(pageHtml.Html);
            pageHtml.PreContainerHtml  = TextPluginRunner.PreContainerHtml();
            pageHtml.PostContainerHtml = TextPluginRunner.PostContainerHtml();
            pageHtml.IsCacheable       = _textPluginRunner.IsCacheable;

            return(pageHtml);
        }