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

Scripting: Remove reading notes from tex field "notes" based on tag #2878

Closed
Neigelily opened this issue May 13, 2024 · 9 comments
Closed

Scripting: Remove reading notes from tex field "notes" based on tag #2878

Neigelily opened this issue May 13, 2024 · 9 comments
Labels

Comments

@Neigelily
Copy link

Debug log ID

remove-reading-notes

What happened?

Hello,

Would it be possible to get help writing a postscript that removes Zotero reading notes from tex field "note" based on tag specifying that a Zotero note is a reading note?

Thanks a lot in advance!

Copy link

Hello @Neigelily,

@retorquere is ready to assist you with Better BibTeX. In order to do so efficiently, a debug log is generally required. The information it containst is key to him understanding, replicating, and resolving your issue.

Here’s how you can share your debug log:

  1. If your issue involves specific references, citekey generation, or exports, right-click on the relevant item(s) and select "Better BibTeX -> Submit Better BibTeX debug log" from the menu.
  2. For issues where items do not play a role, follow these steps:
  • Restart Zotero with debugging enabled (Help -> Debug Output Logging -> Restart with logging enabled).
  • Reproduce the problem.
  • Choose "Send Better BibTeX debug report..." from the help menu.

After these steps, you will receive debug ID displayed in red. Please share this ID with @retorquere in this issue thread. If your query is about an export, include both the actually exported result and your expected/desired outcome.

Sharing your debug log gives @retorquere a view of your Better BibTeX configuration and the elements contributing to the issue. This helps him address your concerns more efficiently.

Thank you.

PS: If the Debug Log menu is not available, or if it fails to send the debug log, you can use the option under “Help” > “Send debug log to file.io”.

@retorquere
Copy link
Owner

remove-reading-notes is not a debug log ID of course.

@retorquere retorquere closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
@Neigelily
Copy link
Author

I'm very sorry for not including a debug log ID. I wasn't sure as to whether I should since I'm not encountering any bug. Here it is: P8LZ55QA-euc/6.7.192-6

@retorquere
Copy link
Owner

I'll need a debug log obtained by right-clicking the item of interest abs sending it from the menu that pops up. It will have -refs- in it.

@Neigelily
Copy link
Author

Thank you, here it is: 6QZ8IQX2-refs-euc/6.7.192-6

@retorquere
Copy link
Owner

I will take a look when I'm back home.

@Neigelily
Copy link
Author

Thanks a lot!

@retorquere
Copy link
Owner

if (Translator.BetterTeX) { // only for tex, not for CSL
  if (zotero.notes) { // only if the item has notes
    // remove the field unconditionally -- if you filter all notes away, the input may be empty, and add doesn't do anything if the input
    // is empty -- maybe I should change that
    tex.remove('notes')
    // keepeverything except the unwanted note, that is: notes without tags, or, if a note has tags, not the tag 'Reading note'
    zotero.notes = zotero.notes.filter(note => !note.tags || !note.tags.find(tag => tag.tag === 'Reading note'))
    // add the field back
    this.add({ name: 'note', value: zotero.notes.map(note => note.note).join('</p><p>'), html: true })
  }
}

@Neigelily
Copy link
Author

It works, thank you so much! And thanks a lot for your work on this awesome plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants