Rename $SectioningCommand to $SectioningCtrlSeq or $Section (#21534)

GitOrigin-RevId: 5b3173d82ec4c00fe69e2ab059bf48a872a4ca3e
This commit is contained in:
Alf Eaton 2024-11-15 09:03:35 +00:00 committed by Copybot
parent 2dee905361
commit 36acad4d1b
4 changed files with 18 additions and 18 deletions

View file

@ -548,7 +548,7 @@ export const atomicDecorations = (options: Options) => {
break
}
}
} else if (nodeRef.type.is('$SectioningCommand')) {
} else if (nodeRef.type.is('$SectioningCtrlSeq')) {
const ancestorNode = ancestorNodeOfType(
state,
nodeRef.to,

View file

@ -40,13 +40,13 @@ const Styles = {
const typeMap: Record<string, string[]> = {
// commands that are section headings
PartCtrlSeq: ['$SectioningCommand'],
ChapterCtrlSeq: ['$SectioningCommand'],
SectionCtrlSeq: ['$SectioningCommand'],
SubSectionCtrlSeq: ['$SectioningCommand'],
SubSubSectionCtrlSeq: ['$SectioningCommand'],
ParagraphCtrlSeq: ['$SectioningCommand'],
SubParagraphCtrlSeq: ['$SectioningCommand'],
PartCtrlSeq: ['$SectioningCtrlSeq'],
ChapterCtrlSeq: ['$SectioningCtrlSeq'],
SectionCtrlSeq: ['$SectioningCtrlSeq'],
SubSectionCtrlSeq: ['$SectioningCtrlSeq'],
SubSubSectionCtrlSeq: ['$SectioningCtrlSeq'],
ParagraphCtrlSeq: ['$SectioningCtrlSeq'],
SubParagraphCtrlSeq: ['$SectioningCtrlSeq'],
// commands that have a "command tooltip"
HrefCommand: ['$CommandTooltipCommand'],
Include: ['$CommandTooltipCommand'],
@ -90,7 +90,7 @@ export const LaTeXLanguage = LRLanguage.define({
// enough? For some reason it doesn't work if there's a newline after
// \section{a}, but works for \section{a}b
$Environment: node => node.getChild('Content'),
$SectioningCommand: node => {
$Section: node => {
const BACKWARDS = -1
const lastChild = node.resolveInner(node.to, BACKWARDS)
const content = node.getChild('Content')

View file

@ -480,14 +480,14 @@ SectioningCommand<Command> {
documentSection<Command, Next> {
SectioningCommand<Command> Content<(sectionText | !section Next)*>
}
Book[@isGroup="$SectioningCommand"] { documentSection<BookCtrlSeq, Part | Chapter | Section | SubSection | SubSubSection | Paragraph | SubParagraph> }
Part[@isGroup="$SectioningCommand"] { documentSection<PartCtrlSeq, Chapter | Section | SubSection | SubSubSection | Paragraph | SubParagraph> }
Chapter[@isGroup="$SectioningCommand"] { documentSection<ChapterCtrlSeq, Section | SubSection | SubSubSection | Paragraph | SubParagraph> }
Section[@isGroup="$SectioningCommand"] { documentSection<SectionCtrlSeq, SubSection | SubSubSection | Paragraph | SubParagraph> }
SubSection[@isGroup="$SectioningCommand"] { documentSection<SubSectionCtrlSeq, SubSubSection | Paragraph | SubParagraph> }
SubSubSection[@isGroup="$SectioningCommand"] { documentSection<SubSubSectionCtrlSeq, Paragraph | SubParagraph> }
Paragraph[@isGroup="$SectioningCommand"] { documentSection<ParagraphCtrlSeq, SubParagraph> }
SubParagraph[@isGroup="$SectioningCommand"] { SectioningCommand<SubParagraphCtrlSeq> Content<sectionText*> }
Book[@isGroup="$Section"] { documentSection<BookCtrlSeq, Part | Chapter | Section | SubSection | SubSubSection | Paragraph | SubParagraph> }
Part[@isGroup="$Section"] { documentSection<PartCtrlSeq, Chapter | Section | SubSection | SubSubSection | Paragraph | SubParagraph> }
Chapter[@isGroup="$Section"] { documentSection<ChapterCtrlSeq, Section | SubSection | SubSubSection | Paragraph | SubParagraph> }
Section[@isGroup="$Section"] { documentSection<SectionCtrlSeq, SubSection | SubSubSection | Paragraph | SubParagraph> }
SubSection[@isGroup="$Section"] { documentSection<SubSectionCtrlSeq, SubSubSection | Paragraph | SubParagraph> }
SubSubSection[@isGroup="$Section"] { documentSection<SubSubSectionCtrlSeq, Paragraph | SubParagraph> }
Paragraph[@isGroup="$Section"] { documentSection<ParagraphCtrlSeq, SubParagraph> }
SubParagraph[@isGroup="$Section"] { SectioningCommand<SubParagraphCtrlSeq> Content<sectionText*> }
sectioningCommand {
Book | Part | Chapter | Section | SubSection | SubSubSection | Paragraph | SubParagraph

View file

@ -149,7 +149,7 @@ export const enterNode = (
return state.doc.sliceString(ctrlSeq.from + 1, ctrlSeq.to)
}
const nestingLevel = parent?.type.is('$SectioningCommand')
const nestingLevel = parent?.type.is('$Section')
? getNestingLevel(parent.type.id)
: getNestingLevel(getCommandName())