Coverage Report - org.apache.maven.doxia.book.services.renderer.latex.LatexBookSink
 
Classes in this File Line Coverage Branch Coverage Complexity
LatexBookSink
86%
13/15
N/A
1
 
 1  
 package org.apache.maven.doxia.book.services.renderer.latex;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.doxia.module.latex.LatexSink;
 23  
 
 24  
 import java.io.Writer;
 25  
 
 26  
 /**
 27  
  * <p>LatexBookSink class.</p>
 28  
  *
 29  
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
 30  
  * @version $Id: LatexBookSink.java 769433 2009-04-28 15:26:55Z ltheussl $
 31  
  */
 32  
 public class LatexBookSink
 33  
     extends LatexSink
 34  
 {
 35  
     /** text. */
 36  
     private String txt;
 37  
 
 38  
     /** title. */
 39  
     private String title;
 40  
 
 41  
     // ----------------------------------------------------------------------
 42  
     //
 43  
     // ----------------------------------------------------------------------
 44  
 
 45  
     /**
 46  
      * Construct a new LatexBookSink which is a LatexSink with the given writer,
 47  
      * null sinkCommands, null preamble and fragmentDocument = true.
 48  
      *
 49  
      * @param out the writer for the sink.
 50  
      */
 51  
     public LatexBookSink( Writer out )
 52  
     {
 53  10
         super( out, null, null, true );
 54  10
     }
 55  
 
 56  
     // ----------------------------------------------------------------------
 57  
     //
 58  
     // ----------------------------------------------------------------------
 59  
 
 60  
     /** {@inheritDoc} */
 61  
     protected String getDocumentStart()
 62  
     {
 63  0
         return "";
 64  
 //        return "\\documentclass{book}";
 65  
     }
 66  
 
 67  
     /** {@inheritDoc} */
 68  
     protected String getDocumentBegin()
 69  
     {
 70  0
         return null;
 71  
     }
 72  
 
 73  
     // ----------------------------------------------------------------------
 74  
     //
 75  
     // ----------------------------------------------------------------------
 76  
 
 77  
     /** {@inheritDoc} */
 78  
     public void text( String text )
 79  
     {
 80  52
         this.txt = text;
 81  
 
 82  52
         super.text( text );
 83  52
     }
 84  
 
 85  
     /** {@inheritDoc} */
 86  
     public void title_()
 87  
     {
 88  8
         super.title_();
 89  
 
 90  8
         this.title = txt;
 91  8
     }
 92  
 
 93  
     // ----------------------------------------------------------------------
 94  
     //
 95  
     // ----------------------------------------------------------------------
 96  
 
 97  
     /**
 98  
      * Return the title.
 99  
      *
 100  
      * @return String.
 101  
      */
 102  
     public String getTitle()
 103  
     {
 104  8
         return title;
 105  
     }
 106  
 
 107  
     // ----------------------------------------------------------------------
 108  
     //
 109  
     // ----------------------------------------------------------------------
 110  
 
 111  
     /**
 112  
      * Writes the default LaTeX commands and preamble in the main book file.
 113  
      *
 114  
      * @since 1.1
 115  
      */
 116  
     public void defaultBookPreamble()
 117  
     {
 118  2
         markup( defaultSinkCommands() );
 119  2
         markup( defaultPreamble() );
 120  2
         flush();
 121  2
     }
 122  
 
 123  
 
 124  
 }