CSL4LibreOffice - G [Custom CSL Styles, build-time loading]#12951
Conversation
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
|
(PR state when ticket-check-action does not work as expected) |
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
| FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() | ||
| .addExtensionFilter(Localization.lang("Style file"), StandardFileType.JSTYLE) | ||
| .withDefaultExtension(Localization.lang("Style file"), StandardFileType.JSTYLE) | ||
| .addExtensionFilter(Localization.lang("JStyle file"), StandardFileType.JSTYLE) |
There was a problem hiding this comment.
Maybe %0 file? I'm sure we have it somewhere
There was a problem hiding this comment.
Added to localization.
I found:
So do you mean:
.addExtensionFilter(Localization.lang("%0 file", StandardFileType.JSTYLE.getName()), StandardFileType.JSTYLE)
.withDefaultExtension(Localization.lang("%0 file", StandardFileType.JSTYLE.getName()), StandardFileType.JSTYLE)That causes %0 to be "LibreOffice layout style". I can change that to "JStyle" and use it.
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
| if (matchingLayout.isEmpty()) { | ||
| matchingLayout = availableCslLayouts.stream() | ||
| .filter(layout -> layout.getDisplayName().equals(citationStyle.getTitle())) | ||
| .findFirst(); | ||
| } |
There was a problem hiding this comment.
The code uses an else branch to handle the case where matchingLayout is empty. It should return early if matchingLayout is present, following the fail-fast principle.
| path.map(Path::toAbsolutePath).map(Path::toString).ifPresent(stylePath -> { | ||
| Optional<CitationStyle> newStyleOptional = cslStyleLoader.addStyleIfValid(stylePath); |
There was a problem hiding this comment.
The code does not handle the case where path is empty before proceeding with the mapping operation. It should return early if path is not present.
| path.map(Path::toAbsolutePath).map(Path::toString).ifPresent(stylePath -> { | ||
| if (jStyleLoader.addStyleIfValid(stylePath)) { |
There was a problem hiding this comment.
The code does not handle the case where path is empty before proceeding with the mapping operation. It should return early if path is not present.
|
@trag-bot didn't find any issues in the code! ✅✨ |



Custom CSL Styles & build-time loading
Follow-up to #12472
A. Functionality
The list of available CSL styles is now determined at build-time.
Common metadata (
path,title,isNumericStyle) from internal.cslfiles is pre-fetched and stored in a JSON file (citation-style-catalog.json) viaCitationStyleCatalogGenerator. This reduces delays in population of the styles list (and cuts off some parsing overhead) for both the OO/LO integration as well as the preview viewer.Form:
{ "path" : "academy-of-management-review.csl", "isNumeric" : false, "title" : "Academy of Management Review" },Revamped Select Style dialog UI - now both the CSL and JStyle tabs uniformly use
TableView.Support for external CSL styles:
B. Code quality
CitationStylenow only handles modelling of a CSL style.CitationStyleCatalogGeneratoralong withCSLStyleLoadertakes care of loading/removal of styles.CSLStyleUtilshandles creation of CSL style instances and parsing.StyleSelectDialogView, the handling of different components is now much more neatly compartmentalized for both CSL styles and JStyles.StyleSelectDialogViewModelhas also been refactored for better manageability).OOBibStyletoJStyle.JStyleclass.Closes #12337
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)