Skip to main content

Not just zotero tools.

Project description

Noterools: Not just Zotero Tools

中文文档 | English

At the beginning, I just wanted to write a Python implementation based on gwyn-hopkins's code to add clickable hyperlinks to Zotero citations. However, as my paper underwent more revisions, I found myself needing to make increasingly complex formatting adjustments. Consequently, the functionality of the code expanded. After extensive refactoring, noterools was born.

What is this?

Currently, noterools can help you do the following things:

  • Create bookmarks for each reference in the Zotero bibliography.
  • Set hyperlinks for Zotero citations that navigate to the corresponding references and adjust whether the hyperlinks are underlined.
  • Customize the font color of Zotero citations.
  • Italicize journal names and publishers in the Zotero bibliography that aren't correctly formatted as italics.
  • Adjust the font color and weight for cross-references within the main text.
  • Replace the hyphen (-, Unicode 002D) used for page ranges in the bibliography with an en dash (–, Unicode 2013).
  • Add hyperlinks to the links in the bibliography and set the font colour and whether they are underlined or not
  • (Experimental Feature) Modify the capitalization style of English reference titles. Supports three styles: ALL CAPS, Title Case (Capitalize Each Word), and Sentence case (Capitalize first word only).
  • (Experimental Feature) Add hyperlinks to in-text citations in (Author, Date) format (by default, only Date is added).

Screenshots

citation and bibliography

cross-references

Important Note

  • This script can only work in Windows.

How to use?

  1. Install noterools via pip.
pip install noterools
  1. Create a Python script and run it. Here is a simple example.
from noterools import Word, add_cross_ref_style_hook, add_citation_cross_ref_hook

if __name__ == '__main__':
    word_file_path = r"E:\Documents\Word\test.docx"
    new_file_path = r"E:\Documents\Word\test_new.docx"

    with Word(word_file_path, save_path=new_file_path) as word:
        # Add hyperlinks for numbered citation formats.
        add_citation_cross_ref_hook(word, is_numbered=True)

        # Add hyperlinks to (Author, Year) citation format, set the citation font color to blue.
        # By default, container titles or publishers in the bibliography that are not correctly italicized will be set to italics.
        # By default, only the year portion is hyperlinked. Set full_citation_hyperlink=True to make the entire citation (author+year) hyperlinked. (This is still an experimental feature, and it may produce unexpected results.)
        # add_citation_cross_ref_hook(word, is_numbered=False, full_citation_hyperlink=True)

        # By setting the value of color, you can change the color of the entire citation (excluding the parentheses).
        # 0: Black
        # 16711680: Blues
        # For more colors, please see: https://learn.microsoft.com/en-us/office/vba/api/word.wdcolor
        # add_citation_cross_ref_hook(word, is_numbered=False, color=0)
        # Or input RGB value instead
        # add_cross_ref_style_hook(word, is_numbered=False, color="0, 0, 255")
        # Or change to "Automatic" in Microsoft Word
        # add_cross_ref_style_hook(word, is_numbered=False, color="word_auto")

        # set_container_title_italic is used to control whether to correct names in the bibliography that are not properly italicized.
        # You can disable this feature by setting it to False.
        # add_citation_cross_ref_hook(word, is_numbered=False, set_container_title_italic=False)

        # Set the font color and bold style for cross-references starting with 'Figure' in the main contents.
        add_cross_ref_style_hook(word, color=16711680, bold=True, key_word=["Figure"])

        # Replace the hyphen with en dash.
        # To use this feature, you need to call `zotero_init_client` to initialize the client to communicate with Zotero.
        # Please refer to the pyzotero documentation to find your Zotero ID and apply for an API key.
        # https://pyzotero.readthedocs.io/en/latest/#getting-started-short-version
        # zotero_init_client(zotero_id="Your Zotero ID", zotero_api_key="Your Zotero API key")
        # add_update_dash_symbol_hook(word, "Your ID", "Your key")

        # Change English articles' title format to All CAPS.
        # add_format_title_hook(word, upper_all_words=True)

        # Change English articles' title format to Title Case (minor words will be changed too).
        # add_format_title_hook(word, upper_first_char=True)

        # Change English articles' title format to Sentence Case.
        # add_format_title_hook(word, lower_all_words=True)

        # You can give a list contains proper noun when change format to Sentence Case.
        # word_list = ["UNet", "US", "China", "WRF"]
        # add_format_title_hook(word, lower_all_words=True, word_list=word_list)

        # Add hyperlinks to URLs in bibliography
        # add_url_hyperlink_hook(word)

        # And customize URL appearance (parameters are optional)
        # add_url_hyperlink_hook(word, color=16711680, no_under_line=False)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

noterools-1.1.4.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

noterools-1.1.4-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file noterools-1.1.4.tar.gz.

File metadata

  • Download URL: noterools-1.1.4.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for noterools-1.1.4.tar.gz
Algorithm Hash digest
SHA256 f5e99ef4e04cb593e56943352cc1850c66116bd4de2c9fe1b6f6f628aff5a1c0
MD5 01d9df47a27c57b37affdf51189b3197
BLAKE2b-256 b463a8f99cd17374e323562499a8f976a86aeb01bc730fd301f99e50e05c33a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for noterools-1.1.4.tar.gz:

Publisher: python-package.yaml on Syize/noterools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file noterools-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: noterools-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for noterools-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bb44aafd714a3f3fe1ade92619c1d3c12651640e89f2f60496ca783f20812c32
MD5 dcef45bd571d0b170c2f6cc5949fbf09
BLAKE2b-256 efc006749da060cce4cd007cee72930ab9e056cfa0925183ff7b436b2e74c4fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for noterools-1.1.4-py3-none-any.whl:

Publisher: python-package.yaml on Syize/noterools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page