示例#1
0
 virtual public void SetUp()
 {
     workerContextImpl = new WorkerContextImpl();
     p.SetCssAppliers(new CssAppliersImpl());
     workerContextImpl.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(null));
     currentContent.AddRange(p.Content(workerContextImpl, new Tag("p"), "some paragraph text"));
 }
示例#2
0
 virtual public void init()
 {
     h.SetCssAppliers(new CssAppliersImpl());
     workerContextImpl = new WorkerContextImpl();
     workerContextImpl.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(null).AutoBookmark(true));
     content = h.Content(workerContextImpl, H2, "text inside a header tag");
 }
示例#3
0
 virtual public void SetUp()
 {
     hpc = new HtmlPipelineContext(null);
     p   = new HtmlPipeline(hpc, null);
     wc  = new WorkerContextImpl();
     p.Init(wc);
 }
示例#4
0
 public void init()
 {
     li.SetCssAppliers(new CssAppliersImpl());
     workerContextImpl = new WorkerContextImpl();
     workerContextImpl.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(null));
     currentContent.AddRange(li.Content(workerContextImpl, new Tag("li"), "list item"));
 }
 virtual public void init()
 {
     workerContextImpl = new WorkerContextImpl();
     workerContextImpl.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(null));
     t.SetCssAppliers(new CssAppliersImpl());
     content = t.Content(workerContextImpl, new Tag("pre"), "   code snippet {" +
                         "return it all!!}        ");
 }
示例#6
0
 virtual public void SetUp()
 {
     workerContextImpl = new WorkerContextImpl();
     workerContextImpl.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(null));
     s.SetCssAppliers(new CssAppliersImpl());
     content = s.Content(workerContextImpl, new Tag("span"), "	text snippet "+
                         "return it sanitized!!       ");
 }
示例#7
0
 virtual public void SetUp()
 {
     workerContextImpl = new WorkerContextImpl();
     workerContextImpl.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(null));
     currentContent.Add(new Paragraph("titel paragraph"));
     currentContent.Add(Chunk.NEWLINE);
     currentContent.Add(new NoNewLineParagraph("first content text"));
     currentContent.Add(new Paragraph("footer text"));
     d.SetCssAppliers(new CssAppliersImpl());
 }
示例#8
0
        /**
         * Returns the local WorkerContext, beware: could be a newly initialized
         * one, if {@link XMLWorker#close()} has been called before.
         *
         * @return the local WorkerContext
         */
        static protected internal IWorkerContext GetLocalWC()
        {
            IWorkerContext ik = (IWorkerContext)Thread.GetData(context);

            if (ik == null)
            {
                ik = new WorkerContextImpl();
                Thread.SetData(context, ik);
            }
            return(ik);
        }
示例#9
0
        public void VerifyBreakChunk()
        {
            Break             br = new Break();
            WorkerContextImpl workerContextImpl = new WorkerContextImpl();
            CssAppliersImpl   cssAppliers       = new CssAppliersImpl();

            workerContextImpl.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(cssAppliers));
            br.SetCssAppliers(cssAppliers);
            IList <IElement> end = br.End(workerContextImpl, new Tag("span"), null);

            Assert.AreEqual(Chunk.NEWLINE.Content, end[0].Chunks[0].Content);
        }
示例#10
0
        public void SetUp()
        {
            lst = new List <IWritable>();
            IElementHandler elemH = new CustomElementHandler();

            p        = new ElementHandlerPipeline(elemH, null);
            po       = new ProcessObject();
            writable = new WritableElement(new Chunk("aaaaa"));
            po.Add(writable);
            context = new WorkerContextImpl();
            p.Init(context);
        }
示例#11
0
        virtual public void ResolveBuild()
        {
            AbstractTagProcessor table2 = new Table();

            table2.SetCssAppliers(new CssAppliersImpl());
            WorkerContextImpl context = new WorkerContextImpl();

            context.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(null));
            PdfPTable table = (PdfPTable)(table2.End(context, tag, rows)[0]);

            Assert.AreEqual(4, table.Rows[0].GetCells().Length);
            Assert.AreEqual(4, table.NumberOfColumns);
        }
