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 Defun extends Section { 38 public Defun(Document document) 39 { 40 super(document); 41 } 42 43 public S2 createS2() 44 { 45 S2 s2 = new S2(getDocument(), getHref()); 46 addItem(s2); 47 return s2; 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 out.writeStartElement("div"); 58 out.writeAttribute("class", "section-title"); 59 out.writeCharacters(_title); 60 out.writeEndElement(); 61 79 80 out.writeStartElement("div"); 81 out.writeAttribute("class", "desc"); 82 83 super.writeHtml(out); 84 85 out.writeEndElement(); } 87 88 public void writeLaTeXTop(PrintWriter out) 89 throws IOException 90 { 91 out.println("\\subsection{" + LaTeXUtil.escapeForLaTeX(_title) + "}"); 92 93 super.writeLaTeX(out); 94 } 95 96 public void writeLaTeX(PrintWriter out) 97 throws IOException 98 { 99 out.println("\\subsection{" + LaTeXUtil.escapeForLaTeX(_title) + "}"); 100 101 super.writeLaTeX(out); 102 } 103 104 public void writeLaTeXEnclosed(PrintWriter out) 105 throws IOException 106 { 107 if (_type != null && _type.equals("defun")) 108 out.println("\\newpage"); 109 110 if (_title != null) 111 out.println("\\subsubsection{" + LaTeXUtil.escapeForLaTeX(_title) + "}"); 112 113 super.writeLaTeX(out); 114 } 115 } 116 | Popular Tags |