.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
paper.py
Go to the documentation of this file.
1# SPDX-License-Identifier: AGPL-3.0-or-later
2"""Typification of the *paper* results.
3
4.. _BibTeX field types: https://en.wikipedia.org/wiki/BibTeX#Field_types
5.. _BibTeX format: https://www.bibtex.com/g/bibtex-format/
6
7Results of this type are rendered in the :origin:`paper.html
8<searx/templates/simple/result_templates/paper.html>` template.
9
10Related topics:
11
12- `BibTeX field types`_
13- `BibTeX format`_
14
15----
16
17.. autoclass:: Paper
18 :members:
19 :show-inheritance:
20
21"""
22# pylint: disable=too-few-public-methods, disable=invalid-name
23
24from __future__ import annotations
25
26__all__ = ["Paper"]
27
28import typing as t
29
30from searx.weather import DateTime
31from ._base import MainResult
32
33
34@t.final
35class Paper(MainResult, kw_only=True):
36 """Result type suitable for displaying scientific papers and other
37 documents."""
38
39 template: str = "paper.html"
40
41 date_of_publication: DateTime | None = None
42 """Date the document was published."""
43
44 content: str = ""
45 """An abstract or excerpt from the document."""
46
47 comments: str = ""
48 """Free text display in italic below the content."""
49
50 tags: list[str] = []
51 """Free tag list."""
52
53 type: str = ""
54 """Short description of medium type, e.g. *book*, *pdf* or *html* ..."""
55
56 authors: list[str] | set[str] = []
57 """List of authors of the work (authors with a "s" suffix, the "author" is
58 in the :py:obj:`MainResult.author`)."""
59
60 editor: str = ""
61 """Editor of the book/paper."""
62
63 publisher: str = ""
64 """Name of the publisher."""
65
66 journal: str = ""
67 """Name of the journal or magazine the article was published in."""
68
69 volume: str | int = ""
70 """Volume number."""
71
72 pages: str = ""
73 """Page range where the article is."""
74
75 number: str = ""
76 """Number of the report or the issue number for a journal article."""
77
78 doi: str = ""
79 """DOI number (like ``10.1038/d41586-018-07848-2``)."""
80
81 issn: list[str] = []
82 """List of ISSN numbers like ``1476-4687``"""
83
84 isbn: list[str] = []
85 """List of ISBN numbers like ``9780201896831``"""
86
87 pdf_url: str = ""
88 """URL to the full article, the PDF version"""
89
90 html_url: str = ""
91 """URL to full article, HTML version"""
92
93 def __post_init__(self):
94 super().__post_init__()
95 if self.date_of_publication is None and self.publishedDate is not None: