1 29 30 package com.caucho.xtpdoc; 31 32 import javax.xml.stream.XMLStreamException; 33 import javax.xml.stream.XMLStreamWriter; 34 import java.io.IOException ; 35 import java.io.PrintWriter ; 36 37 public class NamedText implements ContentItem { 38 private String _name; 39 private ContentItem _text; 40 41 public NamedText(String name, ContentItem text) 42 { 43 _name = name; 44 _text = text; 45 } 46 47 public void writeHtml(XMLStreamWriter out) 48 throws XMLStreamException 49 { 50 out.writeStartElement("b"); 51 out.writeCharacters(_name); 52 out.writeEndElement(); 54 out.writeCharacters(" "); 55 _text.writeHtml(out); 56 } 57 58 public void writeLaTeX(PrintWriter out) 59 throws IOException 60 { 61 out.print("\\textbf{" + LaTeXUtil.escapeForLaTeX(_name) + ":} "); 62 63 _text.writeLaTeX(out); 64 } 65 66 public void writeLaTeXEnclosed(PrintWriter out) 67 throws IOException 68 { 69 writeLaTeX(out); 70 } 71 72 public void writeLaTeXTop(PrintWriter out) 73 throws IOException 74 { 75 writeLaTeX(out); 76 } 77 } 78 | Popular Tags |