Package uk.ac.starlink.ttools
Class Formatter
java.lang.Object
uk.ac.starlink.ttools.Formatter
Assists in formatting text for output on the terminal.
- Since:
- 31 Aug 2005
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an internal entity declaration to this formatter.static String
formatWords
(List<String> wordList, int indent) Utility method for writing a number of unbreakable words on the terminal.Returns a string which is a formatted version of an XML string.Returns the text used to refer in formatted output to the STILTS manual.void
setManualName
(String name) Sets the text used to refer in formatted output to the STILTS manual.
-
Constructor Details
-
Formatter
public Formatter()Constructor.
-
-
Method Details
-
formatXML
Returns a string which is a formatted version of an XML string. The result is suitable for output on the terminal. A few elements, such as p, code, ul, ref etc may be treated specially.- Parameters:
xml
- XML textindent
- number of spaces to indent every line- Throws:
SAXException
-
setManualName
Sets the text used to refer in formatted output to the STILTS manual.- Parameters:
name
- manual reference name
-
getManualName
Returns the text used to refer in formatted output to the STILTS manual.- Returns:
- manual reference name
-
addEntity
Adds an internal entity declaration to this formatter. Any entities added here are declared in the document declaration of XML parsed by theformatXML
method.- Parameters:
entName
- internal entity nameentValue
- entity value
-
formatWords
Utility method for writing a number of unbreakable words on the terminal. Line breaks are introduced where required to avoid overrunning screen lines (currently, 80 characters). The first line is indented the given number of spaces, subsequent lines start aligned with the end of the first word:aaaa bbb cccc d eee ... xxxxxx yy
- Parameters:
wordList
- list of wordsindent
- number of spaces to indent lines- Returns:
- formatted string
-