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 S2 extends Section { 38 public S2(Document document, String parentHref) 39 { 40 super(document, parentHref); 41 } 42 43 public S3 createS3() 44 { 45 S3 s3 = new S3(getDocument(), getHref()); 46 addItem(s3); 47 return s3; 48 } 49 50 public void writeHtml(XMLStreamWriter out) 51 throws XMLStreamException 52 { 53 out.writeStartElement("a"); 54 out.writeAttribute("name", getHref()); 55 out.writeEndElement(); 56 57 if (_title != null) { 58 out.writeStartElement("h3"); 59 out.writeCharacters(_title); 60 out.writeEndElement(); 61 } 62 63 for (ContentItem item : getItems()) 64 item.writeHtml(out); 65 } 66 67 public void writeLaTeXTop(PrintWriter out) 68 throws IOException 69 { 70 if (_type != null && _type.equals("defun")) 71 out.println("\\newpage"); 72 73 if (_title != null) 74 out.println("\\subsection{" + LaTeXUtil.escapeForLaTeX(_title) + "}"); 75 76 super.writeLaTeX(out); 77 } 78 79 public void writeLaTeX(PrintWriter out) 80 throws IOException 81 { 82 if (_type != null && _type.equals("defun")) 83 out.println("\\newpage"); 84 85 if (_title != null) 86 out.println("\\subsubsection{" + LaTeXUtil.escapeForLaTeX(_title) + "}"); 87 88 super.writeLaTeX(out); 89 } 90 91 public void writeLaTeXEnclosed(PrintWriter out) 92 throws IOException 93 { 94 if (_type != null && _type.equals("defun")) 95 out.println("\\newpage"); 96 97 if (_title != null) 98 out.println("\\paragraph{" + LaTeXUtil.escapeForLaTeX(_title) + "}"); 99 100 super.writeLaTeX(out); 101 } 102 } 103 | Popular Tags |