Exemplo n.º 1
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            base.Locked = true;
            HtmlInjection htmlInjection = null;

            //if (this.injectHead != null || this.injectTail != null)
            //{
            //    htmlInjection = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, null, base.TestBoundaryConditions, null, progressMonitor);
            //    this.normalizeInputHtml = true;
            //}
            if (this.filterHtml || this.outputFragment)// || this.htmlCallback != null)
            {
                this.normalizeInputHtml = true;
            }
            IHtmlParser parser2;

            if (this.normalizeInputHtml)
            {
                HtmlParser parser = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, base.TestBoundaryConditions);
                parser2 = new HtmlNormalizingParser(parser, htmlInjection, false, this.testMaxHtmlNormalizerNesting, base.TestBoundaryConditions, null, this.testNormalizerTraceShowTokenNum, 0);
            }
            else
            {
                parser2 = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, base.TestBoundaryConditions);
            }
            HtmlWriter writer = new HtmlWriter(output, this.filterHtml, this.normalizeInputHtml);

            return(new HtmlToHtmlConverter(parser2, writer, false, this.outputFragment, this.filterHtml, null, this.testTruncateForCallback, htmlInjection != null && htmlInjection.HaveTail, null, this.testTraceShowTokenNum, 0, this.smallCssBlockThreshold, false, progressMonitor));
        }
Exemplo n.º 2
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            HtmlParser htmlParser = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);

            if (this.mode == TextExtractionMode.ExtractText)
            {
                return(new HtmlTextExtractionConverter(htmlParser, output, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
            }
            Injection injection = null;

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = ((this.injectionFormat == HeaderFooterFormat.Html) ? new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, false, null, this.testBoundaryConditions, null, progressMonitor) : new TextInjection(this.injectHead, this.injectTail, this.testBoundaryConditions, null, progressMonitor));
            }
            IHtmlParser parser = htmlParser;

            if (this.normalizeInputHtml)
            {
                if (this.injectionFormat == HeaderFooterFormat.Html)
                {
                    parser    = new HtmlNormalizingParser(htmlParser, (HtmlInjection)injection, false, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                    injection = null;
                }
                else
                {
                    parser = new HtmlNormalizingParser(htmlParser, null, false, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                }
            }
            TextOutput output2 = new TextOutput(output, this.wrapFlowed, this.wrapFlowed, 72, 78, this.imageRenderingCallback, this.fallbacks, this.htmlEscape, this.testPreserveTrailingSpaces, this.testFormatTraceStream);

            return(new HtmlToTextConverter(parser, output2, injection, false, false, this.testTreatNbspAsBreakable, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.ShouldUseNarrowGapForPTagHtmlToTextConversion, this.OutputAnchorLinks, this.OutputImageLinks));
        }
 // Token: 0x060013EB RID: 5099 RVA: 0x0008DC98 File Offset: 0x0008BE98
 public HtmlFormatConverterWithEncapsulation(HtmlNormalizingParser parser, FormatOutput output, bool encapsulateMarkup, bool testTreatNbspAsBreakable, Stream traceStream, bool traceShowTokenNum, int traceStopOnTokenNum, Stream formatConverterTraceStream, IProgressMonitor progressMonitor) : base(parser, output, testTreatNbspAsBreakable, traceStream, traceShowTokenNum, traceStopOnTokenNum, formatConverterTraceStream, progressMonitor)
 {
     this.encapsulateMarkup = encapsulateMarkup;
     if (this.output != null && this.encapsulateMarkup)
     {
         this.output.Initialize(this.Store, SourceFormat.HtmlEncapsulateMarkup, "converted from html");
     }
 }
Exemplo n.º 4
0
        internal FormatConverter CreateDeencapsulationChain(RtfParser parser, IProgressMonitor progressMonitor)
        {
            HtmlInRtfExtractingInput input    = new HtmlInRtfExtractingInput(parser, this.TestMaxHtmlTagSize, base.TestBoundaryConditions, this.TestTraceStream, this.TestTraceShowTokenNum, this.TestTraceStopOnTokenNum);
            HtmlParser            parser2     = new HtmlParser(input, false, false, this.TestMaxTokenRuns, this.TestMaxHtmlTagAttributes, base.TestBoundaryConditions);
            HtmlNormalizingParser parser3     = new HtmlNormalizingParser(parser2, null, false, this.TestMaxHtmlNormalizerNesting, base.TestBoundaryConditions, this.TestNormalizerTraceStream, this.TestNormalizerTraceShowTokenNum, this.TestNormalizerTraceStopOnTokenNum);
            FormatStore           formatStore = new FormatStore();

            return(new HtmlFormatConverter(parser3, formatStore, false, false, this.TestHtmlTraceStream, this.TestHtmlTraceShowTokenNum, this.TestHtmlTraceStopOnTokenNum, this.TestFormatConverterTraceStream, progressMonitor));
        }
Exemplo n.º 5
0
        private FormatConverter CreateChain(ConverterInput input, IProgressMonitor progressMonitor)
        {
            this.Locked = true;
            HtmlParser            parser      = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, base.TestBoundaryConditions);
            HtmlNormalizingParser parser2     = new HtmlNormalizingParser(parser, null, false, this.testMaxHtmlNormalizerNesting, base.TestBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
            FormatStore           formatStore = new FormatStore();

            return(new HtmlFormatConverter(parser2, formatStore, false, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.TestFormatConverterTraceStream, progressMonitor));
        }
        public HtmlFragmentToRtfConverter(RtfOutput output, Stream traceStream, IProgressMonitor progressMonitor)
        {
            HtmlParser            parser  = new HtmlParser(new ConverterBufferInput(string.Empty, progressMonitor), false, false, 64, 8, false);
            HtmlNormalizingParser parser2 = new HtmlNormalizingParser(parser, null, false, 4096, false, null, true, 0);

            this.formatStore = new FormatStore();
            this.formatStore.InitializeCodepageDetector();
            this.converter = new HtmlFormatConverter(parser2, this.formatStore, true, false, traceStream, true, 0, null, progressMonitor);
            this.output    = output;
        }
Exemplo n.º 7
0
        private void CreateHtmlToHtmlConverter(string fragment, HtmlWriter writer)
        {
            HtmlParser  htmlParser = new HtmlParser(new ConverterBufferInput(fragment, this.progressMonitor), false, this.injectionFormat == HeaderFooterFormat.Text, 64, 8, this.testBoundaryConditions);
            IHtmlParser parser     = htmlParser;

            if (this.injectionFormat == HeaderFooterFormat.Html)
            {
                parser = new HtmlNormalizingParser(htmlParser, null, false, 4096, this.testBoundaryConditions, null, true, 0);
            }
            this.fragmentToHtmlConverter = new HtmlToHtmlConverter(parser, writer, true, this.injectionFormat == HeaderFooterFormat.Html, this.filterHtml, this.callback, true, false, this.traceStream, true, 0, -1, false, this.progressMonitor);
        }
Exemplo n.º 8
0
        // Token: 0x06000FAE RID: 4014 RVA: 0x0007539C File Offset: 0x0007359C
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            HtmlInjection injection = null;
            HtmlParser    parser    = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, false, null, this.testBoundaryConditions, null, progressMonitor);
            }
            HtmlNormalizingParser parser2 = new HtmlNormalizingParser(parser, injection, false, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
            EnrichedFormatOutput  output2 = new EnrichedFormatOutput(output, null, this.fallbacks, this.testFormatTraceStream, this.testFormatOutputTraceStream);

            return(new HtmlFormatConverter(parser2, output2, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream, progressMonitor));
        }
