Module com.github.rvesse.airline.io
Class TroffPrinter
- java.lang.Object
-
- com.github.rvesse.airline.io.printers.TroffPrinter
-
public class TroffPrinter extends java.lang.Object
Printer class for generating Troff output
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TroffPrinter.BulletStyle
Supported bullet styleprivate static class
TroffPrinter.ListType
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
BULLET_STYLE_BULLET
private static java.lang.String
BULLET_STYLE_DASH
private static java.lang.String
BULLET_STYLE_EM_DASH
private static int
DEFAULT_INDENTATION
private int
indentation
private boolean
inSection
private int
level
private java.lang.String
listGlyph
private java.util.Stack<TroffPrinter.ListType>
lists
private boolean
newline
private static java.lang.String
REQUEST_BREAK
private static java.lang.String
REQUEST_FONT_BOLD
private static java.lang.String
REQUEST_FONT_BOLD_ITALIC
private static java.lang.String
REQUEST_FONT_ITALIC
private static java.lang.String
REQUEST_FONT_ROMAN
private static java.lang.String
REQUEST_MOVE_LEFT_MARGIN
private static java.lang.String
REQUEST_PARAGRAPH_CURRENT_INDENTATION
private static java.lang.String
REQUEST_PARAGRAPH_NO_INDENTATION
private static java.lang.String
REQUEST_PARAGRAPH_TITLED
private static java.lang.String
REQUEST_RESET_LEFT_MARGIN
private static java.lang.String
REQUEST_TABLE_END
private static java.lang.String
REQUEST_TABLE_START
private java.io.PrintWriter
writer
-
Constructor Summary
Constructors Constructor Description TroffPrinter(java.io.PrintWriter writer)
TroffPrinter(java.io.PrintWriter writer, int indentation, TroffPrinter.BulletStyle style)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
appendLine(java.lang.String line)
private java.lang.String
asArg(java.lang.String arg)
void
endList()
private java.lang.String
escape(java.lang.String line)
private java.lang.String
escapeArg(java.lang.String arg)
void
finish()
void
flush()
void
lineBreak()
void
nextBulletedListItem()
void
nextNumberedListItem()
void
nextPlainListItem()
void
nextSection(java.lang.String sectionTitle)
void
nextTitledListItem()
Moves to the next titled list item without providing a title.void
nextTitledListItem(java.lang.String title)
protected void
notInList()
private void
prepareLine()
void
print(java.lang.String value)
void
printBold(java.lang.String value)
void
printBoldItalic(java.lang.String value)
protected void
printBullet()
void
printItalic(java.lang.String value)
void
println()
void
println(java.lang.String value)
protected void
printNumberedBullet(boolean first)
protected void
printPlainBullet()
void
printTable(java.util.List<java.util.List<java.lang.String>> rows, boolean hasHeader)
protected void
printTitledBullet()
void
start(java.lang.String title, int manSection)
void
start(java.lang.String title, int manSection, java.lang.String header, java.lang.String footer, java.lang.String footerExtra)
void
startBulletedList()
void
startNumberedList()
void
startPlainList()
void
startTitledList()
Starts a titled list, the next line of text printed will form the titlevoid
startTitledList(java.lang.String title)
Starts a titled list with the given title
-
-
-
Field Detail
-
REQUEST_TABLE_END
private static final java.lang.String REQUEST_TABLE_END
- See Also:
- Constant Field Values
-
REQUEST_TABLE_START
private static final java.lang.String REQUEST_TABLE_START
- See Also:
- Constant Field Values
-
REQUEST_FONT_ROMAN
private static final java.lang.String REQUEST_FONT_ROMAN
- See Also:
- Constant Field Values
-
REQUEST_FONT_BOLD
private static final java.lang.String REQUEST_FONT_BOLD
- See Also:
- Constant Field Values
-
REQUEST_FONT_ITALIC
private static final java.lang.String REQUEST_FONT_ITALIC
- See Also:
- Constant Field Values
-
REQUEST_FONT_BOLD_ITALIC
private static final java.lang.String REQUEST_FONT_BOLD_ITALIC
- See Also:
- Constant Field Values
-
REQUEST_PARAGRAPH_TITLED
private static final java.lang.String REQUEST_PARAGRAPH_TITLED
- See Also:
- Constant Field Values
-
REQUEST_PARAGRAPH_CURRENT_INDENTATION
private static final java.lang.String REQUEST_PARAGRAPH_CURRENT_INDENTATION
- See Also:
- Constant Field Values
-
REQUEST_PARAGRAPH_NO_INDENTATION
private static final java.lang.String REQUEST_PARAGRAPH_NO_INDENTATION
- See Also:
- Constant Field Values
-
REQUEST_RESET_LEFT_MARGIN
private static final java.lang.String REQUEST_RESET_LEFT_MARGIN
- See Also:
- Constant Field Values
-
REQUEST_MOVE_LEFT_MARGIN
private static final java.lang.String REQUEST_MOVE_LEFT_MARGIN
- See Also:
- Constant Field Values
-
REQUEST_BREAK
private static final java.lang.String REQUEST_BREAK
- See Also:
- Constant Field Values
-
BULLET_STYLE_BULLET
private static final java.lang.String BULLET_STYLE_BULLET
- See Also:
- Constant Field Values
-
BULLET_STYLE_DASH
private static final java.lang.String BULLET_STYLE_DASH
- See Also:
- Constant Field Values
-
BULLET_STYLE_EM_DASH
private static final java.lang.String BULLET_STYLE_EM_DASH
- See Also:
- Constant Field Values
-
DEFAULT_INDENTATION
private static final int DEFAULT_INDENTATION
- See Also:
- Constant Field Values
-
writer
private final java.io.PrintWriter writer
-
level
private int level
-
newline
private boolean newline
-
inSection
private boolean inSection
-
indentation
private final int indentation
- See Also:
- Constant Field Values
-
lists
private java.util.Stack<TroffPrinter.ListType> lists
-
listGlyph
private final java.lang.String listGlyph
-
-
Constructor Detail
-
TroffPrinter
public TroffPrinter(java.io.PrintWriter writer)
-
TroffPrinter
public TroffPrinter(java.io.PrintWriter writer, int indentation, TroffPrinter.BulletStyle style)
-
-
Method Detail
-
start
public void start(java.lang.String title, int manSection)
-
start
public void start(java.lang.String title, int manSection, java.lang.String header, java.lang.String footer, java.lang.String footerExtra)
-
nextSection
public void nextSection(java.lang.String sectionTitle)
-
print
public void print(java.lang.String value)
-
println
public void println(java.lang.String value)
-
println
public void println()
-
lineBreak
public void lineBreak()
-
printBold
public void printBold(java.lang.String value)
-
printItalic
public void printItalic(java.lang.String value)
-
printBoldItalic
public void printBoldItalic(java.lang.String value)
-
appendLine
private void appendLine(java.lang.String line)
-
startBulletedList
public void startBulletedList()
-
startPlainList
public void startPlainList()
-
startNumberedList
public void startNumberedList()
-
startTitledList
public void startTitledList()
Starts a titled list, the next line of text printed will form the title
-
startTitledList
public void startTitledList(java.lang.String title)
Starts a titled list with the given title- Parameters:
title
-
-
nextBulletedListItem
public void nextBulletedListItem()
-
nextPlainListItem
public void nextPlainListItem()
-
notInList
protected void notInList()
-
nextNumberedListItem
public void nextNumberedListItem()
-
nextTitledListItem
public void nextTitledListItem()
Moves to the next titled list item without providing a title. The next line of text written will therefore be treated as the title for this item.
-
nextTitledListItem
public void nextTitledListItem(java.lang.String title)
-
endList
public void endList()
-
printTable
public void printTable(java.util.List<java.util.List<java.lang.String>> rows, boolean hasHeader)
-
prepareLine
private void prepareLine()
-
printBullet
protected void printBullet()
-
printTitledBullet
protected void printTitledBullet()
-
printPlainBullet
protected void printPlainBullet()
-
printNumberedBullet
protected void printNumberedBullet(boolean first)
-
asArg
private java.lang.String asArg(java.lang.String arg)
-
escapeArg
private java.lang.String escapeArg(java.lang.String arg)
-
escape
private java.lang.String escape(java.lang.String line)
-
flush
public void flush()
-
finish
public void finish()
-
-