@Test public void withoutBlank() throws IOException, OfxAuthoringException { renderer = new LatexParagraphRenderer(cmm,dsm,false); f = new File(rootDir,dir+"/"+Key.withoutBlank+".txt"); renderer.render(create()); renderTest(renderer,f); }
public void render(Paragraph paragraph) throws OfxAuthoringException { int nonInlineCounter = 0; Image image=null; for(Object o : paragraph.getContent()) { if(o instanceof Image) { image = (Image)o; if(!image.isSetAlignment() || !image.getAlignment().isSetHorizontal()) { throw new OfxAuthoringException(Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" needs an horizontal "+Alignment.class.getSimpleName()); } XmlAlignmentFactory.Horizontal horizontal = XmlAlignmentFactory.Horizontal.valueOf(image.getAlignment().getHorizontal()); if(!horizontal.equals(XmlAlignmentFactory.Horizontal.inline)){nonInlineCounter++;} } } if(nonInlineCounter>1){throw new OfxAuthoringException("More than one non-inline "+Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" not allowed");} if(nonInlineCounter==1 && image!=null) { paragraph.getContent().remove(image); LatexImageRenderer rImage = new LatexImageRenderer(cmm,dsm); rImage.render(this,image); txt.add("\\begin{window}[0, r, "+rImage.getSingleLine()+", {}]"); } StringBuffer sb = new StringBuffer(); for(Object o : paragraph.getContent()) { if(o==null){throw new OfxAuthoringException(Paragraph.class.getSimpleName()+" has no content");} else if(o instanceof String){sb.append(TexSpecialChars.replace((String)o));} else if(o instanceof Emphasis){renderEmphasis(sb, (Emphasis)o);} else if(o instanceof Image){logger.info("INLINE Image NYI");} else {logger.warn("Unknown object: "+o.getClass().getCanonicalName());} } txt.add(sb.toString()); if(nonInlineCounter==1 && image!=null) { txt.add("\\end{window}"); } }
LatexParagraphRenderer extends AbstractOfxLatexRenderer implements OfxLatexRenderer { public void render(Paragraph paragraph) throws OfxAuthoringException { int nonInlineCounter = 0; Image image=null; for(Object o : paragraph.getContent()) { if(o instanceof Image) { image = (Image)o; if(!image.isSetAlignment() || !image.getAlignment().isSetHorizontal()) { throw new OfxAuthoringException(Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" needs an horizontal "+Alignment.class.getSimpleName()); } XmlAlignmentFactory.Horizontal horizontal = XmlAlignmentFactory.Horizontal.valueOf(image.getAlignment().getHorizontal()); if(!horizontal.equals(XmlAlignmentFactory.Horizontal.inline)){nonInlineCounter++;} } } if(nonInlineCounter>1){throw new OfxAuthoringException("More than one non-inline "+Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" not allowed");} if(nonInlineCounter==1 && image!=null) { paragraph.getContent().remove(image); LatexImageRenderer rImage = new LatexImageRenderer(cmm,dsm); rImage.render(this,image); txt.add("\\begin{window}[0, r, "+rImage.getSingleLine()+", {}]"); } StringBuffer sb = new StringBuffer(); for(Object o : paragraph.getContent()) { if(o==null){throw new OfxAuthoringException(Paragraph.class.getSimpleName()+" has no content");} else if(o instanceof String){sb.append(TexSpecialChars.replace((String)o));} else if(o instanceof Emphasis){renderEmphasis(sb, (Emphasis)o);} else if(o instanceof Image){logger.info("INLINE Image NYI");} else {logger.warn("Unknown object: "+o.getClass().getCanonicalName());} } txt.add(sb.toString()); if(nonInlineCounter==1 && image!=null) { txt.add("\\end{window}"); } } }
LatexParagraphRenderer extends AbstractOfxLatexRenderer implements OfxLatexRenderer { public void render(Paragraph paragraph) throws OfxAuthoringException { int nonInlineCounter = 0; Image image=null; for(Object o : paragraph.getContent()) { if(o instanceof Image) { image = (Image)o; if(!image.isSetAlignment() || !image.getAlignment().isSetHorizontal()) { throw new OfxAuthoringException(Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" needs an horizontal "+Alignment.class.getSimpleName()); } XmlAlignmentFactory.Horizontal horizontal = XmlAlignmentFactory.Horizontal.valueOf(image.getAlignment().getHorizontal()); if(!horizontal.equals(XmlAlignmentFactory.Horizontal.inline)){nonInlineCounter++;} } } if(nonInlineCounter>1){throw new OfxAuthoringException("More than one non-inline "+Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" not allowed");} if(nonInlineCounter==1 && image!=null) { paragraph.getContent().remove(image); LatexImageRenderer rImage = new LatexImageRenderer(cmm,dsm); rImage.render(this,image); txt.add("\\begin{window}[0, r, "+rImage.getSingleLine()+", {}]"); } StringBuffer sb = new StringBuffer(); for(Object o : paragraph.getContent()) { if(o==null){throw new OfxAuthoringException(Paragraph.class.getSimpleName()+" has no content");} else if(o instanceof String){sb.append(TexSpecialChars.replace((String)o));} else if(o instanceof Emphasis){renderEmphasis(sb, (Emphasis)o);} else if(o instanceof Image){logger.info("INLINE Image NYI");} else {logger.warn("Unknown object: "+o.getClass().getCanonicalName());} } txt.add(sb.toString()); if(nonInlineCounter==1 && image!=null) { txt.add("\\end{window}"); } } LatexParagraphRenderer(CrossMediaManager cmm,DefaultSettingsManager dsm,boolean preBlankLine); }
LatexParagraphRenderer extends AbstractOfxLatexRenderer implements OfxLatexRenderer { public void render(Paragraph paragraph) throws OfxAuthoringException { int nonInlineCounter = 0; Image image=null; for(Object o : paragraph.getContent()) { if(o instanceof Image) { image = (Image)o; if(!image.isSetAlignment() || !image.getAlignment().isSetHorizontal()) { throw new OfxAuthoringException(Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" needs an horizontal "+Alignment.class.getSimpleName()); } XmlAlignmentFactory.Horizontal horizontal = XmlAlignmentFactory.Horizontal.valueOf(image.getAlignment().getHorizontal()); if(!horizontal.equals(XmlAlignmentFactory.Horizontal.inline)){nonInlineCounter++;} } } if(nonInlineCounter>1){throw new OfxAuthoringException("More than one non-inline "+Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" not allowed");} if(nonInlineCounter==1 && image!=null) { paragraph.getContent().remove(image); LatexImageRenderer rImage = new LatexImageRenderer(cmm,dsm); rImage.render(this,image); txt.add("\\begin{window}[0, r, "+rImage.getSingleLine()+", {}]"); } StringBuffer sb = new StringBuffer(); for(Object o : paragraph.getContent()) { if(o==null){throw new OfxAuthoringException(Paragraph.class.getSimpleName()+" has no content");} else if(o instanceof String){sb.append(TexSpecialChars.replace((String)o));} else if(o instanceof Emphasis){renderEmphasis(sb, (Emphasis)o);} else if(o instanceof Image){logger.info("INLINE Image NYI");} else {logger.warn("Unknown object: "+o.getClass().getCanonicalName());} } txt.add(sb.toString()); if(nonInlineCounter==1 && image!=null) { txt.add("\\end{window}"); } } LatexParagraphRenderer(CrossMediaManager cmm,DefaultSettingsManager dsm,boolean preBlankLine); void render(Paragraph paragraph); }
LatexParagraphRenderer extends AbstractOfxLatexRenderer implements OfxLatexRenderer { public void render(Paragraph paragraph) throws OfxAuthoringException { int nonInlineCounter = 0; Image image=null; for(Object o : paragraph.getContent()) { if(o instanceof Image) { image = (Image)o; if(!image.isSetAlignment() || !image.getAlignment().isSetHorizontal()) { throw new OfxAuthoringException(Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" needs an horizontal "+Alignment.class.getSimpleName()); } XmlAlignmentFactory.Horizontal horizontal = XmlAlignmentFactory.Horizontal.valueOf(image.getAlignment().getHorizontal()); if(!horizontal.equals(XmlAlignmentFactory.Horizontal.inline)){nonInlineCounter++;} } } if(nonInlineCounter>1){throw new OfxAuthoringException("More than one non-inline "+Image.class.getSimpleName()+" in "+Paragraph.class.getSimpleName()+" not allowed");} if(nonInlineCounter==1 && image!=null) { paragraph.getContent().remove(image); LatexImageRenderer rImage = new LatexImageRenderer(cmm,dsm); rImage.render(this,image); txt.add("\\begin{window}[0, r, "+rImage.getSingleLine()+", {}]"); } StringBuffer sb = new StringBuffer(); for(Object o : paragraph.getContent()) { if(o==null){throw new OfxAuthoringException(Paragraph.class.getSimpleName()+" has no content");} else if(o instanceof String){sb.append(TexSpecialChars.replace((String)o));} else if(o instanceof Emphasis){renderEmphasis(sb, (Emphasis)o);} else if(o instanceof Image){logger.info("INLINE Image NYI");} else {logger.warn("Unknown object: "+o.getClass().getCanonicalName());} } txt.add(sb.toString()); if(nonInlineCounter==1 && image!=null) { txt.add("\\end{window}"); } } LatexParagraphRenderer(CrossMediaManager cmm,DefaultSettingsManager dsm,boolean preBlankLine); void render(Paragraph paragraph);  }