Exemplo n.º 9
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            HtmlInjection injection = null;

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
            }
            HtmlParser            parser  = new HtmlParser(input, this.detectEncodingFromMetaTag, false, TextConvertersDefaults.MaxTokenRuns(this.testBoundaryConditions), TextConvertersDefaults.MaxHtmlAttributes(this.testBoundaryConditions), this.testBoundaryConditions);
            HtmlNormalizingParser parser2 = new HtmlNormalizingParser(parser, injection, false, TextConvertersDefaults.MaxHtmlNormalizerNesting(this.testBoundaryConditions), this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
            HtmlWriter            writer  = new HtmlWriter(output, this.filterHtml, true);
            FormatOutput          output2 = new HtmlFormatOutput(writer, null, this.OutputFragment, this.TestFormatTraceStream, this.TestFormatOutputTraceStream, this.filterHtml, this.htmlCallback, false);

            return(new HtmlFormatConverter(parser2, output2, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.TestFormatConverterTraceStream, progressMonitor));
        }
Exemplo n.º 10
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            HtmlInjection     htmlInjection  = null;
            HtmlInjection     htmlInjection2 = null;
            IProducerConsumer result;

            try
            {
                if (this.injectHead != null || this.injectTail != null)
                {
                    htmlInjection2          = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
                    htmlInjection           = htmlInjection2;
                    this.normalizeInputHtml = true;
                }
                if (this.filterHtml || this.outputFragment || this.htmlCallback != null)
                {
                    this.normalizeInputHtml = true;
                }
                IHtmlParser parser2;
                if (this.normalizeInputHtml)
                {
                    HtmlParser parser = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                    parser2        = new HtmlNormalizingParser(parser, htmlInjection, this.htmlCallback != null, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                    htmlInjection2 = null;
                }
                else
                {
                    parser2 = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                }
                HtmlWriter writer = new HtmlWriter(output, this.filterHtml, this.normalizeInputHtml && !this.testNoNewLines);
                result = new HtmlToHtmlConverter(parser2, writer, this.testConvertFragment, this.outputFragment, this.filterHtml, this.htmlCallback, this.testTruncateForCallback, htmlInjection != null && htmlInjection.HaveTail, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.smallCssBlockThreshold, this.preserveDisplayNoneStyle, progressMonitor);
            }
            finally
            {
                IDisposable disposable = htmlInjection2;
                if (disposable != null)
                {
                    disposable.Dispose();
                    htmlInjection2 = null;
                }
            }
            return(result);
        }
