koppor / jabref

Collection of simple for JabRef issues. Please submit PRs to https://github.com/jabRef/jabref/.
https://github.com/jabRef/jabref/
MIT License
8 stars 14 forks source link

AuthorListParser broken for "and others" #626

Closed koppor closed 1 year ago

koppor commented 1 year ago
@TechReport{Ao2019TR,
  title  = {The Industrial Reference Architecture ({iRefA}) -- Description and User Guidance for System Architects},
  editor = {Alexander Artemenko and others},
  year   = {2019},
}

Why is Ao2019TR generated as BibTeX key and not Artmenko? The AuthorListParser is broken!

Siedlerchr commented 1 year ago

What's your citaiton key pattern?

Siedlerchr commented 1 year ago

Default [auth][year] pattern generates:


@TechReport{Artemenko2019,
  title  = {The Industrial Reference Architecture ({iRefA}) -- Description and User Guidance for System Architects},
  editor = {Alexander Artemenko and others},
  year   = {2019},
}
k3KAW8Pnf7mkmdSMPHz27 commented 1 year ago

It could be the heuristics for companies/entities/organizations as well. It might get triggered (because only one name) and dislike the capitalization

morganteg commented 1 year ago

Hi, I'd like to contribute to fix the issue. I already have a fix idea that already make the AuthorListParserTest.java to be executed successfully. I only would to ask which Test Case should I execute in order to verify that the correct citation is generated:

@TechReport{Artemenko2019,
  title  = {The Industrial Reference Architecture ({iRefA}) -- Description and User Guidance for System Architects},
  editor = {Alexander Artemenko and others},
  year   = {2019},
}

Thanks, regards.

Siedlerchr commented 1 year ago

@morganteg That sounds great! I hope I understood you right, I think it should be sufficient to add a test case to CitationKeyGeneratorTest in addition to the AuthorListParserTest

morganteg commented 1 year ago

Yes, many thanks! I added the following test that should correctly test the issue:

@Test
void generateKeyCorrectKeyWithAndOthersAtTheEnd() {
    BibEntry entry = createABibEntryAuthor("Alexander Artemenko and others");
    entry.setField(StandardField.YEAR, "2019");
    assertEquals("Artemenko2019", generateKey(entry, "[auth][year]"));
}

If you agree, I will create a Pull Request with my changes.

Regards.

Siedlerchr commented 1 year ago

Yes that looks good! Go ahead!

koppor commented 1 year ago

Citation Key generator is probably authorsAlpha. All keys are listed at https://docs.jabref.org/setup/citationkeypatterns#special-field-markers. Test class is /src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTest.java#L27.