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 Faq extends Section { 38 private FormattedTextWithAnchors _description; 39 40 public Faq(Document document) 41 { 42 super(document); 43 } 44 45 public S1 createS1() 46 { 47 S1 s1 = new S1(getDocument()); 48 addItem(s1); 49 return s1; 50 } 51 52 public FormattedTextWithAnchors createDescription() 53 { 54 _description = new FormattedTextWithAnchors(getDocument()); 55 return _description; 56 } 57 58 public void writeHtml(XMLStreamWriter out) 59 throws XMLStreamException 60 { 61 out.writeStartElement("b"); 62 out.writeCharacters(_title); 63 out.writeEndElement(); 64 65 if (_description != null) { 66 out.writeStartElement("p"); 67 out.writeStartElement("i"); 68 69 _description.writeHtml(out); 70 71 out.writeEndElement(); 72 out.writeEndElement(); 73 } 74 75 super.writeHtml(out); 76 } 77 78 public void writeLaTeX(PrintWriter out) 79 throws IOException 80 { 81 out.println("\\textbf{" + _title + "}\\\\"); 82 out.println(); 83 out.println(); 84 85 if (_description != null) { 86 out.print("\\textit{"); 87 _description.writeLaTeX(out); 88 out.println("}"); 89 } 90 91 super.writeLaTeX(out); 92 } 93 94 public void writeLaTeXEnclosed(PrintWriter out) 95 throws IOException 96 { 97 if (_type != null && _type.equals("defun")) 98 out.println("\\newpage"); 99 100 if (_title != null) 101 out.println("\\subsubsection{" + LaTeXUtil.escapeForLaTeX(_title) + "}"); 102 103 super.writeLaTeX(out); 104 } 105 } 106 | Popular Tags |