-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support biblatex apa citation for legal entry types (#8966)
Co-authored-by: Siedlerchr <[email protected]>
- Loading branch information
1 parent
8389254
commit 02f51f7
Showing
26 changed files
with
369 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/java/org/jabref/model/entry/field/BiblatexApaField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package org.jabref.model.entry.field; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.EnumSet; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
import org.jabref.model.entry.types.BiblatexApaEntryType; | ||
|
||
public enum BiblatexApaField implements Field { | ||
|
||
AMENDMENT("amendment"), | ||
ARTICLE("article"), | ||
CITATION("citation"), | ||
CITATION_CITEORG("citation_citeorg"), | ||
CITATION_CITEDATE("citation_citedate", FieldProperty.DATE), | ||
CITATION_CITEINFO("citation_citeinfo"), | ||
SECTION("section", FieldProperty.NUMERIC), | ||
SOURCE("source"); | ||
|
||
private final String name; | ||
private final String displayName; | ||
private final Set<FieldProperty> properties; | ||
|
||
BiblatexApaField(String name) { | ||
this.name = name; | ||
this.displayName = null; | ||
this.properties = EnumSet.noneOf(FieldProperty.class); | ||
} | ||
|
||
BiblatexApaField(String name, String displayName) { | ||
this.name = name; | ||
this.displayName = displayName; | ||
this.properties = EnumSet.noneOf(FieldProperty.class); | ||
} | ||
|
||
BiblatexApaField(String name, String displayName, FieldProperty first, FieldProperty... rest) { | ||
this.name = name; | ||
this.displayName = displayName; | ||
this.properties = EnumSet.of(first, rest); | ||
} | ||
|
||
BiblatexApaField(String name, FieldProperty first, FieldProperty... rest) { | ||
this.name = name; | ||
this.displayName = null; | ||
this.properties = EnumSet.of(first, rest); | ||
} | ||
|
||
public static <T> Optional<BiblatexApaField> fromName(T type, String name) { | ||
if (!(type instanceof BiblatexApaEntryType)) { | ||
return Optional.empty(); | ||
} | ||
return Arrays.stream(BiblatexApaField.values()) | ||
.filter(field -> field.getName().equalsIgnoreCase(name)) | ||
.findAny(); | ||
} | ||
|
||
@Override | ||
public Set<FieldProperty> getProperties() { | ||
return Collections.unmodifiableSet(properties); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public boolean isStandardField() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
if (displayName == null) { | ||
return Field.super.getDisplayName(); | ||
} else { | ||
return displayName; | ||
} | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
src/main/java/org/jabref/model/entry/field/BiblatexSoftwareField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package org.jabref.model.entry.field; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.EnumSet; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
import org.jabref.model.entry.types.BiblatexSoftwareEntryType; | ||
|
||
public enum BiblatexSoftwareField implements Field { | ||
|
||
HALID("hal_id"), | ||
HALVERSION("hal_version"), | ||
INTRODUCEDIN("introducedin"), | ||
LICENSE("license"), | ||
RELATEDTYPE("relatedtype"), | ||
RELATEDSTRING("relatedstring"), | ||
REPOSITORY("repository"), | ||
SWHID("swhid"); | ||
|
||
private final String name; | ||
private final String displayName; | ||
private final Set<FieldProperty> properties; | ||
|
||
BiblatexSoftwareField(String name) { | ||
this.name = name; | ||
this.displayName = null; | ||
this.properties = EnumSet.noneOf(FieldProperty.class); | ||
} | ||
|
||
BiblatexSoftwareField(String name, String displayName) { | ||
this.name = name; | ||
this.displayName = displayName; | ||
this.properties = EnumSet.noneOf(FieldProperty.class); | ||
} | ||
|
||
BiblatexSoftwareField(String name, String displayName, FieldProperty first, FieldProperty... rest) { | ||
this.name = name; | ||
this.displayName = displayName; | ||
this.properties = EnumSet.of(first, rest); | ||
} | ||
|
||
BiblatexSoftwareField(String name, FieldProperty first, FieldProperty... rest) { | ||
this.name = name; | ||
this.displayName = null; | ||
this.properties = EnumSet.of(first, rest); | ||
} | ||
|
||
public static <T> Optional<BiblatexSoftwareField> fromName(T type, String name) { | ||
if (!(type instanceof BiblatexSoftwareEntryType)) { | ||
return Optional.empty(); | ||
} | ||
return Arrays.stream(BiblatexSoftwareField.values()) | ||
.filter(field -> field.getName().equalsIgnoreCase(name)) | ||
.findAny(); | ||
} | ||
|
||
@Override | ||
public Set<FieldProperty> getProperties() { | ||
return Collections.unmodifiableSet(properties); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public boolean isStandardField() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
if (displayName == null) { | ||
return Field.super.getDisplayName(); | ||
} else { | ||
return displayName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.