UNPKG

jats-xml

Version:

Types and utilities for working with JATS in Typescript

95 lines 3.95 kB
import type { GenericParent } from 'myst-common'; import type { Element, DeclarationAttributes } from 'xml-js'; import { type PageFrontmatter } from 'myst-frontmatter'; import type { Front, Body, Back, SubArticle, RefList, Reference, TitleGroup, ArticleTitle, Subtitle, Permissions, PubDate, License, Abstract, ContribGroup, Contrib, Affiliation, KeywordGroup, Keyword, ArticleCategories, ArticleMeta } from 'jats-tags'; import type { Logger } from 'myst-cli-utils'; import type { VFile } from 'vfile'; import { type SerializationOptions } from 'jats-utils'; type Options = { log?: Logger; source?: string; vfile?: VFile; }; type WriteOptions = SerializationOptions & { bodyOnly?: boolean; }; export declare class Jats { declaration?: DeclarationAttributes; doctype?: string; raw: Element; log?: Logger; tree: GenericParent; source?: string; vfile?: VFile; private frontmatterMessagesRecorded; constructor(data: string, opts?: Options); get frontmatter(): PageFrontmatter; get front(): Front | undefined; get articleMeta(): ArticleMeta | undefined; get permissions(): Permissions | undefined; get doi(): string | undefined; get pmc(): string | undefined; get pmid(): string | undefined; get publicationDates(): PubDate[]; get publicationDate(): PubDate | undefined; /** * JATS `<history>` can include multiple `<date date-type="...">` nodes, * often including an "accepted" date that is a better default for project/page `date`. */ get historyDates(): GenericParent[]; /** * Prefer a fully-specified publication date (day/month/year). * If publication date is incomplete (e.g. year-only), fall back through history dates. */ private resolvePublicationDate; private recordFrontmatterMessages; private pickPublicationDate; private static readonly PUB_HISTORY_PRIMARY_DATE_TYPES; private static readonly HISTORY_PRIMARY_DATE_TYPES; private jatsDateType; private dateHasDay; /** Last `<date>` with a `<day>` whose `date-type` is not in `excludeTypes`. */ private lastDateWithDay; private fallbackDatePick; private findHistoryDateByType; get historyAcceptedDate(): GenericParent | undefined; get pubHistoryFallbackDate(): GenericParent | undefined; get historyFallbackDate(): GenericParent | undefined; /** * Some sources store important dates under: * `<article-meta><pub-history><event><date date-type="...">...</date></event></pub-history>`. */ get pubHistoryDates(): GenericParent[]; private findPubHistoryDateByType; get pubHistoryPubDate(): GenericParent | undefined; get pubHistoryAcceptedDate(): GenericParent | undefined; get license(): License | undefined; get keywordGroup(): KeywordGroup | undefined; /** The first keywords */ get keywords(): Keyword[]; get keywordGroups(): KeywordGroup[]; get articleCategories(): ArticleCategories | undefined; get titleGroup(): TitleGroup | undefined; get articleTitle(): ArticleTitle | undefined; get articleSubtitle(): Subtitle | undefined; get articleAltTitle(): Subtitle | undefined; get abstract(): Abstract | undefined; get abstracts(): Abstract[]; get contribGroup(): ContribGroup | undefined; get contribGroups(): ContribGroup[]; get articleAuthors(): Contrib[]; get articleAffiliations(): Affiliation[]; get body(): Body | undefined; get back(): Back | undefined; get subArticles(): SubArticle[]; /** First `ref-list` in back matter. */ get refList(): RefList | undefined; /** All `ref-list` elements under `back`, in document order. */ get refLists(): RefList[]; /** Every `ref` from every `ref-list` under `back`, in document order. */ get references(): Reference[]; sort(): void; serialize(opts?: WriteOptions): string; } export {}; //# sourceMappingURL=jats.d.ts.map