Skip to content
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

"you must select a valid style file" problem #6303

Closed
DJuego opened this issue Apr 17, 2020 · 14 comments · Fixed by #6386
Closed

"you must select a valid style file" problem #6303

DJuego opened this issue Apr 17, 2020 · 14 comments · Fixed by #6386
Labels
openoffice/libreoffice status: waiting-for-feedback The submitter or other users need to provide more information about the issue

Comments

@DJuego
Copy link

DJuego commented Apr 17, 2020

Hi! Jabref is a very promising tool. Thank you for the developing!

My environment is Windows 10 x64.

My software is JabRef-5.0-portable_windows.zip (jabref portable version for Windows ). I've also tested the JabRef-5.1-portable_windows.zip (14-04-2020) with the same result.

When i try to load any style file i always get the message "you must select a valid style file".

I have tried the American_Mineralogist.jstyle and BJAST.jstyle files. i have downloaded this .jstyle files from https://github.com/JabRef/jstyles.jabref.org

I have test the UTF-8 encoding with notepad++

Any idea?

Thanks in advance!!

DJuego

jabref_style

@Siedlerchr
Copy link
Member

Hi,

I think the jstyles are a bit outdated. I looked into it, and I think the problem is that they use Author formatters which are no longer existing: For example the BJAST.jstyle file ues
AuthorAndsCommaReplacer. The new one would be the AuthorsSep.
See the help for an updated list:
https://docs.jabref.org/import-export/export/customexports#built-in-export-formatters

@Siedlerchr Siedlerchr added openoffice/libreoffice status: waiting-for-feedback The submitter or other users need to provide more information about the issue labels Apr 17, 2020
@DJuego
Copy link
Author

DJuego commented Apr 17, 2020

Thank you for so quickly suggesting an explanation , @Siedlerchr I will look into it.

On the same page with the "updates list" there is a link to the style repository I mentioned , and also it is linked the "Export-Filter Editor for Jabref". Apparently the generated .jstyle files are no longer compatible. :-(

https://docs.jabref.org/import-export/export/customexports#creating-the-export-filter

IMHO it is a serious drawback for jabref the impossibility to easily edit style files.

DJuego

@Siedlerchr
Copy link
Member

@DJuego These styles have all been created by external users, we do not maintain them. And the style editor plugin is also an external tool from @simonharrer I think?

@DJuego
Copy link
Author

DJuego commented Apr 17, 2020

@Siedlerchr . Very understandable. Hopefully the new version 5.0 will bring a cascade of collateral updates. :-)

DJuego

@teertinker
Copy link
Contributor

Hello,
I developed the "Export-Filter-Editor" some time ago. While not actively maintaining it, I could try to make some adjustments to make it work with JabRef 5.x .

I tried to understand the pattern for "valid style file" to be raised.

This is what I did find out:

The following style file (created with Export Filter Editor) works:

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

default=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`
While the following style has only one difference (definition for article instead of default type) and does not work.

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

article=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`
In my Test case, the same definitions can be used to setup a proper html export filter. So I suppose its not about depreceated fields that are being used.

Could there be a problem in the test routine when a style file is checked?

@Siedlerchr
Copy link
Member

Siedlerchr commented Apr 25, 2020

Thanks for the feedback, default is required since a while (since 5.0-beta)
Edit::// At least one line has to be of type default
Refs PR #5471

The dialog should ideally show the reason why the style is invalid

@teertinker
Copy link
Contributor

@Siedlerchr your comment did help to dig a bit deeper. I think, I was able to identify the problem:
"Export-Filter-Editor" does put default always at the beginning. JabRef, however, seems to assume default has to be the last type!

The following jstyle works:

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

article=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

default=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`

The following jstyle file does not work. The only difference type=default & type=article are changed by order:

`NAME
Documentation of jstyle (describing additional options):
http://jabref.sourceforge.net/OOPlugin-jabref.php

PROPERTIES
Title="Literatur"
IsSortByPosition=false
IsNumberEntries=false
ReferenceParagraphFormat="bibliografie"
ReferenceHeaderParagraphFormat="Standard"

CITATION
MaxAuthors=3
MaxAuthorsFirst=3
AuthorSeparator="/"
AuthorLastSeparator="/"
EtAlString=" u.a."
CitationSeparator="; "
MultiCiteChronological=true
BracketBefore=
BracketAfter=
BracketBeforeInList="["
BracketAfterInList="]"
MinimumGroupingCount=3
CitationCharacterFormat="Standard"
FormatCitations=true
GroupedNumbersSeparator="-"
UniquefierSeparator=","
InTextYearSeparator=" "
YearSeparator=" "

