View Javadoc

1   package org.apache.maven.doxia.module.confluence.parser;
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.sink.Sink;
23  
24  /**
25   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
26   * @version $Id: SectionBlock.java 772533 2009-05-07 07:35:06Z ltheussl $
27   */
28  class SectionBlock
29      implements Block
30  {
31      private Block text;
32  
33      private int level;
34  
35      SectionBlock( Block text, int level )
36      {
37          this.text = text;
38          this.level = level;
39      }
40  
41      /** {@inheritDoc} */
42      public void traverse( Sink sink )
43      {
44          if ( level == Sink.SECTION_LEVEL_1 )
45          {
46              sink.section1();
47              sink.sectionTitle1();
48          }
49          else if ( level == Sink.SECTION_LEVEL_2 )
50          {
51              sink.section2();
52              sink.sectionTitle2();
53          }
54          else if ( level == Sink.SECTION_LEVEL_3 )
55          {
56              sink.section3();
57              sink.sectionTitle3();
58          }
59          else if ( level == Sink.SECTION_LEVEL_4 )
60          {
61              sink.section4();
62              sink.sectionTitle4();
63          }
64          else if ( level == Sink.SECTION_LEVEL_5 )
65          {
66              sink.section5();
67              sink.sectionTitle5();
68          }
69  
70          this.text.traverse( sink );
71  
72          if ( level == Sink.SECTION_LEVEL_1 )
73          {
74              sink.sectionTitle1_();
75              sink.section1_();
76          }
77          else if ( level == Sink.SECTION_LEVEL_2 )
78          {
79              sink.sectionTitle2_();
80              sink.section2_();
81          }
82          else if ( level == Sink.SECTION_LEVEL_3 )
83          {
84              sink.sectionTitle3_();
85              sink.section3_();
86  
87          }
88          else if ( level == Sink.SECTION_LEVEL_4 )
89          {
90              sink.sectionTitle4_();
91              sink.section4_();
92          }
93          else if ( level == Sink.SECTION_LEVEL_5 )
94          {
95              sink.sectionTitle5_();
96              sink.section5_();
97          }
98      }
99  }