示例#1
0
def journal_issn(soup, pub_format, pub_type):
    if pub_format is None and pub_type is None:
        # return the first issn tag found regardless of which type
        return first(extract_nodes(soup, "issn"))
    elif pub_format is not None:
        return first(
            extract_nodes(soup,
                          "issn",
                          attr="publication-format",
                          value=pub_format))
    elif pub_type is not None:
        return first(
            extract_nodes(soup, "issn", attr="pub-type", value=pub_type))
示例#2
0
def custom_meta(soup, meta_name=None):
    custom_meta_tags = extract_nodes(soup, "custom-meta")
    if meta_name is not None:
        custom_meta_tags = [
            tag for tag in custom_meta_tags if node_contents_str(
                first(extract_nodes(tag, "meta-name"))) == meta_name
        ]
    return custom_meta_tags
示例#3
0
def research_organism_keywords(soup):
    tags = first(
        extract_nodes(soup,
                      "kwd-group",
                      attr="kwd-group-type",
                      value="research-organism"))
    if not tags:
        return None
    return [tag for tag in tags if tag.name == "kwd"] or None
示例#4
0
def label(soup):
    return first(extract_nodes(soup, "label"))
示例#5
0
def caption(soup):
    return first(extract_nodes(soup, "caption"))
示例#6
0
def article_title(soup):
    return first(extract_nodes(soup, "article-title"))
示例#7
0
def month(soup):
    return first(extract_nodes(soup, "month"))
示例#8
0
def article_body(soup):
    return first(extract_nodes(soup, "body"))
示例#9
0
def author_response(soup):
    return first(sub_article(soup, "reply"))
示例#10
0
def copyright_statement(soup):
    return first(extract_nodes(soup, "copyright-statement"))
示例#11
0
def publisher_id(soup):
    article_id_tags = article_id(soup, pub_id_type="publisher-id")
    # the first article-id tag whose parent is article-meta
    return first(
        [tag for tag in article_id_tags if tag.parent.name == "article-meta"])
示例#12
0
def title(soup):
    return first(extract_nodes(soup, "title"))
示例#13
0
def licence_url(soup):
    "License url attribute of the license tag"
    if licence(soup):
        return first(licence(soup)).get("xlink:href")
示例#14
0
def article_permissions(soup):
    # a better selector might be "article-meta.permissions"
    permissions_tags = permissions(soup)
    return first(
        [tag for tag in permissions_tags if tag.parent.name == "article-meta"])
示例#15
0
def acknowledgements(soup):
    return first(extract_nodes(soup, "ack"))
示例#16
0
def year(soup):
    return first(extract_nodes(soup, "year"))
示例#17
0
def author_notes(soup):
    return first(extract_nodes(soup, "author-notes"))
示例#18
0
def copyright_year(soup):
    return first(extract_nodes(soup, "copyright-year"))
示例#19
0
def doi(soup):
    doi_tags = article_id(soup, pub_id_type="doi")
    # the first article-id tag whose parent is article-meta
    return first(
        [tag for tag in doi_tags if tag.parent.name == "article-meta"])
示例#20
0
def copyright_holder(soup):
    return first(extract_nodes(soup, "copyright-holder"))
示例#21
0
def back(soup):
    return first(extract_nodes(soup, "back"))
示例#22
0
def funding_statement(soup):
    return first(extract_nodes(soup, "funding-statement"))
示例#23
0
def decision_letter(soup):
    tag = first(sub_article(soup, "article-commentary"))
    if not tag:
        tag = first(sub_article(soup, "decision-letter"))
    return tag
示例#24
0
def publisher(soup):
    return first(extract_nodes(soup, "publisher-name"))
示例#25
0
def journal_title(soup):
    return first(extract_nodes(soup, "journal-title"))
示例#26
0
def history_date(soup, date_type):
    date_tags = date(soup, date_type)
    return first([tag for tag in date_tags if tag.parent.name == "history"])
示例#27
0
def article_meta(soup):
    return first(extract_nodes(soup, "article-meta"))
示例#28
0
def day(soup):
    return first(extract_nodes(soup, "day"))
示例#29
0
def article_type(soup):
    # returns raw data, just that the data doesn't contain any BS nodes
    return first(extract_nodes(soup, "article")).get("article-type")
示例#30
0
 def test_first(self, value, expected):
     self.assertEqual(utils.first(value), expected)