Exemplo n.º 11
0
        private void CreateHtmlToHtmlConverter(string fragment, HtmlWriter writer)
        {
            var parser = new HtmlParser(
                new ConverterBufferInput(fragment, progressMonitor),
                false,
                (injectionFormat == HeaderFooterFormat.Text),
                64,
                8,
                testBoundaryConditions);

            IHtmlParser parserInterface = parser;


            if (injectionFormat == HeaderFooterFormat.Html)
            {
                parserInterface = new HtmlNormalizingParser(
                    parser,
                    null,
                    false,
                    HtmlSupport.HtmlNestingLimit,
                    testBoundaryConditions,
                    null,
                    true,
                    0);
            }

            fragmentToHtmlConverter = new HtmlToHtmlConverter(
                parserInterface,
                writer,
                true,
                injectionFormat == HeaderFooterFormat.Html,
                filterHtml,
                callback,
                true,
                false,
                traceStream,
                true,
                0,
                -1,
                false,
                progressMonitor);
        }
Exemplo n.º 12
0
        // Token: 0x06000E8D RID: 3725 RVA: 0x00073120 File Offset: 0x00071320
        private IProducerConsumer CreateChain(ConverterInput input, FormatOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            HtmlInjection injection = null;

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, false, null, this.testBoundaryConditions, null, progressMonitor);
            }
            HtmlParser            parser  = new HtmlParser(input, this.detectEncodingFromMetaTag, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
            HtmlNormalizingParser parser2 = new HtmlNormalizingParser(parser, injection, false, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
            HtmlFormatConverter   result;

            if (this.encapsulateMarkup)
            {
                result = new HtmlFormatConverterWithEncapsulation(parser2, output, this.encapsulateMarkup, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream, progressMonitor);
            }
            else
            {
                result = new HtmlFormatConverter(parser2, output, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream, progressMonitor);
            }
            return(result);
        }
Exemplo n.º 13
0
        // Token: 0x06000EFA RID: 3834 RVA: 0x00073B80 File Offset: 0x00071D80
        internal IProducerConsumer CreateChain(RtfEncapsulation encapsulation, RtfParser parser, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.rtfEncapsulation = encapsulation;
            if (this.reportBytes == null)
            {
                throw new InvalidOperationException("I have an RtfParser but no ReportBytes.");
            }
            output.ReportBytes = this.reportBytes;
            IProducerConsumer result;

            if (encapsulation != RtfEncapsulation.Html)
            {
                HtmlInjection injection = null;
                if (this.injectHead != null || this.injectTail != null)
                {
                    injection = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
                }
                HtmlWriter         writer             = new HtmlWriter(output, this.filterHtml, !this.testNoNewLines);
                FormatOutput       output2            = new HtmlFormatOutput(writer, injection, this.outputFragment, this.testFormatTraceStream, this.testFormatOutputTraceStream, this.filterHtml, this.htmlCallback, true);
                RtfFormatConverter rtfFormatConverter = new RtfFormatConverter(parser, output2, null, false, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream);
                result = rtfFormatConverter;
            }
            else
            {
                HtmlInjection htmlInjection  = null;
                HtmlInjection htmlInjection2 = null;
                try
                {
                    if (this.injectHead != null || this.injectTail != null)
                    {
                        htmlInjection2          = new HtmlInjection(this.injectHead, this.injectTail, this.injectionFormat, this.filterHtml, this.htmlCallback, this.testBoundaryConditions, null, progressMonitor);
                        htmlInjection           = htmlInjection2;
                        this.normalizeInputHtml = true;
                    }
                    if (this.filterHtml || this.outputFragment || this.htmlCallback != null)
                    {
                        this.normalizeInputHtml = true;
                    }
                    HtmlInRtfExtractingInput input = new HtmlInRtfExtractingInput(parser, this.maxHtmlTagSize, this.testBoundaryConditions, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum);
                    IHtmlParser parser3;
                    if (this.normalizeInputHtml)
                    {
                        HtmlParser parser2 = new HtmlParser(input, false, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                        parser3        = new HtmlNormalizingParser(parser2, htmlInjection, this.htmlCallback != null, this.testMaxHtmlNormalizerNesting, this.testBoundaryConditions, this.testNormalizerTraceStream, this.testNormalizerTraceShowTokenNum, this.testNormalizerTraceStopOnTokenNum);
                        htmlInjection2 = null;
                    }
                    else
                    {
                        parser3 = new HtmlParser(input, false, false, this.testMaxTokenRuns, this.testMaxHtmlTagAttributes, this.testBoundaryConditions);
                    }
                    HtmlWriter writer2 = new HtmlWriter(output, this.filterHtml, this.normalizeInputHtml && !this.testNoNewLines);
                    result = new HtmlToHtmlConverter(parser3, writer2, false, this.outputFragment, this.filterHtml, this.htmlCallback, this.testTruncateForCallback, htmlInjection != null && htmlInjection.HaveTail, this.testHtmlTraceStream, this.testHtmlTraceShowTokenNum, this.testHtmlTraceStopOnTokenNum, this.smallCssBlockThreshold, this.preserveDisplayNoneStyle, progressMonitor);
                }
                finally
                {
                    IDisposable disposable = htmlInjection2;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                        htmlInjection2 = null;
                    }
                }
            }
            return(result);
        }
 // Token: 0x060013EA RID: 5098 RVA: 0x0008DC74 File Offset: 0x0008BE74
 public HtmlFormatConverterWithEncapsulation(HtmlNormalizingParser parser, FormatOutput output, bool testTreatNbspAsBreakable, Stream traceStream, bool traceShowTokenNum, int traceStopOnTokenNum, Stream formatConverterTraceStream, IProgressMonitor progressMonitor) : this(parser, output, false, testTreatNbspAsBreakable, traceStream, traceShowTokenNum, traceStopOnTokenNum, formatConverterTraceStream, progressMonitor)
 {
 }
Exemplo n.º 15
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.Locked = true;

            HtmlInjection injection = null;

            if (this.injectHead != null || this.injectTail != null)
            {
                injection = new HtmlInjection(
                    this.injectHead,
                    this.injectTail,
                    this.injectionFormat,
                    this.filterHtml,
                    this.htmlCallback,
                    this.TestBoundaryConditions,
                    null,
                    progressMonitor);

                this.normalizeInputHtml = true;
            }

            if (this.filterHtml || this.outputFragment || this.htmlCallback != null)
            {
                this.normalizeInputHtml = true;
            }

            IHtmlParser parser;

            if (this.normalizeInputHtml)
            {
                HtmlParser preParser = new HtmlParser(
                    input,
                    this.detectEncodingFromMetaTag,
                    false,
                    this.testMaxTokenRuns,
                    this.testMaxHtmlTagAttributes,
                    this.TestBoundaryConditions);

                parser = new HtmlNormalizingParser(
                    preParser,
                    injection,
                    this.htmlCallback != null,
                    this.testMaxHtmlNormalizerNesting,
                    this.TestBoundaryConditions,
                    this.testNormalizerTraceStream,
                    this.testNormalizerTraceShowTokenNum,
                    this.testNormalizerTraceStopOnTokenNum);
            }
            else
            {
                parser = new HtmlParser(
                    input,
                    this.detectEncodingFromMetaTag,
                    false,
                    this.testMaxTokenRuns,
                    this.testMaxHtmlTagAttributes,
                    this.TestBoundaryConditions);
            }

            HtmlWriter writer = new HtmlWriter(
                output,
                this.filterHtml,
                this.normalizeInputHtml);

            return(new HtmlToHtmlConverter(
                       parser,
                       writer,
                       false,
                       this.outputFragment,
                       this.filterHtml,
                       this.htmlCallback,
                       this.testTruncateForCallback,
                       injection != null && injection.HaveTail,
                       this.testTraceStream,
                       this.testTraceShowTokenNum,
                       this.testTraceStopOnTokenNum,
                       this.smallCssBlockThreshold,
                       this.preserveDisplayNoneStyle,
                       progressMonitor));
        }