/************************************************************************** /* Render a document with HTML-ol-tags. The document must follow /* the StandardDocument standard. /* /* Copyright (c) 2003-2004 by Bernhard Bablok (mail@bablokb.de) /* /* This library is free software; you can redistribute it and/or modify /* it under the terms of the GNU Lesser General Public License as published /* by the Free Software Foundation; either version 2 of the License or /* (at your option) any later version. /* /* This library is distributed in the hope that it will be useful, but /* WITHOUT ANY WARRANTY; without even the implied warranty of /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /* GNU Lesser General Public License for more details. /* /* You should have received a copy of the GNU Lesser General Public License /* along with this library; see the file COPYING.LESSER. If not, write to /* the Free Software Foundation Inc., 59 Temple Place - Suite 330, /* Boston, MA 02111-1307 USA /**************************************************************************/ package de.bablokb.luala.lib; import java.io.*; import org.apache.lucene.document.*; /** Render a document with HTML-ol-tags. The document must follow the StandardDocument standard. @see StandardDocumentFactory @version $Revision: 1.7 $ @author $Author: bablokb $ */ public class StandardDocumentHtmlRenderer extends StandardDocumentRenderer { //////////////////////////////////////////////////////////////////////////// /** Constructor. This just sets the header and footer fields of the base class. */ public StandardDocumentHtmlRenderer() { setHeader("
  • "); setFooter("
  • \n"); } //////////////////////////////////////////////////////////////////////////// /** {@inheritDoc} */ public String renderPath(Document doc) throws IOException, IllegalStateException { String path = super.renderPath(doc); StringBuffer buffer = new StringBuffer(""); buffer.append(path); buffer.append(""); return buffer.toString(); } //////////////////////////////////////////////////////////////////////////// /** This method will render the Summary-field of the document. Implements {@link StandardDocumentRenderer#renderSummary}.

    TODO: remove html-tags from summary @throws IOException @throws IllegalStateException if document contains no SUMMARY-field */ public String renderSummary(Document doc) throws IOException, IllegalStateException { String summary = doc.get(DocumentFactory.SUMMARY); if (summary == null) throw new IllegalStateException("error: missing " + DocumentFactory.SUMMARY + "-field in document!"); StringBuffer buffer = new StringBuffer(); buffer.append("
    "); buffer.append(summary); buffer.append("
    "); return buffer.toString(); } }