LAYOUT

default=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

article=\begin{author}\format[Authors(LastFirst,Fullname,sep=/,LastSep=/,EtAl= u.a.,3,3),]{\author} \end{author}\begin{year}(\year\uniq), \end{year}\begin{title}\format[RemoveLatexCommands]{\title}, \end{title}\begin{booktitle}\format[RemoveLatexCommands]{\booktitle}, \end{booktitle}\begin{institution}\format[RemoveLatexCommands]{\institution}, \end{institution}\begin{journal}\format[RemoveLatexCommands]{\journal} \end{journal}\begin{volume}(\format[RemoveLatexCommands]{\volume}).\end{volume}\begin{address} \format[RemoveLatexCommands]{\address}.\end{address}

`

I think the best way to solve the problem is to improve the validity checker.

@DJuego: Could you open your jstyle with an text editor and put your "default" definition at the last position and try if it works (of course not with outdated files like BJAST)?

@Siedlerchr
Copy link
Member

Hm, I took a quick look at the code, it should not matter where the default entry type is.
I checked using the default ones. Even at the first line it works.
The only other requirement is that stlye files must be in utf8 nowadays
https://github.com/JabRef/jabref/blob/master/src/main/resources/resource/openoffice/default_authoryear.jstyle

@DJuego
Copy link
Author

DJuego commented Apr 25, 2020

First; I am using the "Export-Filter_Editor_Windows_V04b.exe" in Windows 10 x64

Indeed. I can confirm that with the suggested modification of @teertinker the file seems to load correctly in Jabref. I simply opened the file with the notepad and moved the default line in the LAYOUT section.

However I am unable to apply the style over the references. But it probably has to do with my lack of knowledge about jabref, citations and styles. :-( F9 changes the style between the default jabref style and the IEEE style. It never changes to the Sensors style I have loaded. :-?

DJuego

Don´t work
https://paste.ofcode.org/7rkvn6KmxdaFSzrmD6KhcL

Work!
https://paste.ofcode.org/35xVapJXTPmEr6btUhvDeZY

@Siedlerchr
Copy link
Member

The jstyle we are talking about here, are for the usage in Open/Libre Office.

However, and that's a bit confusing, the layout part cansalso used for the Preview style in jabref (you can modify that in the preferences).
And for complete confusion the layout part can also be used to define custom export formats. It's the same functionality under the hood. Just three different functions

@teertinker
Copy link
Contributor

@DJuego:
Your second style file works on my JabRef 5.0 without any problems. A jstyle, however, does not affect your preview in JABREF as @Siedlerchr noted. But you can use the code within the LAYOUT section to modify your preview window.

@Siedlerchr:
The second layout file of @DJuego works immediatly. The first one gets refused. In both cases I saved the files with UTF-8. However, after registering the second layout file in JabRef I can modify the jstlye with an editor by pasting the code of the first layout file. The References are still parsed correctly in LibreOffice afterwards.
There must be a problem with the integrity checker - most probably it has something to do with the order of Bibtex types.

@teertinker
Copy link
Contributor

Today I did double check an example style file with a minimal setup (only title and year used). I did check for all global Properties to be included in the current documentation. The file is saved as UTF-8 on my pc. The same pattern persists:
1 If I put the \default definition at the last position the the jstyle file can be added
2. If i put the \default position at the beginning the jstyl file gets refused.

See:

Working: https://pastebin.com/73kiGpk0
vs.
Not Working: https://pastebin.com/SA4kMSQJ

From my perspective this is a bug within JabRef, therefore it makes not much sense to update Export-Filter-Editor at the moment.

@Siedlerchr
Copy link
Member

@teertinker You are right, I debugged it and the problem is a boolean variable "isDefaultLayoutPresent" which gets overwritten every time a new line is read. That explains why it only works at the end. Will create a fix

Siedlerchr added a commit that referenced this issue May 1, 2020
Fixes #6303
Adapted the error message to give a hint what is probably missing.

I also noticed a problem in eclipse when executing the L10n test. It was missing an add-opens
@teertinker
Copy link
Contributor

Yuppie! Great to hear.

Siedlerchr added a commit that referenced this issue May 2, 2020
* Fix jstyle was invalid with default section at the start

Fixes #6303
Adapted the error message to give a hint what is probably missing.

I also noticed a problem in eclipse when executing the L10n test. It was missing an add-opens

* Add test for validity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openoffice/libreoffice status: waiting-for-feedback The submitter or other users need to provide more information about the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants