usfm-editor
Version:
A WYSIWYG editor component for USFM
94 lines (93 loc) • 2.78 kB
TypeScript
import { Node } from "slate";
import { StyleType } from "./StyleTypes";
export interface MarkerInfo {
endMarker?: string;
styleType?: StyleType;
occursUnder: string[];
rank?: number;
}
/**
* The order of the identification markers listed here is the
* order that they should appear in the usfm document.
* The sort order is calculated using the ordering of the enum
* values here.
*/
declare enum IDENTIFICATION {
id = "id",
ide = "ide",
h = "h",
toc = "toc",
toca = "toca",
rem = "rem",
usfm = "usfm"
}
declare enum TITLES_HEADINGS_LABELS {
mt = "mt",
mte = "mte",
ms = "ms",
mr = "mr",
s = "s",
sr = "sr",
r = "r",
rq = "rq",
d = "d",
sp = "sp",
sd = "sd"
}
declare enum PARAGRAPHS {
p = "p"
}
declare enum SPECIAL_TEXT {
nd = "nd",
bk = "bk"
}
declare enum SPECIAL_FEATURES {
w = "w"
}
declare enum CHAPTERS_AND_VERSES {
c = "c",
v = "v"
}
declare type DestructuredMarker = {
pluses: string;
baseMarker: string;
number: string;
markerWithoutLeadingPlus: string;
};
export declare class UsfmMarkers {
/** https://ubsicap.github.io/usfm/identification */
static IDENTIFICATION: typeof IDENTIFICATION;
/** https://ubsicap.github.io/usfm/titles_headings */
static TITLES_HEADINGS_LABELS: typeof TITLES_HEADINGS_LABELS;
/**
* Paragraph markers, including poetry-indentation.
* https://ubsicap.github.io/usfm/paragraphs
*/
static PARAGRAPHS: typeof PARAGRAPHS;
/**
* Character markers that have semantic meaning.
* https://ubsicap.github.io/usfm/characters#special-text
*/
static SPECIAL_TEXT: typeof SPECIAL_TEXT;
/** https://ubsicap.github.io/usfm/characters#special-features */
static SPECIAL_FEATURES: typeof SPECIAL_FEATURES;
/** https://ubsicap.github.io/usfm/chapters_verses */
static CHAPTERS_AND_VERSES: typeof CHAPTERS_AND_VERSES;
static compare(markerA: string, markerB: string): number;
static isIdentification(markerOrNode: string | Node): boolean;
static isVerseOrChapterNumber(markerOrNode: string | Node): boolean;
static isParagraphType(markerOrNode: string | Node): boolean;
static isValid(marker: string): boolean;
static destructureMarker(marker: string): DestructuredMarker | undefined;
static getBaseMarker(marker: string): string | undefined;
private static isNumberedMilestoneMarker;
/**
* The sort order is calculated using the ordering of the markers
* in their category enum, as well as the number of the marker,
* if applicable. For example, "toc1" should occur before "toc2".
*/
private static getSortOrder;
private static isOfCategory;
private static marker;
}
export {};