Skip to Content
LibraryCoreSrcAnalyzerCommonInlinetextruncore/src/analyzer/common/inlineTextRun

Lawtext core references


Lawtext core references / core/src/analyzer/common/inlineTextRun

core/src/analyzer/common/inlineTextRun

Interfaces

Type Aliases

InlineTextEL

InlineTextEL = __Text | Ruby | Sup | Sub

Defined in: core/src/analyzer/common/inlineTextRun.ts:19 

An inline element whose text is a plain part of the sentence text.

A name (a law title, a keyword, etc.) written in the sentence may be split into these elements, e.g. 激<Ruby>甚<Rt>じん</Rt></Ruby>災害に対処するための特別の財政援助等に関する法律 (including a Ruby), or <Ruby>泡<Rt>あわ</Rt></Ruby>消火薬剤 (a Ruby at the start). (Emphasis dots may also be written as a Ruby, e.g. <Ruby>…<Rt>ヽ</Rt></Ruby>.) (The same elements as the law title candidates of $lawRef.)

The text of a Ruby is its base text without Rt (see textOfSentenceText), which is consistent with the sentence text and the names of the declarations.

Functions

canSplitInlineTextRunAt()

canSplitInlineTextRunAt(run, offset): boolean

Defined in: core/src/analyzer/common/inlineTextRun.ts:124 

Whether the run can be split at the offset (in the run text). A __Text can be split anywhere, while a Ruby, Sup or Sub cannot be split in the middle.

Parameters

run

InlineTextRun

offset

number

Returns

boolean


getInlineTextRunEndingAt()

getInlineTextRunEndingAt(parent, lastChildIndex, sentenceEnv): InlineTextRun | null

Defined in: core/src/analyzer/common/inlineTextRun.ts:83 

Get the run of InlineTextEL’s ending at the child (inclusive), e.g. the text immediately preceding parentheses. Returns null if the child is not an InlineTextEL.

Parameters

parent

EL

lastChildIndex

number

sentenceEnv

SentenceEnv

Returns

InlineTextRun | null


getInlineTextRuns()

getInlineTextRuns(parent, sentenceEnv): InlineTextRun[]

Defined in: core/src/analyzer/common/inlineTextRun.ts:97 

Get all the (maximal) runs of InlineTextEL’s in the children of the element.

Parameters

parent

EL

sentenceEnv

SentenceEnv

Returns

InlineTextRun[]


isInlineTextEL()

isInlineTextEL(el): el is InlineTextEL

Defined in: core/src/analyzer/common/inlineTextRun.ts:21 

Parameters

el

unknown

Returns

el is InlineTextEL


rangeOfELs()

rangeOfELs(els): [start: number, end: number] | null

Defined in: core/src/analyzer/common/inlineTextRun.ts:176 

The source range of the elements.

Parameters

els

EL[]

Returns

[start: number, end: number] | null


sliceTextEL()

sliceTextEL(textEL, start, end): __Text

Defined in: core/src/analyzer/common/inlineTextRun.ts:113 

Parameters

textEL

__Text

start

number

end

number

Returns

__Text


splitInlineTextRun()

splitInlineTextRun(run, start, end): { after: InlineTextEL[]; before: InlineTextEL[]; inner: InlineTextEL[]; } | null

Defined in: core/src/analyzer/common/inlineTextRun.ts:139 

Split the run at the range [start, end) (offsets in the run text). The original elements are kept (a __Text at a boundary is split), so that the text and the structure of the law are not changed by wrapping the inner elements.

Returns null if a boundary is in the middle of a Ruby, Sup or Sub.

Parameters

run

InlineTextRun

start

number

end

number

Returns

{ after: InlineTextEL[]; before: InlineTextEL[]; inner: InlineTextEL[]; } | null

© 2017-2026 yamachi