Top Description Fields Constructors Methods
org.jabref.logic.layout.format

public Class RTFChars

extends Object
implements LayoutFormatter
Class Inheritance
All Implemented Interfaces
org.jabref.logic.layout.LayoutFormatter
Imports
org.jabref.logic.layout.LayoutFormatter, .StringInt, org.jabref.logic.util.strings.RtfCharMap, org.jabref.model.strings.StringUtil, org.slf4j.Logger, .LoggerFactory

Transform a LaTeX-String to RTF. This method will: 1.) Remove LaTeX-Command sequences. 2.) Replace LaTeX-Special chars with RTF equivalents. 3.) Replace emph and textit and textbf with their RTF replacements. 4.) Take special care to save all unicode characters correctly. 5.) Replace --- by \emdash and -- by \endash.

Field Summary

Modifier and TypeField and Description
private static final Logger
private static final RtfCharMap

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
format(String
The text to layout.
field
)

Implements org.jabref.logic.layout.LayoutFormatter.format.

Failure Mode:

Formatters should be robust in the sense that they always return some relevant string.

private StringInt

Returns:

a tuple of number of added characters and the extracted part
getPart
(String
the text to extract the part from
text
,
int
the position to start
i
,
boolean
true if the command is nested in braces (\emph{xy}), false if spaces are sued (\emph xy)
commandNestedInBraces
)

private String

Returns:

returns the basic character of the given unicode
transformSpecialCharacter
(long
long
c
)

This method transforms the unicode of a special character into its base character: 233 (é) - > e

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
RTF_CHARSback to summary
private static final RtfCharMap RTF_CHARS

Constructor Detail

RTFCharsback to summary
public RTFChars()

Method Detail

formatback to summary
public String format(String field)

Implements org.jabref.logic.layout.LayoutFormatter.format.

Doc from org.jabref.logic.layout.LayoutFormatter.format.

Failure Mode:

Formatters should be robust in the sense that they always return some relevant string.

If the formatter can detect an invalid input it should return the original string otherwise it may simply return a wrong output.

Parameters
field:String

The text to layout.

Returns:String

The layouted text.

Annotations
@Override
getPartback to summary
private StringInt getPart(String text, int i, boolean commandNestedInBraces)
Parameters
text:String

the text to extract the part from

i:int

the position to start

commandNestedInBraces:boolean

true if the command is nested in braces (\emph{xy}), false if spaces are sued (\emph xy)

Returns:StringInt

a tuple of number of added characters and the extracted part

transformSpecialCharacterback to summary
private String transformSpecialCharacter(long c)

This method transforms the unicode of a special character into its base character: 233 (é) - > e

Parameters
c:long

long

Returns:String

returns the basic character of the given unicode