示例#12
0
        virtual public void TestContentToChunk()
        {
            Anchor              a                   = new Anchor();
            Tag                 t                   = new Tag("dummy");
            String              content2            = "some content";
            WorkerContextImpl   ctx                 = new WorkerContextImpl();
            HtmlPipelineContext htmlPipelineContext = new HtmlPipelineContext(null);

            ctx.Put(typeof(HtmlPipeline).FullName, htmlPipelineContext);
            a.SetCssAppliers(new CssAppliersImpl());
            IList <IElement> ct = a.Content(ctx, t, content2);

            Assert.AreEqual(content2, ct[0].Chunks[0].Content);
        }
        virtual public void SetUp()
        {
            StyleAttrCSSResolver css = new StyleAttrCSSResolver();

            css.AddCss("dummy { key1: value1; key2: value2 } .aklass { key3: value3;} #dumid { key4: value4}", true);
            CssResolverPipeline p = new CssResolverPipeline(css, null);
            Tag t = new Tag("dummy");

            t.Attributes["id"]    = "dumid";
            t.Attributes["class"] = "aklass";
            WorkerContextImpl context = new WorkerContextImpl();

            p.Init(context);
            IPipeline open = p.Open(context, t, null);

            css2 = t.CSS;
        }
        virtual public void SetUp()
        {
            LoggerFactory.GetInstance().SetLogger(new SysoLogger(3));
            root  = new Tag("body");
            p     = new Tag("p");
            ul    = new Tag("ul");
            first = new Tag("li");
            last  = new Tag("li");

            single = new ListItem("Single");
            start  = new ListItem("Start");
            end    = new ListItem("End");

            listWithOne          = new List <IElement>();
            listWithTwo          = new List <IElement>();
            orderedUnorderedList = new OrderedUnorderedList();
            CssAppliersImpl cssAppliers = new CssAppliersImpl();

            orderedUnorderedList.SetCssAppliers(cssAppliers);
            workerContextImpl = new WorkerContextImpl();
            HtmlPipelineContext context2 = new HtmlPipelineContext(cssAppliers);

            workerContextImpl.Put(typeof(HtmlPipeline).FullName, context2);
            root.AddChild(p);
            root.AddChild(ul);
            ul.AddChild(first);
            ul.AddChild(last);
            p.CSS["font-size"]     = "12pt";
            p.CSS["margin-top"]    = "12pt";
            p.CSS["margin-bottom"] = "12pt";
            new ParagraphCssApplier(cssAppliers).Apply(new Paragraph("paragraph"), p, context2);
            first.CSS["margin-top"]     = "50pt";
            first.CSS["padding-top"]    = "25pt";
            first.CSS["margin-bottom"]  = "50pt";
            first.CSS["padding-bottom"] = "25pt";
            last.CSS["margin-bottom"]   = "50pt";
            last.CSS["padding-bottom"]  = "25pt";
            listWithOne.Add(single);
            listWithTwo.Add(start);
            listWithTwo.Add(end);
        }
示例#15
0
        public virtual void StartElement(String tag, IDictionary <String, String> attr, String ns)
        {
            Tag t = CreateTag(tag, attr, ns);
            WorkerContextImpl ctx = (WorkerContextImpl)GetLocalWC();

            if (null != ctx.GetCurrentTag())
            {
                ctx.GetCurrentTag().AddChild(t);
            }
            ctx.SetCurrentTag(t);
            IPipeline     wp = rootpPipe;
            ProcessObject po = new ProcessObject();

            try {
                while (null != (wp = wp.Open(ctx, t, po)))
                {
                    ;
                }
            } catch (PipelineException e) {
                throw new RuntimeWorkerException(e);
            }
        }
示例#16
0
 virtual public void Init()
 {
     b.SetCssAppliers(new CssAppliersImpl());
     workerContextImpl = new WorkerContextImpl();
     workerContextImpl.Put(typeof(HtmlPipeline).FullName, new HtmlPipelineContext(null));
 }