name.format$ method and provides ultimate flexibility.
The formatter needs a parameter with the following format:
<case1>@<range11>@"<format>"@<range12>@"<format>"@<range13>...@@
<case2>@<range21>@...
Individual cases are separated by @@ and items in a case by @.
Cases are just integers or the character * and tell the formatter to apply the following formats
if there are less or equal authors given.
The cases must be in strictly increasing order with * in the last position.
Example:
case1 = 2
case2 = 3
case3 = *
Ranges are either <integer>..<integer>, <integer> or * (using a 1-based index).
Negative integers start from the end (-1 = last author).
Example with Joe Doe and Mary Jane and Bruce Bar and Arthur Kay:
1..3 → Joe, Mary, Bruce
4..4 → Arthur
* → all authors
2..-1 → Mary, Bruce, Arthur
The <format> uses the BibTeX formatter syntax:
v, f, l, j indicate name parts (von, first, last, jr). Use them inside {} for full form.
v, f, l, j) abbreviates the part.
\" (not fully supported yet).
Example:
"{ll},{f}." → "Joe Doe" becomes "Doe, J."
Complete example:
Input:
Joe Doe and Mary Jane and Bruce Bar and Arthur Kay
Output:
Doe, J., Jane, M., Bar, B. and Kay, A.
Formatter parameter:
1@*@{ll},{f}.@@2@1@{ll},{f}.@2@ and {ll},{f}.@@*@1..-3@{ll},{f}., @-2@{ll},{f}.@-1@ and {ll},{f}.
This is troublesome to write, but it works. For more examples see the test cases.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static String | |
| public String | |
| public String | format(String fieldText)
Implements org. Failure Mode: Formatters should be robust in the sense that they always return some relevant string. |
| public static Map | |
| public void |
| DEFAULT_FORMAT | back to summary |
|---|---|
| public static final String DEFAULT_FORMAT | |
| parameter | back to summary |
|---|---|
| private String parameter | |
| NameFormatter | back to summary |
|---|---|
| public NameFormatter() | |
| format | back to summary |
|---|---|
| private static String format(String toFormat, AuthorList al, String[] formats) | |
| format | back to summary |
|---|---|
| public String format(String toFormat, String inParameters) | |
| format | back to summary |
|---|---|
| public String format(String fieldText) Implements org. Doc from org. 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.
| |
| getNameFormatters | back to summary |
|---|---|
| public static Map | |
| setParameter | back to summary |
|---|---|
| public void setParameter(String parameter) | |