Top Description Fields Constructors Methods
org.jabref.logic.formatter.bibtexfields

public Class NormalizePagesFormatter

extends Formatter
Class Inheritance
Imports
java.util.Objects, java.util.regex.Matcher, .Pattern, org.jabref.logic.cleanup.Formatter, org.jabref.logic.formatter.casechanger.UnprotectTermsFormatter, org.jabref.logic.l10n.Localization

This class includes sensible defaults for consistent formatting of BibTeX page numbers.

Format page numbers, separated either by commas or double-hyphens. Converts the range number format of the pages field to page_number--page_number. Removes unwanted literals except letters, numbers and -+ signs. Keeps the existing String if the resulting field does not match the expected Regex.

From BibTeX manual: One or more page numbers or range of numbers, such as 42--111 or 7,41,73--97 or 43+ (the '+' in this last example indicates pages following that don't form a simple range). To make it easier to maintain Scribe-compatible databases, the standard styles convert a single dash (as in 7-33) to the double dash used in TEX to denote number ranges (as in 7--33).

Examples:

Field Summary

Modifier and TypeField and Description
private static final Pattern
private static final Pattern
private final Formatter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
format(String
the input String
value
)

Implements abstract org.jabref.logic.cleanup.Formatter.format.

Formats a field value by with a particular formatter transformation.

public String
getDescription()

Implements abstract org.jabref.logic.cleanup.Formatter.getDescription.

Returns a description of the formatter.

public String
getExampleInput()

Implements abstract org.jabref.logic.cleanup.Formatter.getExampleInput.

Returns an example input string of the formatter.

public String
getKey()

Implements abstract org.jabref.logic.cleanup.Formatter.getKey.

Returns a unique key for the formatter that can be used for its identification

public String
getName()

Implements abstract org.jabref.logic.cleanup.Formatter.getName.

Returns a human readable name of the formatter usable for e.g. in the GUI

Inherited from org.jabref.logic.cleanup.Formatter:
equalshashCode

Field Detail

DASHES_DETECT_PATTERNback to summary
private static final Pattern DASHES_DETECT_PATTERN
EM_EN_DASH_PATTERNback to summary
private static final Pattern EM_EN_DASH_PATTERN
unprotectTermsFormatterback to summary
private final Formatter unprotectTermsFormatter

Constructor Detail

NormalizePagesFormatterback to summary
public NormalizePagesFormatter()

Method Detail

formatback to summary
public String format(String value)

Implements abstract org.jabref.logic.cleanup.Formatter.format.

Doc from org.jabref.logic.cleanup.Formatter.format.

Formats a field value by with a particular formatter transformation.

Calling this method with a null argument results in a NullPointerException.

Parameters
value:String

the input String

Returns:String

the formatted output String

Annotations
@Override
getDescriptionback to summary
public String getDescription()

Implements abstract org.jabref.logic.cleanup.Formatter.getDescription.

Doc from org.jabref.logic.cleanup.Formatter.getDescription.

Returns a description of the formatter.

Returns:String

the description string, always non empty

Annotations
@Override
getExampleInputback to summary
public String getExampleInput()

Implements abstract org.jabref.logic.cleanup.Formatter.getExampleInput.

Doc from org.jabref.logic.cleanup.Formatter.getExampleInput.

Returns an example input string of the formatter. This example is used as input to the formatter to demonstrate its functionality

Returns:String

the example input string, always non empty

Annotations
@Override
getKeyback to summary
public String getKey()

Implements abstract org.jabref.logic.cleanup.Formatter.getKey.

Doc from org.jabref.logic.cleanup.Formatter.getKey.

Returns a unique key for the formatter that can be used for its identification

Returns:String

the key of the formatter, always not null

Annotations
@Override
getNameback to summary
public String getName()

Implements abstract org.jabref.logic.cleanup.Formatter.getName.

Doc from org.jabref.logic.cleanup.Formatter.getName.

Returns a human readable name of the formatter usable for e.g. in the GUI

Returns:String

the name of the formatter, always not null

Annotations
@Override