Преглед изворни кода

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

GitOrigin-RevId: 5b3173d82ec4c00fe69e2ab059bf48a872a4ca3e
Alf Eaton пре 1 година
родитељ
комит
36acad4d1b

+ 1 - 1
services/web/frontend/js/features/source-editor/extensions/visual/atomic-decorations.ts

@@ -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,

+ 8 - 8
services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts

@@ -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')

+ 8 - 8
services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar

@@ -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

+ 1 - 1
services/web/frontend/js/features/source-editor/utils/tree-operations/outline.ts

@@ -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())