MuseSink.java

/*______________________________________________________________________________
 * 
 * Copyright 2006  Arnaud Bailly - 
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * (1) Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 * (2) Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 * (3) The name of the author may not be used to endorse or promote
 *     products derived from this software without specific prior
 *     written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Created on Tue Jul 11 2006
 *
 */
package oqube.muse;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.List;
/**
 * This interface abstracts formatting events for parsing muse files. This
 * interface is modelled after the Sink interface in doxia. This should allow
 * easy wrapping of one by the other.
 * 
 * @author abailly@oqube.muse.com
 * @version $Id$
 */
public interface MuseSink {
  /*
   * Role string for plexus container.
   */
  String ROLE = MuseSink.class.getName();
  void setLineWidth(int lw);
  void startDocument();
  void endDocument();
  void startHeader();
  void endHeader();
  void startBody();
  void endBody();
  void startFooter();
  void endFooter();
  void startPara();
  void text(String txt);
  void rawText(String text);
  void endPara();
  void startList();
  void endList();
  void startItem();
  void endItem();
  void startQuote();
  void endQuote();
  void startCenter();
  void endCenter();
  void startEnums();
  void endEnums();
  void startTitle1();
  void endTitle1();
  void startTitle2();
  void endTitle2();
  void startTitle3();
  void endTitle3();
  void startTitle4();
  void endTitle4();
  void startEmph();
  void endEmph();
  void startStrong();
  void endStrong();
  void startVerb();
  void endVerb();
  void startUline();
  void endUline();
  /**
   * Generic formatting method for arbitrary tags denoting block level elements.
   * This method is called when parser encounter XML-style tags used in muse
   * that should be rendered as block-level elements. For example, in HTML this
   * kind of tag would be rendered by <code><div></code> tags with the tag
   * name as class attribute. <br />
   * 
   * The distinction between *block* and *flow* elements is enforced by the kind
   * of parser they are parsed with.
   * 
   * @param tag
   *          the tag name
   * @param currentArgs an array of arguments to the tag.
   * @param content
   *          raw text inside tag
   */
  void block(String tag, String[][] currentArgs, String content);
  void flow(String tag, String[][] currentArgs, String content);
  void link(String s, String t);
  void anchor(String a);
  void addMetadata(String s, String t);
  void separator();
  void startTable();
  void endTable();
  void startTableHeader();
  void endTableHeader();
  void startTableData();
  void endTableData();
  void startTableRow();
   
  void endTableRow();
  void setOut(PrintWriter pw);
  void setEncoding(String outputEncoding);
  
  void startMath();
  
  void endMath();
  
}