Răsfoiți Sursa

Merge pull request #3469 from overleaf/msm-add-koma-outline-sections

Add addpart, addchap, addsect levels to Outline

GitOrigin-RevId: 4e750664011c208df6403a7d6efd52ce30fc5310
Jakob Ackermann 5 ani în urmă
părinte
comite
50b7591a11

+ 3 - 0
services/web/frontend/js/features/outline/outline-parser.js

@@ -1,8 +1,11 @@
 const COMMAND_LEVELS = {
   book: 10,
   part: 20,
+  addpart: 20,
   chapter: 30,
+  addchap: 30,
   section: 40,
+  addsect: 40,
   subsection: 50,
   subsubsection: 60,
   paragraph: 70,

+ 14 - 8
services/web/test/frontend/features/outline/outline-parser.test.js

@@ -11,8 +11,11 @@ describe('OutlineParser', function() {
       const content = `
       \\book{Book}
       \\part{Part}
+      \\addpart{Part 2}
       \\chapter{Chapter}
+      \\addchap{Chapter 2}
       \\section{Section 1}
+      \\addsect{Section 1b}
       \\subsection{Subsection}
       \\subsubsection{Subsubsection}
       \\section{Section 2}
@@ -24,14 +27,17 @@ describe('OutlineParser', function() {
       expect(outline).to.deep.equal([
         { line: 2, title: 'Book', level: 10 },
         { line: 3, title: 'Part', level: 20 },
-        { line: 4, title: 'Chapter', level: 30 },
-        { line: 5, title: 'Section 1', level: 40 },
-        { line: 6, title: 'Subsection', level: 50 },
-        { line: 7, title: 'Subsubsection', level: 60 },
-        { line: 8, title: 'Section 2', level: 40 },
-        { line: 9, title: 'Subsubsection without subsection', level: 60 },
-        { line: 10, title: 'a paragraph', level: 70 },
-        { line: 11, title: 'a subparagraph', level: 80 }
+        { line: 4, title: 'Part 2', level: 20 },
+        { line: 5, title: 'Chapter', level: 30 },
+        { line: 6, title: 'Chapter 2', level: 30 },
+        { line: 7, title: 'Section 1', level: 40 },
+        { line: 8, title: 'Section 1b', level: 40 },
+        { line: 9, title: 'Subsection', level: 50 },
+        { line: 10, title: 'Subsubsection', level: 60 },
+        { line: 11, title: 'Section 2', level: 40 },
+        { line: 12, title: 'Subsubsection without subsection', level: 60 },
+        { line: 13, title: 'a paragraph', level: 70 },
+        { line: 14, title: 'a subparagraph', level: 80 }
       ])
     })