| |
|
| java.lang.Object websphinx.HTMLTransformer websphinx.LinkTransformer websphinx.RewritableLinkTransformer websphinx.Concatenator
Concatenator | public class Concatenator extends RewritableLinkTransformer (Code) | | Transformer that concatenates multiple pages
into a single HTML page.
The entire set of pages is preceded by a "prolog"
and followed by an "epilog", which are constant
strings of HTML. Each page is preceded
by a "header" and followed by a "footer". Adjacent pages
are separated by a "divider".
Concatenator performs the following
transformations on pages before appending them together:
- deletes elements that would conflict, including
<HEADf>, <TITLEf>, <BODYf>, <HTMLf>,
<STYLE>, and <FRAMES>.
- deletes <BASEf> or replaces it with a user-specified
<BASEf>
- changes links among the written pages into
in-page references, of the form "#concatenator_N"
- changes links to other pages into absolute references
|
Constructor Summary | |
public | Concatenator(String filename) Make a new Concatenator that writes to a file. |
needRewrite | boolean needRewrite(Code) | | |
Concatenator | public Concatenator(String filename) throws IOException(Code) | | Make a new Concatenator that writes to a file.
Parameters: filename - Filename to write concatenated pages to exception: IOException - if file cannot be opened |
close | public synchronized void close() throws IOException(Code) | | Close the concatenation. Makes sure all the links
among concatenated pages have been fixed up and closes
the file.
|
getDivider | public String getDivider()(Code) | | Get the divider.
string of HTML that is emitted betweeneach pair of pages. |
getEpilog | public String getEpilog()(Code) | | Get the epilog.
string of HTML that is emitted afterthe entire concatenation. |
getPageCount | public synchronized int getPageCount()(Code) | | Get number of pages written to this mirror.
number of calls to writePage() on this mirror |
getPageFooter | public String getPageFooter()(Code) | | Get the footer.
string of HTML that is emitted aftereach page. |
getPageHeader | public String getPageHeader()(Code) | | Get the header.
string of HTML that is emitted beforeeach page. |
getProlog | public String getProlog()(Code) | | Get the prolog.
string of HTML that is emitted at the beginningof the concatenation. |
handleElement | protected void handleElement(Element elem) throws IOException(Code) | | Process an HTML element for concatenation. Deletes
tags that would
conflict with other pages (such as <HEAD>),
changes the URLs in Link elements, and deletes
or remaps the BASE element.
Parameters: elem - HTML element to process |
rewrite | public synchronized void rewrite() throws IOException(Code) | | Rewrite the concatenation. Makes sure all the links
among concatenated pages have been fixed up.
|
setDivider | public synchronized void setDivider(String divider)(Code) | | Set the divider.
Parameters: divider - string of HTML that is emitted betweeneach pair of pages. |
setEpilog | public synchronized void setEpilog(String epilog)(Code) | | Set the epilog.
Parameters: epilog - string of HTML that is emitted afterthe entire concatenation. |
setPageFooter | public synchronized void setPageFooter(String footer)(Code) | | Set the footer. The footer can contain the same
macros as the header (%t, %u, %a, %p); see setPageHeader
for more details.
Parameters: footer - string of HTML that is emitted aftereach page. |
setPageHeader | public synchronized void setPageHeader(String header)(Code) | | Set the header. The header can contain macro codes which
are replaced with attributes of the page about to be written:
- %t
- title of the page
- %u
- URL of page
- %a
- anchor name of the page ("pageN", where N is the page number)
- %p
- page number (starting from 1)
Parameters: header - string of HTML that is emitted beforeeach page. The default value is:
<TABLE WIDTH="100%"><TR>\n <TD ALIGN=left><A NAME="%a">%t [%u]</A>\n <TD ALIGN=right>Page %p</TABLE>\n |
setProlog | public synchronized void setProlog(String prolog)(Code) | | Set the prolog.
Parameters: prolog - string of HTML that is emitted at the beginningof the concatenation. Default value is:
<HTML><HEAD><TITLE>Concatenation</TITLE></HEAD><BODY>\n |
writePage | public synchronized void writePage(Page page) throws IOException(Code) | | Write a page to the concatenation.
Parameters: page - Page to write |
|
|
|