Skip to content

Commit

Permalink
Merge branch 'main' into chat-with-groups
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor authored Sep 3, 2024
2 parents a1dee14 + 419d2a7 commit 70519dd
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where the entry preview highlight was not working when searching before opening the entry editor. [#11659](https://github.com/JabRef/jabref/pull/11659)
- We fixed an issue where text in Dark mode inside "Citation information" was not readable. [#11512](https://github.com/JabRef/jabref/issues/11512)
- We fixed an issue where the selection of an entry in the table lost after searching for a group. [#3176](https://github.com/JabRef/jabref/issues/3176)
- We fixed the non-functionality of the option "Automatically sync bibliography when inserting citations" in the OpenOffice panel, when enabled in case of JStyles. [#11684](https://github.com/JabRef/jabref/issues/11684)

### Removed

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ dependencies {
implementation "org.apache.lucene:lucene-highlighter:$luceneVersion"

implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.11.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.16.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.12.0'
implementation 'commons-logging:commons-logging:1.3.3'
implementation 'commons-logging:commons-logging:1.3.4'
implementation 'com.h2database:h2-mvstore:2.3.232'

// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635
implementation 'org.bouncycastle:bcprov-jdk18on:1.78.1'

implementation 'commons-cli:commons-cli:1.8.0'
implementation 'commons-cli:commons-cli:1.9.0'

// region: LibreOffice
implementation 'org.libreoffice:unoloader:24.2.3'
Expand Down Expand Up @@ -340,15 +340,15 @@ dependencies {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
// GemxFX also (transitively) depends on kotlin
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.10'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20'

implementation 'commons-io:commons-io:2.16.1'

testImplementation 'io.github.classgraph:classgraph:4.8.175'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.3'

testImplementation 'org.mockito:mockito-core:5.12.0'
testImplementation 'org.mockito:mockito-core:5.13.0'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
testImplementation 'org.xmlunit:xmlunit-matchers:2.10.0'
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
nav_order: 31
parent: Decision Records
---
# Use currently active Style tab in Select Style Dialog to decide which style to activate
# Use currently active tab in Select style (OO Panel) to decide style type

## Context and Problem Statement

Expand Down
24 changes: 6 additions & 18 deletions src/main/java/org/jabref/gui/openoffice/OOBibBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ public class OOBibBase {

private final DialogService dialogService;

// After inserting a citation, if ooPrefs.getSyncWhenCiting() returns true, shall we also update the bibliography?
private final boolean refreshBibliographyDuringSyncWhenCiting;

// Shall we add "Cited on pages: ..." to resolved bibliography entries?
private final boolean alwaysAddCitedOnPages;
private final boolean alwaysAddCitedOnPages; // TODO (see comment above)

private final OOBibBaseConnect connection;

Expand All @@ -86,7 +83,6 @@ public OOBibBase(Path loPath, DialogService dialogService)
this.dialogService = dialogService;
this.connection = new OOBibBaseConnect(loPath, dialogService);

this.refreshBibliographyDuringSyncWhenCiting = false;
this.alwaysAddCitedOnPages = false;
}

Expand Down Expand Up @@ -576,27 +572,19 @@ public void guiActionInsertEntry(List<BibEntry> entries,
}

/*
* For sync we need a FunctionalTextViewCursor.
* For sync we need a FunctionalTextViewCursor and an open database.
*/
OOResult<FunctionalTextViewCursor, OOError> fcursor = null;
if (syncOptions.isPresent()) {
fcursor = getFunctionalTextViewCursor(doc, errorTitle);
if (testDialog(errorTitle, fcursor.asVoidResult())) {
return;
}
}

syncOptions
.map(e -> e.setUpdateBibliography(this.refreshBibliographyDuringSyncWhenCiting))
.map(e -> e.setAlwaysAddCitedOnPages(this.alwaysAddCitedOnPages));

if (syncOptions.isPresent()) {
if (testDialog(databaseIsRequired(syncOptions.get().databases,
if (testDialog(errorTitle, fcursor.asVoidResult()) || testDialog(databaseIsRequired(syncOptions.get().databases,
OOError::noDataBaseIsOpenForSyncingAfterCitation))) {
return;
}
}

syncOptions.map(e -> e.setAlwaysAddCitedOnPages(this.alwaysAddCitedOnPages)); // TODO: Provide option to user: this is always false

try {

UnoUndo.enterUndoContext(doc, "Insert citation");
Expand Down Expand Up @@ -873,7 +861,7 @@ public void guiActionUpdateDocument(List<BibDatabase> databases, OOStyle style)
Update.SyncOptions syncOptions = new Update.SyncOptions(databases);
syncOptions
.setUpdateBibliography(true)
.setAlwaysAddCitedOnPages(this.alwaysAddCitedOnPages);
.setAlwaysAddCitedOnPages(this.alwaysAddCitedOnPages); // TODO: Provide option to user: this is always false

unresolvedKeys = Update.synchronizeDocument(doc, frontend, jStyle, fcursor.get(), syncOptions);
} finally {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ private void pushEntries(CitationType citationType, boolean addPageInfo) {
? Optional.of(new Update.SyncOptions(getBaseList()))
: Optional.empty();

// Sync options are non-null only when "Automatically sync bibliography when inserting citations" is enabled
if (syncOptions.isPresent() && preferencesService.getOpenOfficePreferences().getSyncWhenCiting()) {
syncOptions.get().setUpdateBibliography(true);
}
ooBase.guiActionInsertEntry(entries,
bibDatabaseContext,
entryTypesManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void insertBibliography(XTextCursor cursor, CitationStyle selectedStyle,

OOText title = OOFormat.paragraph(OOText.fromString(CSLFormatUtils.DEFAULT_BIBLIOGRAPHY_TITLE), CSLFormatUtils.DEFAULT_BIBLIOGRAPHY_HEADER_PARAGRAPH_FORMAT);
OOTextIntoOO.write(document, cursor, OOText.fromString(title.toString()));
OOText ooBreak = OOFormat.paragraph(OOText.fromString(""), "Body Text");
OOText ooBreak = OOFormat.paragraph(OOText.fromString(""), CSLFormatUtils.DEFAULT_BIBLIOGRAPHY_BODY_PARAGRAPH_FORMAT);
OOTextIntoOO.write(document, cursor, ooBreak);

String style = selectedStyle.getSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class CSLFormatUtils {
public static final String DEFAULT_BIBLIOGRAPHY_TITLE = "References";
public static final String DEFAULT_BIBLIOGRAPHY_HEADER_PARAGRAPH_FORMAT = "Heading 2";

public static final String DEFAULT_BIBLIOGRAPHY_BODY_PARAGRAPH_FORMAT = "Body Text";

public static final CitationStyleOutputFormat OUTPUT_FORMAT = CitationStyleOutputFormat.HTML;
private static final Pattern YEAR_IN_CITATION_PATTERN = Pattern.compile("(.)(.*), (\\d{4}.*)");

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/csl-locales

0 comments on commit 70519dd

Please sign in to comment.