Skip to content

Commit

Permalink
Merge branch 'main' into faq-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
subhramit authored Sep 16, 2024
2 parents 02d0f6f + fb9cdef commit 960361a
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- name: jbang
if: ${{ steps.read-pr_number.outputs.pr_number != '' }}
uses: jbangdev/jbang-action@v0.117.1
uses: jbangdev/jbang-action@v0.118.0
with:
script: ghprcomment@koppor/ghprcomment
scriptargs: "-r JabRef/jabref -p ${{ steps.read-pr_number.outputs.pr_number }} -w ${{ github.event.workflow_run.id }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
submodules: 'false'
show-progress: 'false'
- name: markdownlint-cli2-action
uses: DavidAnson/markdownlint-cli2-action@v16
uses: DavidAnson/markdownlint-cli2-action@v17
with:
globs: |
*.md
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ dependencies {
implementation 'org.tinylog:tinylog-impl:2.7.0'

// route all requests to java.util.logging to SLF4J (which in turn routes to tinylog)
implementation 'org.slf4j:jul-to-slf4j:2.0.13'
implementation 'org.slf4j:jul-to-slf4j:2.0.16'
// route all requests to log4j to SLF4J
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.23.1'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.24.0'

implementation('de.undercouch:citeproc-java:3.1.0') {
exclude group: 'org.antlr'
Expand Down Expand Up @@ -337,7 +337,7 @@ dependencies {
implementation('dev.langchain4j:langchain4j-google-ai-gemini:0.34.0')
implementation('dev.langchain4j:langchain4j-hugging-face:0.34.0')
implementation 'ai.djl:api:0.29.0'
implementation 'ai.djl.pytorch:pytorch-model-zoo:0.29.0'
implementation 'ai.djl.pytorch:pytorch-model-zoo:0.30.0'
implementation 'ai.djl.huggingface:tokenizers:0.29.0'
implementation 'io.github.stefanbratanov:jvm-openai:0.11.0'
// openai depends on okhttp, which needs kotlin - see https://github.com/square/okhttp/issues/5299 for details
Expand Down Expand Up @@ -365,12 +365,12 @@ dependencies {
testImplementation "org.testfx:testfx-junit5:4.0.16-alpha"
testImplementation "org.hamcrest:hamcrest-library:3.0"

checkstyle 'com.puppycrawl.tools:checkstyle:10.18.0'
checkstyle 'com.puppycrawl.tools:checkstyle:10.18.1'
// xjc needs the runtime as well for the ant task, otherwise it fails
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.18.0"))
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.19.0"))
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,9 @@ Another indication is following output
```text
java.lang.UnsupportedClassVersionError: org/javamodularity/moduleplugin/ModuleSystemPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
```

## Attempts to open preferences panel freezes application

This is likely caused by improper integration of your OS or Desktop Environment with your password prompting program or password manager. Ensure that these are working properly, then restart your machine and attempt to run the program.

For reference, see issue [#11766](https://github.com/JabRef/jabref/issues/11766).
24 changes: 24 additions & 0 deletions src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.jabref.gui.DialogService;
import org.jabref.gui.StateManager;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.importer.actions.SearchGroupsMigrationAction;
import org.jabref.gui.preferences.GuiPreferences;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.logic.auxparser.DefaultAuxParser;
Expand Down Expand Up @@ -319,6 +320,17 @@ public AbstractGroup resultConverter(ButtonType button) {
searchGroupSearchTermProperty.getValue().trim(),
searchFlagsProperty.getValue());

if (currentDatabase.getMetaData().getGroupSearchSyntaxVersion().isEmpty()) {
// If the syntax version for search groups is not present, it indicates that the groups
// have not been migrated to the new syntax, or this is the first search group in the library.
// If this is the first search group, set the syntax version to the new version.
// Otherwise, it means that the user did not accept the migration to the new version.
Optional<GroupTreeNode> groups = currentDatabase.getMetaData().getGroups();
if (groups.filter(this::groupOrSubgroupIsSearchGroup).isEmpty()) {
currentDatabase.getMetaData().setGroupSearchSyntaxVersion(SearchGroupsMigrationAction.VERSION_6_0_ALPHA);
}
}

Optional<LuceneManager> luceneManager = stateManager.getLuceneManager(currentDatabase);
if (luceneManager.isPresent()) {
SearchGroup searchGroup = (SearchGroup) resultingGroup;
Expand Down Expand Up @@ -620,4 +632,16 @@ public StringProperty autoGroupPersonsFieldProperty() {
public StringProperty texGroupFilePathProperty() {
return texGroupFilePathProperty;
}

private boolean groupOrSubgroupIsSearchGroup(GroupTreeNode groupTreeNode) {
if (groupTreeNode.getGroup() instanceof SearchGroup) {
return true;
}
for (GroupTreeNode child : groupTreeNode.getChildren()) {
if (groupOrSubgroupIsSearchGroup(child)) {
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import org.jabref.model.groups.SearchGroup;
import org.jabref.model.search.SearchFlags;

import org.antlr.v4.runtime.misc.ParseCancellationException;

/**
* This action checks whether the syntax for SearchGroups is the new one.
* If not we ask the user whether to migrate.
Expand Down Expand Up @@ -54,18 +56,26 @@ public void performAction(ParserResult parserResult, DialogService dialogService
return;
}

parserResult.getMetaData().getGroups().ifPresent(this::migrateGroups);
parserResult.getMetaData().getGroups().ifPresent(groupTreeNode -> migrateGroups(groupTreeNode, dialogService));
parserResult.getMetaData().setGroupSearchSyntaxVersion(VERSION_6_0_ALPHA);
parserResult.setChangedOnMigration(true);
}

private void migrateGroups(GroupTreeNode node) {
private void migrateGroups(GroupTreeNode node, DialogService dialogService) {
if (node.getGroup() instanceof SearchGroup searchGroup) {
String luceneSearchExpression = SearchToLuceneMigration.migrateToLuceneSyntax(searchGroup.getSearchExpression(), searchGroup.getSearchFlags().contains(SearchFlags.REGULAR_EXPRESSION));
searchGroup.setSearchExpression(luceneSearchExpression);
try {
String luceneSearchExpression = SearchToLuceneMigration.migrateToLuceneSyntax(searchGroup.getSearchExpression(), searchGroup.getSearchFlags().contains(SearchFlags.REGULAR_EXPRESSION));
searchGroup.setSearchExpression(luceneSearchExpression);
} catch (ParseCancellationException e) {
Optional<String> luceneSearchExpression = dialogService.showInputDialogWithDefaultAndWait(
Localization.lang("Search group migration failed"),
Localization.lang("The search group '%0' could not be migrated. Please enter the new search expression.", searchGroup.getName()),
searchGroup.getSearchExpression());
luceneSearchExpression.ifPresent(searchGroup::setSearchExpression);
}
}
for (GroupTreeNode child : node.getChildren()) {
migrateGroups(child);
migrateGroups(child, dialogService);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public class HtmlToLatexFormatter extends Formatter implements LayoutFormatter {

private static final Logger LOGGER = LoggerFactory.getLogger(HtmlToLatexFormatter.class);

private static final int MAX_TAG_LENGTH = 100;

private static final Pattern REMOVE_TAGS_PATTERN = Pattern.compile("<[^>]{1,100}>");
private static final Pattern ESCAPED_PATTERN = Pattern.compile("&#([x]*)([0]*)(\\p{XDigit}+);");
private static final Pattern ESCAPED_PATTERN2 = Pattern.compile("(.)&#([x]*)([0]*)(\\p{XDigit}+);");
private static final Pattern ESCAPED_PATTERN3 = Pattern.compile("&#([x]*)([0]*)(\\p{XDigit}+);");
Expand All @@ -35,29 +34,12 @@ public String format(String text) {
return result;
}

StringBuilder sb = new StringBuilder();
// Deal with the form <sup>k</sup>and <sub>k</sub>
result = result.replaceAll("<[ ]?sup>([^<]+)</sup>", "\\\\textsuperscript\\{$1\\}");
result = result.replaceAll("<[ ]?sub>([^<]+)</sub>", "\\\\textsubscript\\{$1\\}");

// TODO: maybe rewrite this based on regular expressions instead
// Note that (at least) the IEEE Xplore fetcher must be fixed as it relies on the current way to
// remove tags for its image alt-tag to equation converter
for (int i = 0; i < result.length(); i++) {
int c = result.charAt(i);

if (c == '<') {
int oldI = i;
i = readTag(result, i);
if (oldI == i) {
// just a single <, which needs to be kept
sb.append('<');
}
} else {
sb.append((char) c);
}
}
result = sb.toString();
result = REMOVE_TAGS_PATTERN.matcher(result).replaceAll("");

// Handle text based HTML entities
Set<String> patterns = HTMLUnicodeConversionMaps.HTML_LATEX_CONVERSION_MAP.keySet();
Expand Down Expand Up @@ -122,16 +104,6 @@ public String getExampleInput() {
return "<strong>JabRef</strong>";
}

private int readTag(String text, int position) {
// Have just read the < character that starts the tag.
int index = text.indexOf('>', position);
if ((index > position) && ((index - position) < MAX_TAG_LENGTH)) {
return index; // Just skip the tag.
} else {
return position; // Don't do anything.
}
}

@Override
public String getName() {
return Localization.lang("HTML to LaTeX");
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/csl-locales
2 changes: 1 addition & 1 deletion src/main/resources/csl-styles
Submodule csl-styles updated 54 files
+3 −3 .github/workflows/merge.yaml
+3 −3 .github/workflows/sheldon.yaml
+334 −0 american-college-of-clinical-pharmacy.csl
+1 −1 american-physics-society.csl
+598 −0 associacao-brasileira-de-normas-tecnicas-numerico.csl
+6 −26 bern-university-of-applied-sciences-school-of-agricultural-forest-and-food-sciences-hafl.csl
+264 −0 bibliothek-fur-bildungsgeschichtliche-forschung.csl
+168 −0 borgyogyaszati-es-venerologiai-szemle.csl
+169 −0 british-journal-of-nutrition.csl
+196 −0 bulletin-of-insectology.csl
+416 −0 canadian-journal-of-criminology-and-criminal-justice.csl
+188 −0 canadian-urological-association-journal.csl
+305 −132 comptes-rendus-author-date.csl
+245 −0 council-of-science-editors-8th-edition.csl
+14 −10 council-of-science-editors.csl
+13 −0 dependent/comprehensive-reviews-in-food-science-and-food-safety.csl
+0 −14 dependent/digestive-and-liver-disease.csl
+16 −0 dependent/european-journal-of-neurology.csl
+16 −0 dependent/eurosurveillance.csl
+16 −0 dependent/g3.csl
+17 −0 dependent/quantitative-imaging-in-medicine-and-surgery.csl
+14 −0 dependent/revue-suisse-dhistoire.csl
+14 −0 dependent/rivista-storica-svizzera.csl
+18 −0 dependent/universidade-de-sao-paulo-instituto-de-fisica-de-sao-carlos-abnt-numerico.csl
+164 −0 digestive-and-liver-disease.csl
+163 −0 elsevier-vancouver-no-et-al.csl
+152 −0 european-journal-physical-medicine-and-rehabilitation.csl
+0 −164 g3.csl
+205 −0 gengo-kenkyu-journal-of-the-linguistic-society-of-japan.csl
+7 −7 glossa.csl
+236 −0 indian-journal-of-agricultural-sciences.csl
+382 −0 instrumenta-patristica-et-mediaevalia.csl
+235 −0 international-relations.csl
+21 −11 interpreting.csl
+159 −0 journal-of-advanced-ceramics.csl
+332 −0 journal-of-behavioral-health-and-psychology.csl
+131 −0 journal-of-bioscience-and-bioengineering.csl
+13 −7 journal-of-forensic-sciences.csl
+146 −0 journal-of-microscopy.csl
+175 −0 journal-of-obstetrics-and-gynaecology-canada.csl
+100 −64 journal-of-vegetation-science.csl
+1 −1 oxford-centre-for-mission-studies-harvard.csl
+283 −0 pathogens-and-immunity.csl
+224 −0 peter-lang-social-sciences.csl
+5 −1 society-for-american-archaeology.csl
+2 −2 south-african-journal-of-geology.csl
+1 −0 spec/filters.yaml
+11 −11 suburban-zeitschrift-fur-kritische-stadtforschung.csl
+16 −5 taylor-and-francis-national-library-of-medicine.csl
+20 −7 universitat-basel-iberoromanistik.csl
+647 −0 universitat-bern-institut-fur-theaterwissenschaft.csl
+252 −0 university-of-bucharest-faculty-of-law.csl
+205 −0 vietnam-journal-of-science-and-technology.csl
+237 −0 vitis-journal-of-grapevine-research.csl
4 changes: 3 additions & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,11 @@ Dynamically\ group\ entries\ by\ searching\ a\ field\ for\ a\ keyword=Dynamicall
Each\ line\ must\ be\ of\ the\ following\ form\:\ \'tab\:field1;field2;...;fieldN\'.=Each line must be of the following form\: 'tab\:field1;field2;...;fieldN'.

Search\ groups\ migration\ of\ %0=Search groups migration of %0
The\ search\ groups\ syntax\ is\ outdated.\ Do\ you\ want\ to\ migrate\ to\ the\ new\ syntax?= The search groups syntax is outdated. Do you want to migrate to the new syntax?
The\ search\ groups\ syntax\ is\ outdated.\ Do\ you\ want\ to\ migrate\ to\ the\ new\ syntax?=The search groups syntax is outdated. Do you want to migrate to the new syntax?
Migrate=Migrate
Keep\ as\ is=Keep as is
Search\ group\ migration\ failed=Search group migration failed
The\ search\ group\ '%0'\ could\ not\ be\ migrated.\ Please\ enter\ the\ new\ search\ expression.=The search group '%0' could not be migrated. Please enter the new search expression.
Edit=Edit

Edit\ file\ type=Edit file type
Expand Down

0 comments on commit 960361a

Please sign in to comment.