View Javadoc

1   /*______________________________________________________________________________
2    * 
3    * Copyright 2006  Arnaud Bailly - 
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    * (1) Redistributions of source code must retain the above copyright
10   *     notice, this list of conditions and the following disclaimer.
11   *
12   * (2) Redistributions in binary form must reproduce the above copyright
13   *     notice, this list of conditions and the following disclaimer in
14   *     the documentation and/or other materials provided with the
15   *     distribution.
16   *
17   * (3) The name of the author may not be used to endorse or promote
18   *     products derived from this software without specific prior
19   *     written permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23   * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24   * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27   *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31   * OF THE POSSIBILITY OF SUCH DAMAGE.
32   *
33   * Created on Tue Jul 11 2006
34   *
35   */
36  package oqube.muse;
37  
38  import java.util.Collection;
39  import java.util.List;
40  
41  /***
42   * This interface abstracts formatting events for parsing muse files. This
43   * interface is modelled after the Sink interface in doxia. This should allow
44   * easy wrapping of one by the other.
45   * 
46   * @author abailly@oqube.muse.com
47   * @version $Id$
48   */
49  public interface MuseSink {
50  
51    /*
52     * Role string for plexus container.
53     */
54    String ROLE = MuseSink.class.getName();
55  
56    void setLineWidth(int lw);
57  
58    void startDocument();
59  
60    void endDocument();
61  
62    void startHeader();
63  
64    void endHeader();
65  
66    void startBody();
67  
68    void endBody();
69  
70    void startFooter();
71  
72    void endFooter();
73  
74    void startPara();
75  
76    void text(String txt);
77  
78    void rawText(String text);
79  
80    void endPara();
81  
82    void startList();
83  
84    void endList();
85  
86    void startItem();
87  
88    void endItem();
89  
90    void startQuote();
91  
92    void endQuote();
93  
94    void startCenter();
95  
96    void endCenter();
97  
98    void startEnums();
99  
100   void endEnums();
101 
102   void startTitle1();
103 
104   void endTitle1();
105 
106   void startTitle2();
107 
108   void endTitle2();
109 
110   void startTitle3();
111 
112   void endTitle3();
113 
114   void startTitle4();
115 
116   void endTitle4();
117 
118   void startEmph();
119 
120   void endEmph();
121 
122   void startStrong();
123 
124   void endStrong();
125 
126   void startVerb();
127 
128   void endVerb();
129 
130   void startUline();
131 
132   void endUline();
133 
134   /***
135    * Generic formatting method for arbitrary tags denoting block level elements.
136    * This method is called when parser encounter XML-style tags used in muse
137    * that should be rendered as block-level elements. For example, in HTML this
138    * kind of tag would be rendered by <code><div></code> tags with the tag
139    * name as class attribute. <br />
140    * 
141    * The distinction between *block* and *flow* elements is enforced by the kind
142    * of parser they are parsed with.
143    * 
144    * @param tag
145    *          the tag name
146    * @param content
147    *          raw text inside tag
148    */
149   void block(String tag, String content);
150 
151   void flow(String tag, String content);
152 
153   void link(String s, String t);
154 
155   void anchor(String a);
156 
157   void addMetadata(String s, String t);
158 
159   void separator();
160 
161   void startTable();
162 
163   void endTable();
164 
165   void startTableHeader();
166 
167   void endTableHeader();
168 
169   void startTableData();
170 
171   void endTableData();
172 
173   void startTableRow();
174    
175   void endTableRow();
176 }