Forráskód Böngészése

make the . after section number optional

Le Tan 4 éve
szülő
commit
2600d12fc2

+ 1 - 1
libs/vtextedit

@@ -1 +1 @@
-Subproject commit 47347580cbcd460ebbbc8358e37b409530edaa2f
+Subproject commit 96f56ccd3ca6c5037183690cb36b41f716fc0367

+ 5 - 5
src/data/extra/web/css/globalstyles.css

@@ -22,27 +22,27 @@
 
 #vx-content.vx-section-number h2::before {
     counter-increment: section1;
-    content: counter(section1) ". ";
+    content: counter(section1) " ";
 }
 
 #vx-content.vx-section-number h3::before {
     counter-increment: section2;
-    content: counter(section1) "." counter(section2) ". ";
+    content: counter(section1) "." counter(section2) " ";
 }
 
 #vx-content.vx-section-number h4::before {
     counter-increment: section3;
-    content: counter(section1) "." counter(section2) "." counter(section3) ". ";
+    content: counter(section1) "." counter(section2) "." counter(section3) " ";
 }
 
 #vx-content.vx-section-number h5::before {
     counter-increment: section4;
-    content: counter(section1) "." counter(section2) "." counter(section3) "." counter(section4) ". ";
+    content: counter(section1) "." counter(section2) "." counter(section3) "." counter(section4) " ";
 }
 
 #vx-content.vx-section-number h6::before {
     counter-increment: section5;
-    content: counter(section1) "." counter(section2) "." counter(section3) "." counter(section4) "." counter(section5) ". ";
+    content: counter(section1) "." counter(section2) "." counter(section3) "." counter(section4) "." counter(section5) " ";
 }
 
 #vx-content.vx-constrain-image-width img {

+ 6 - 1
src/widgets/editors/markdowneditor.cpp

@@ -1100,9 +1100,14 @@ static void increaseSectionNumber(QVector<int> &p_sectionNumber, int p_level, in
 static QString joinSectionNumberStr(const QVector<int> &p_sectionNumber)
 {
     QString res;
+    // TODO: make it configurable? 1.1 or 1.1.?
     for (auto sec : p_sectionNumber) {
         if (sec != 0) {
-            res = res + QString::number(sec) + '.';
+            if (res.isEmpty()) {
+                res = QString::number(sec);
+            } else {
+                res += '.' + QString::number(sec);
+            }
         } else if (res.isEmpty()) {
             continue;
         } else {