Пример #1
0
def get_isbn_csl_item_zotero(isbn):
    """
    Generate CSL JSON Data for an ISBN using Zotero's translation-server.
    """
    from manubot.cite.zotero import export_as_csl, search_query
    zotero_data = search_query(f'isbn:{isbn}')
    csl_data = export_as_csl(zotero_data)
    csl_item, = csl_data
    return csl_item
Пример #2
0
def test_search_query_isbn():
    """
    The translation-server search endpoint can be tested via curl:
    ```
    curl \
      --header "Content-Type: text/plain" \
      --data 'isbn:9781339919881' \
      'https://translate.manubot.org/search'
    ```
    """
    identifier = "isbn:9781339919881"
    zotero_data = search_query(identifier)
    assert zotero_data[0]["title"].startswith("The hetnet awakens")
Пример #3
0
def test_search_query(identifier):
    """
    The translation-server search endpoint can be tested via curl:
    ```
    curl --verbose \
      --header "Content-Type: text/plain" \
      --data '30571677' \
      'https://translate.manubot.org/search'
    ```
    translation-server does not support PMIDs with a `pmid:` prefix.
    https://github.com/zotero/translation-server/issues/71
    """
    zotero_data = search_query(identifier)
    assert zotero_data[0]['title'].startswith(
        'Ten simple rules for documenting scientific software')
    assert zotero_data[0]['creators'][0]['lastName'] == 'Lee'
Пример #4
0
def test_search_query_arxiv():
    """
    Test citing https://arxiv.org/abs/1604.05363v1
    The translation-server search endpoint can be tested via curl:
    ```
    curl --verbose \
      --header "Content-Type: text/plain" \
      --data 'arxiv:1604.05363v1' \
      'https://translate.manubot.org/search'
    ```
    """
    identifier = 'arxiv:1604.05363v1'
    zotero_data = search_query(identifier)
    assert zotero_data[0][
        'title'] == 'Comparing Published Scientific Journal Articles to Their Pre-print Versions'
    assert zotero_data[0]['creators'][-1]['firstName'] == 'Todd'
    assert zotero_data[0]['date'] == '2016-04-18'