| Modifier and Type | Field and Description |
|---|---|
| public static final String | APPENDIX_CHARACTERS
All single characters that we can use for extending a key to make it unique. |
| private final CitationKeyPatternPreferences | |
| private final AbstractCitationKeyPatterns | |
| private final BibDatabase | |
| public static final List | DISALLOWED_CHARACTERS
Source of disallowed characters: https://tex.stackexchange.com/a/408548/9075 These characters are disallowed in BibTeX keys. |
| private final Character | |
| private static final Logger | |
| private final String |
| Access | Constructor and Description |
|---|---|
| public | CitationKeyGenerator(BibDatabaseContext bibDatabaseContext, CitationKeyPatternPreferences citationKeyPatternPreferences)
|
| public | CitationKeyGenerator(@NonNull AbstractCitationKeyPatterns citeKeyPattern, @NonNull BibDatabase database, @NonNull CitationKeyPatternPreferences citationKeyPatternPreferences)
|
| private | CitationKeyGenerator(AbstractCitationKeyPatterns citeKeyPattern, BibDatabase database, CitationKeyPatternPreferences citationKeyPatternPreferences, Character keywordSeparator)
|
| Modifier and Type | Method and Description |
|---|---|
| private String | Returns: a key, if needed, with an appended letterthe new key key, String the old key oldKey)A letter will be appended to the key based on the user's preferences, either always or to prevent duplicated keys. |
| public static String | |
| private String | |
| private Function | Returns: a cleaned citation key for the givenBibEntrythe entry)BibEntry that a citation key is generated forA helper method to create a |
| public Optional | Returns: the change to the key (or an empty optional if the key was not changed)the entry to generate the key for entry)Generates a citation key for the given entry, and sets the key. |
| public String | Returns: a citation key based on the user's preferencesa entry)BibEntryGenerate a citation key for the given |
| private static String | Returns: The String to append.The appendix number. number)Computes an appendix to a citation key that could make it unique. |
| private static int | normalizeSuperscriptOrSubscript(int codePoint)
Maps Unicode superscript and subscript digits to their ASCII counterparts (e.g., ¹ → 1, ₂ → 2). |
| pack-priv static String | |
| public static String | Returns: the key with illegal and unwanted characters removedthe citation key to sanitize key, String unwantedCharacters)Removes characters, unwanted characters that are illegal in citation keys preserving Unicode (e.g., ²) and diacritical characters. |
| private String | Returns: the citation key where matches to the regex are replacedthe citation key key)Using preferences, replace matches to the provided regex with a string. |
| public String |
| APPENDIX_CHARACTERS | back to summary |
|---|---|
| public static final String APPENDIX_CHARACTERS All single characters that we can use for extending a key to make it unique. | |
| citationKeyPatternPreferences | back to summary |
|---|---|
| private final CitationKeyPatternPreferences citationKeyPatternPreferences | |
| citeKeyPattern | back to summary |
|---|---|
| private final AbstractCitationKeyPatterns citeKeyPattern | |
| database | back to summary |
|---|---|
| private final BibDatabase database | |
| DISALLOWED_CHARACTERS | back to summary |
|---|---|
| public static final List<Character> DISALLOWED_CHARACTERS Source of disallowed characters: https://tex.stackexchange.com/a/408548/9075 These characters are disallowed in BibTeX keys. | |
| keywordSeparator | back to summary |
|---|---|
| private final Character keywordSeparator | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER Hides org. | |
| unwantedCharacters | back to summary |
|---|---|
| private final String unwantedCharacters | |
| CitationKeyGenerator | back to summary |
|---|---|
| public CitationKeyGenerator(BibDatabaseContext bibDatabaseContext, CitationKeyPatternPreferences citationKeyPatternPreferences) | |
| CitationKeyGenerator | back to summary |
|---|---|
| public CitationKeyGenerator(@NonNull AbstractCitationKeyPatterns citeKeyPattern, @NonNull BibDatabase database, @NonNull CitationKeyPatternPreferences citationKeyPatternPreferences) | |
| CitationKeyGenerator | back to summary |
|---|---|
| private CitationKeyGenerator(AbstractCitationKeyPatterns citeKeyPattern, BibDatabase database, CitationKeyPatternPreferences citationKeyPatternPreferences, Character keywordSeparator) | |
| appendLettersToKey | back to summary |
|---|---|
| private String appendLettersToKey(String key, String oldKey) A letter will be appended to the key based on the user's preferences, either always or to prevent duplicated keys. | |
| cleanKey | back to summary |
|---|---|
| public static String cleanKey(String key, String unwantedCharacters) | |
| createCitationKeyFromPattern | back to summary |
|---|---|
| private String createCitationKeyFromPattern(BibEntry entry) | |
| expandBracketContent | back to summary |
|---|---|
| private Function A helper method to create a | |
| generateAndSetKey | back to summary |
|---|---|
| public Optional Generates a citation key for the given entry, and sets the key.
| |
| generateKey | back to summary |
|---|---|
| public String generateKey(@NonNull BibEntry entry) Generate a citation key for the given | |
| getAppendix | back to summary |
|---|---|
| private static String getAppendix(int number) Computes an appendix to a citation key that could make it unique. We use a-z for numbers 0-25, and then aa-az, ba-bz, etc.
| |
| normalizeSuperscriptOrSubscript | back to summary |
|---|---|
| private static int normalizeSuperscriptOrSubscript(int codePoint) Maps Unicode superscript and subscript digits to their ASCII counterparts (e.g., ¹ → 1, ₂ → 2). Other characters in the Superscripts and Subscripts block (e.g., ⁿ ⁱ ⁺ ⁻ ⁽ ⁾) are stripped by returning -1. All other code points are returned unchanged. | |
| removeUnwantedCharacters | back to summary |
|---|---|
pack-priv static String removeUnwantedCharacters(String key, String unwantedCharacters)
| |
| removeUnwantedCharactersWithKeepDiacritics | back to summary |
|---|---|
| public static String removeUnwantedCharactersWithKeepDiacritics(String key, String unwantedCharacters) Removes characters, unwanted characters that are illegal in citation keys preserving Unicode (e.g., ²) and diacritical characters.
| |
| replaceWithRegex | back to summary |
|---|---|
| private String replaceWithRegex(String key) Using preferences, replace matches to the provided regex with a string. | |
| transliterateIfNeeded | back to summary |
|---|---|
| public String transliterateIfNeeded(String key) | |