Beispiel #1
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));
        }
Beispiel #2
0
        private RtfToRtfConverter CreateChain(Stream input, Stream output, bool push, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            RtfParser parser    = new RtfParser(input, push, base.InputStreamBufferSize, this.testBoundaryConditions, push ? null : progressMonitor, null);
            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, this.testInjectionTraceStream, progressMonitor) : new TextInjection(this.injectHead, this.injectTail, this.testBoundaryConditions, this.testInjectionTraceStream, progressMonitor));
            }
            return(new RtfToRtfConverter(parser, output, push, injection, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
        }
Beispiel #3
0
        private IProducerConsumer CreateChain(ConverterInput input, FormatOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            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));
            }
            TextParser parser = new TextParser(input, this.unwrapFlowed, this.unwrapDelSp, this.testMaxTokenRuns, this.testBoundaryConditions);

            return(new TextFormatConverter(parser, output, injection, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum, this.testFormatConverterTraceStream));
        }
Beispiel #4
0
        private IProducerConsumer CreateChain(ConverterInput input, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            Injection      injection = null;
            EnrichedParser parser    = new EnrichedParser(input, this.testMaxTokenRuns, this.testBoundaryConditions);

            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));
            }
            TextOutput output2 = new TextOutput(output, this.wrapFlowed, this.wrapFlowed, 72, 78, null, this.fallbacks, this.htmlEscape, this.testPreserveTrailingSpaces, this.testFormatTraceStream);

            return(new EnrichedToTextConverter(parser, output2, injection, this.testTreatNbspAsBreakable, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
        }
Beispiel #5
0
        private IProducerConsumer CreateChain(Stream input, bool push, ConverterOutput output, IProgressMonitor progressMonitor)
        {
            this.locked = true;
            RtfParser parser = new RtfParser(input, push, base.InputStreamBufferSize, this.testBoundaryConditions, push ? null : progressMonitor, null);

            if (this.textExtractionMode == TextExtractionMode.ExtractText)
            {
                return(new RtfTextExtractionConverter(parser, 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));
            }
            TextOutput output2 = new TextOutput(output, this.wrapFlowed, this.wrapFlowed, 72, 78, null, this.fallbacks, this.htmlEscape, this.testPreserveTrailingSpaces, this.testFormatTraceStream);

            return(new RtfToTextConverter(parser, output2, injection, this.testTreatNbspAsBreakable, this.testTraceStream, this.testTraceShowTokenNum, this.testTraceStopOnTokenNum));
        }