Skip to content

Citation style#21

Merged
laurent22 merged 15 commits intomainfrom
citation-style
Jul 31, 2021
Merged

Citation style#21
laurent22 merged 15 commits intomainfrom
citation-style

Conversation

@xUser5000
Copy link
Copy Markdown
Contributor

@xUser5000 xUser5000 commented Jul 28, 2021

The feature is not complete yet, but I decided to PR the changes I've done till now and get a review while working on the rest of the implementation. This saves a lot of time in my opinion. Please, don't merge this PR until I finish the initial implementation.

What has been done (till now)

  • Integrate Citeproc.js with a thin layer of abstraction: CSLProcessor Singleton Class
  • Register a new field in the config screen that enables the user to enter the path of a .csl file for styling. By default (if the field is empty), the APA style is used.
  • Insert an empty line between references.

Screenshots

APA
APA format

IEEE
IEEE format

What's next

  • Handle errors related to the .csl file (like "file not found" or "invalid format")
  • Escape HTML entities

@laurent22
Copy link
Copy Markdown
Member

Actually let me know when it's finished as I think it's easier that way. Otherwise my comments will be obsolete by the time you finish, or I might suggest changes that you're already planning to do.

@xUser5000
Copy link
Copy Markdown
Contributor Author

xUser5000 commented Jul 29, 2021

Did the following:

  • Handle errors related to the .csl file (like "file not found" or "invalid format")
  • Escape HTML entities

@xUser5000 xUser5000 added the enhancement New feature or request label Jul 30, 2021
Comment thread src/ui/settings.ts
type: SettingItemType.String,
section: SETTINGS_SECTION_ID,
public: true,
label: "BibTeX File",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the description, you should mention that multiple files can be specified, separated by ;

Comment thread src/ui/bibliography-renderer/index.ts Outdated
joplin.settings.onChange(async (event) => {
if (event.keys.includes(SETTINGS_CSL_FILE_PATH_ID)) {
await setProcessorStyle(processor);
await joplin.views.dialogs.showMessageBox(MESSAGE_RESTART_APP);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that work even from the config screen? Actually, you could simply add a description below the field to say that the app needs to be restarted.

@xUser5000
Copy link
Copy Markdown
Contributor Author

Done

@laurent22 laurent22 merged commit 8e936cf into main Jul 31, 2021
@xUser5000 xUser5000 mentioned this pull request Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants