-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support biblatex apa citation for legal entry types #8966
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2b73079
support apa citation type of jurisdictions
Ognimalf cc8dc5c
Support apa citation of some formats
Ognimalf 658cbea
Merge remote-tracking branch 'upstream/main' into Ognimalf/main
Siedlerchr a52410c
Move apa and biblatex software to own classes
Siedlerchr 51d5236
Move biblatex software and apa fields to own classes as wel
Siedlerchr 627593d
add type option to check for biblatex special types
Siedlerchr bd37b6c
fix checkstyle and OO test
Siedlerchr 13c0fa8
Merge remote-tracking branch 'upstream/main' into Ognimalf/main
Siedlerchr 2f0f630
checkstyle
Siedlerchr a2662fb
Fix optional fields2
Siedlerchr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💕🎉