76708ce767
The list was printing each citation's quote under a `引用 #53` tag: no authors, no year, no pages, no DOI — the quoted passage where the entry should be — and it numbered *citations*, so a paper with 86 citations to 65 works listed 21 of them two or three times under different numbers. The same article was `[5]` in one paragraph and `[17]` in another. Two rules were wrong, so two are stated here: **A work is numbered where the reader first meets it.** A citation is a place in the text; an entry is a work. `citations` still has one row per place, and each row now carries the number of its *work*, so the marker in the text, the tooltip on it and the entry in the list are the same number. The document grew a `references` list — the entries, in order — and `reference_style`, which names the style that wrote them. **How a reference prints is a property of a style, not of a citation.** The new `app/citation_styles` package holds one module per style; `springer.py` implements Springer's basic style, whose shape is `Names: Title. <where it sits> (year). <identifier>` with a branch per document type — a journal with its volume(issue) and pages, a book with publisher and place, a chapter inside somebody else's book, a patent with its number, a page whose URL is its source. Three of its rules are decisions rather than transcription, and each is documented where it applies: up to six contributors are named and more become three plus `et al.`; a journal prints under its 刊名缩写 when the writer stored one, because no algorithm abbreviates an arbitrary title correctly; and a CJK name keeps its printed form even with halves filled in, because dotting 「三」 into an initial is wrong in Chinese and insufficient in English. Nothing is invented to fill a gap. An entry says what it knows and reports the rest as `missing` (「缺 责任者、出版年」), and the document warns about the incomplete ones by number: an entry that is short because fields are empty looks like a fact about the document rather than a library that needs attention. `document_text` had the same bug in the MCP surface and now prints the entries, with in-text markers taken from the document's numbering rather than from each sentence's local position — which is what made the text an agent reads disagree with the list under it. `scripts/check_citation_styles.py` checks the formatter with no server and no database: one reference of every type, and the exact entry the style calls for.
102 lines
2.2 KiB
Python
102 lines
2.2 KiB
Python
"""Pydantic schemas for request and response payloads."""
|
|
|
|
from app.schemas.common import (
|
|
BatchDeleteRequest,
|
|
BatchDeleteResult,
|
|
PageResult,
|
|
normalize_hex_color,
|
|
)
|
|
from app.schemas.paper import (
|
|
CitationInput,
|
|
CitationRead,
|
|
PaperCitationRead,
|
|
PaperCreate,
|
|
PaperDocumentRead,
|
|
PaperListItem,
|
|
PaperRead,
|
|
PaperReferenceRead,
|
|
PaperStatus,
|
|
PaperUpdate,
|
|
ParagraphListRead,
|
|
ParagraphRead,
|
|
ParagraphUpdate,
|
|
SentenceCreate,
|
|
SentenceRead,
|
|
SentenceUpdate,
|
|
)
|
|
from app.schemas.reference import (
|
|
ReferenceAuthorInput,
|
|
ReferenceAuthorRead,
|
|
ReferenceCitationRead,
|
|
ReferenceCreate,
|
|
ReferenceListItem,
|
|
ReferenceRead,
|
|
ReferenceUpdate,
|
|
normalize_doi,
|
|
)
|
|
from app.schemas.reference_tag import (
|
|
ReferenceTagCreate,
|
|
ReferenceTagRead,
|
|
ReferenceTagRef,
|
|
ReferenceTagUpdate,
|
|
)
|
|
from app.schemas.template import (
|
|
TemplateCreate,
|
|
TemplateListItem,
|
|
TemplateRead,
|
|
TemplateUpdate,
|
|
TemplateTitlePlacementInput,
|
|
TemplateTitlePlacementRead,
|
|
)
|
|
from app.schemas.template_title import (
|
|
TemplateTitleCreate,
|
|
TemplateTitleRead,
|
|
TemplateTitleRef,
|
|
TemplateTitleUpdate,
|
|
)
|
|
|
|
__all__ = [
|
|
"BatchDeleteRequest",
|
|
"ReferenceAuthorInput",
|
|
"ReferenceAuthorRead",
|
|
"ReferenceCitationRead",
|
|
"ReferenceCreate",
|
|
"ReferenceListItem",
|
|
"ReferenceRead",
|
|
"ReferenceTagCreate",
|
|
"ReferenceTagRead",
|
|
"ReferenceTagRef",
|
|
"ReferenceTagUpdate",
|
|
"ReferenceUpdate",
|
|
"normalize_doi",
|
|
"CitationInput",
|
|
"CitationRead",
|
|
"PaperCitationRead",
|
|
"PaperCreate",
|
|
"PaperDocumentRead",
|
|
"PaperListItem",
|
|
"PaperRead",
|
|
"PaperReferenceRead",
|
|
"PaperStatus",
|
|
"PaperUpdate",
|
|
"ParagraphListRead",
|
|
"ParagraphRead",
|
|
"ParagraphUpdate",
|
|
"SentenceCreate",
|
|
"SentenceRead",
|
|
"SentenceUpdate",
|
|
"BatchDeleteResult",
|
|
"PageResult",
|
|
"TemplateCreate",
|
|
"TemplateListItem",
|
|
"TemplateRead",
|
|
"TemplateUpdate",
|
|
"TemplateTitleCreate",
|
|
"TemplateTitleRead",
|
|
"TemplateTitleRef",
|
|
"TemplateTitleUpdate",
|
|
"TemplateTitlePlacementInput",
|
|
"TemplateTitlePlacementRead",
|
|
"normalize_hex_color",
|
|
]
|